DestroyItem on CanInsertScript -> Crash (POL 097)

Report core bugs regarding the Ultima Online Emulator Core release (version 097). You can attach your Core Dump. One bug per post.

Moderator: POL Developer

Locked
User avatar
ncrsn
Grandmaster Poster
Posts: 255
Joined: Fri Feb 10, 2006 12:15 am

DestroyItem on CanInsertScript -> Crash (POL 097)

Post by ncrsn » Sun Mar 02, 2008 7:02 pm

Consider this script:

Code: Select all

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?

User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm
Contact:

Post by OldnGrey » Sun Mar 02, 2008 7:45 pm

Do you get problems in OnInsert?

User avatar
ncrsn
Grandmaster Poster
Posts: 255
Joined: Fri Feb 10, 2006 12:15 am

Post by ncrsn » Sun Mar 02, 2008 7:57 pm

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.

coltain
Grandmaster Poster
Posts: 159
Joined: Tue Mar 20, 2007 7:17 am
Location: Poland

Post by coltain » Sun Mar 02, 2008 10:34 pm

caninsert - return 1;
oninsert - destroy;

User avatar
CWO
POL Expert
Posts: 1136
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA
Contact:

Post by CWO » Mon Mar 03, 2008 1:34 am

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.

User avatar
ncrsn
Grandmaster Poster
Posts: 255
Joined: Fri Feb 10, 2006 12:15 am

Post by ncrsn » Mon Mar 03, 2008 5:27 am

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.

Locked