oooh, I'm asking yet another usecode question.

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
Mighty Dog

oooh, I'm asking yet another usecode question.

Post by Mighty Dog »

okay, my problem this time is with the UI_click_on_item().
its suppose to give me an array with the values of item shape, x coordinates, y coordinates, and z coordinates. well I'm getting x,y,z coordinates but no item shape. for testing purposes i set up a talking cargo hold, and set it up to tell me the first 10 values of the array.

Ships_hold 0x195 ()
{
if (event != 1)
return;

var testing123;
testing123 = UI_click_on_item();

UI_show_npc_face(1);

say(testing123[0]," ",testing123[1]," ", testing123[2],"

",testing123[3]," ",testing123[4]," ",testing123[5]," ",testing123[6],"

",testing123[7]," ",testing123[8]," ",testing123[9]);
UI_add_answer("bye");

converse
{
if (response == "bye")
{
say("Fare thee well!");
break;
}
}
}

Value 2 is the x cord, 3 is the y cord, and 4 the z cord. all others display 0 as their value.

So, does the item part of this command not work properly, am i missing something, or am i FUBAR and should be quiet with these weekly usecode questions.
wjp
Site Admin
Posts: 1708
Joined: Thu May 14, 2020 1:34 pm

Re: oooh, I'm asking yet another usecode question.

Post by wjp »

You just can't output objects with say. There's no sensible thing to output...
drcode
Site Admin
Posts: 2267
Joined: Thu May 14, 2020 1:34 pm

Re: oooh, I'm asking yet another usecode question.

Post by drcode »

A couple suggestions:

1. The first element of the array returned by UI_click_on_item is the object clicked on (if there is one). You can't print that out directly, but you can use UI_get_item_shape to get it's shape #.

2. There is a UI_printf for debugging. It works like C's printf, except, for now, only the '%s' specification is supported. You could do something like UI_printf("Obj. is %s", testing123[1]);
Mighty Dog

Re: oooh, I'm asking yet another usecode question.

Post by Mighty Dog »

ahhh, excellent. thanks for the help once again
Locked