PenUltima Online

It is currently Wed Aug 20, 2008 10:19 am

All times are UTC - 4 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: DestroyItem on CanInsertScript -> Crash (POL 097)
PostPosted: Sun Mar 02, 2008 11:02 pm 
Offline
User avatar

Joined: Fri Feb 10, 2006 4:15 am
Posts: 202
Consider this script:

Code:
use uo;

program CanInsertItemIntoContainer( who, container, movetype, inserttype, adding_item, existing_stack, amount_to_add )
    if (adding_item)
        DestroyItem(adding_item);
    endif
endprogram


Dragging item into container having caninsertscript like that will print into console "remove_item_from_world: item [serial] at 0,0 does not exist in world zone", "Unhandled Exception! Minidump started...", and POL will crash. If this is something _hard_ to fix so that destroying would become possible, how about failing the destroy request and printing something informal, like "GAAH! IDIOT SCRIPTER KILL KILL KILL!" into console instead? Even that would be better than crashing.

I see that this is noted in documentation, "You should not destroy the adding_item in the CanInsert script.", so maybe this should be feature request instead of bug report?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 02, 2008 11:45 pm 
Offline

Joined: Sat Feb 04, 2006 10:26 pm
Posts: 533
Do you get problems in OnInsert?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 02, 2008 11:57 pm 
Offline
User avatar

Joined: Fri Feb 10, 2006 4:15 am
Posts: 202
No. OnInsertScript does not care if item gets destroyed.

To me this is more of a little annoyance, nice-to-not-have-around-if-you-are-new-to-escript, than something that cannot be lived with.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 03, 2008 2:34 am 
Offline

Joined: Tue Mar 20, 2007 11:17 am
Posts: 99
Location: Poland
caninsert - return 1;
oninsert - destroy;


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 03, 2008 5:34 am 
Offline

Joined: Sat Feb 04, 2006 9:49 pm
Posts: 732
Location: Chicago, IL USA
Right coltain... CanInsertScript is only saying to return 1 or 0 saying yes or no it can be inserted... OnInsertScript says what happens on the insert... like destroying and such.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 03, 2008 9:27 am 
Offline
User avatar

Joined: Fri Feb 10, 2006 4:15 am
Posts: 202
Even if it is wrong way to do things, POL should not crash. Say, for an example, that I don't do my homework of reading the docs: I modify a CanInsertScript to look like the one on first post, put it on a live shard, and unload it into use. If shard happens to crash (as it will, as soon as someone activates the script), I (as an average user) would blame the POL for being unstable.

Though I did something that _everyone_ here knows should not be done.

If, instead of crash, POL would print some informal message, I would eventually see that there is something wrong with my script. Result? POL wise, scripter stupid.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 4 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl