Is this the correct way? (usecode)

NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Forum rules
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Locked
Cekkent
Posts: 2
Joined: Thu May 14, 2020 1:34 pm

Is this the correct way? (usecode)

Post 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.
drcode
Site Admin
Posts: 2267
Joined: Thu May 14, 2020 1:34 pm

Re: Is this the correct way? (usecode)

Post 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.
Locked