something on usecode eggs

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
Donfrow
Posts: 308
Joined: Thu May 14, 2020 1:34 pm

something on usecode eggs

Post by Donfrow »

First off, sorry for yet another dumb question.

I understand how something on works for the usecode eggs, and have it working so when I put any object on the avatar will say "Test".

How do you determine what shape# is put on a usecode egg? Like the banes gems put on the proper shrines. I figure it has something to do with get_item_quality, get_item_frame and get_item_shape but I cannot figure out how to tell it what item to get this information from.

I checked the intrinsic list but did not see something that gets the item shape from a general area, so hopefully I didn't just miss it.

Thanks
marzo
Site Admin
Posts: 1925
Joined: Thu May 14, 2020 1:34 pm

Re: something on usecode eggs

Post by marzo »

You can see a working example here. The first function is used to detect the lenses when you are going to see the Codex; the eggs are set to activate when something is 'on' them.
------
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
Donfrow
Posts: 308
Joined: Thu May 14, 2020 1:34 pm

Re: something on usecode eggs

Post by Donfrow »

Blah of course I missed the intrinsic in the list. Sigh.

I seem to have it working for any object when something is on, but I can't seem to make it work with the specified shape. I tried to make it similar to yours just with different variables. It's set to 'something on' in the egg.

egg_something_on_test()
{
var loc = UI_get_object_position();
var object;

object = loc->find_nearby(BUCKLER, 1, MASK_NONE);


if (object)
{
AVATAR.say("Correct item");
}
else
{
AVATAR.say("Not correct item");
}
}

I know it's sort of working since it will hit the "Not correct item" but it is never finding the buckler as the correct item. Even when I put the buckler on it still is coming to the "Not correct item". The buckler shape constant is also correct. The only difference I can see is that yours starts off with it being if event == egg or scripted but that should not make a difference if I understand correctly.

I'm really sorry about missing the intrinsic too.
Donfrow
Posts: 308
Joined: Thu May 14, 2020 1:34 pm

Re: something on usecode eggs

Post by Donfrow »

I will mention I also tried to use find_nearest and find_object to no avail as well.
Locked