Page 1 of 1

Is this the correct way? (usecode)

Posted: Sun Mar 30, 2003 9:15 am
by Cekkent
Is this the correct way, or is there a more efficient way that escapes me?

bottlevendor 0xC00() {

var money = UI_count_objects(-357, 0x284, -359, -359);

if (money >= 2) {
var bottle = UI_create_new_object(0x268);
UI_set_item_frame(bottle, 0x9);
UI_update_last_created(UI_get_object_position(item));
UI_remove_party_items(0x2, 0x284, -359, -359, 0);
} else {
UI_item_say(item, "You do not have enough gold.");
}

}

Also, what is the accepted way to test when something is on the egg for the Something On egg trigger?

Thank you.

Re: Is this the correct way? (usecode)

Posted: Sun Mar 30, 2003 9:52 pm
by drcode
That looks fine to me.

Not sure about your second question. Eggs are handled internally by Exult. So if you set an egg to be triggered by 'something on', then that code's Usecode function will be called automatically when the user drops anything on the egg. In your usecode function, the will be the egg itself. So you have to do a 'UI_find_nearby' using the egg's location to see what was placed on it.