I have this script that sets up a menu to control a linked prim.
integer CHANNEL=140;
list MAIN_MENU = ["On","Off"];
default
{
state_entry()
{
llListen(CHANNEL,"", NULL_KEY,""
; llMessageLinked(LINK_SET,0,"Off", NULL_KEY);
}
touch_start (integer total_number)
{
llDialog(llDetectedKey(0),"Main Menu", MAIN_MENU, CHANNEL);
}
listen(integer channel, string name, key id,string message)
{
if (message == "On"

{
llMessageLinked(LINK_SET,0,"On", NULL_KEY);
}
else if(message == "Off"

{
llMessageLinked(LINK_SET,0,"Off", NULL_KEY);
}
}
}
-------------------------------------------------
In my linked prim is this script:
-------------------------------------------------
// This is the function I want to repeat
move_my_prim()
{
llSetPos(<0.0, 0.0, 0.02>
;llSetPos(<0.0, 0.0, 0.06>
;llSetPos(<0.0, 0.0, 0.1>
;llSetPos(<0.0, 0.0, 0.06>
;llSetPos(<0.0, 0.0, 0.02>
;}
default
{
link_message(integer sender, integer num, string message, key id)
{
if (message == "Off"

{
llSetPos(<0.0, 0.0, 0.06>
;}
if (message == "On"

// loop the function untill "Off" is pressed on the menu
//tried WHILE and DO-WHILE loops here
{
move_my_prim();
}
}
}
------------------------------------------------
I want my function move_my_prim to loop until the menu button "Off" is pressed
The message "Off" is sent to the linked prim but I am unable to get my function to break out of a while loop or a do-while loop.
Any guidence would be appreciated
Galdor