Erich Templar
Registered User
Join date: 21 Aug 2004
Posts: 23
|
12-16-2004 02:53
Imagine I have built a machine. It is operated by (let's say) pulling a lever. It also has some buttons, which change what happens when the lever is pulled. If button A has been pressed, the lever does one thing, if button B is pressed it does something different (don't tell me to have multiple levers -- that won't work for the machine I actually have in mind).
Now, button A, button B, and the lever are all child objects. Somehow I need to communicate between them -- the lever needs to know which (if any) of the buttons is currently pressed.
Does anyone know of a way of doing this?
|
Kris Ritter
paradoxical embolism
Join date: 31 Oct 2003
Posts: 6,627
|
12-16-2004 02:57
There is a function specifically for that...
llMessageLinked(integer linknum, integer num, string str, key id)
and then your trigger event is ...
link_message(integer sender_num, integer num, string str, key id)
|
Erich Templar
Registered User
Join date: 21 Aug 2004
Posts: 23
|
12-16-2004 03:05
Excellent, Kris -- thanks very much. I'd missed that function (well, I think I just hadn't read it closely enough to realise what it was actually doing!)
|
Samhain Broom
Registered User
Join date: 1 Aug 2004
Posts: 298
|
12-16-2004 07:20
so in your main primt, I am imagining something that has a box with any number of buttons on it, say like a cash register like with number buttons. The level will do something like add the A number or the B number to the total. (you supply your functions).
In the main script, you have three trigger events. Two that are acted on by the buttons, which will talk to a global variable that says which button was pressed... then another that says act on the info in the "AorB" variable, and the results are then acted upon. In this case, maybe a total will be shown on the cash register screen.
=)
_____________________
rm -rf /bin/ladden #beware of geeks bearing grifts
|