integer CHANNEL = 42; // dialog channel
list MENU_MAIN = ["Walk", "Back Up", "Turn Left"]; // the main menu
integer counter = 0;
float delay = 0.4;
float forward = 1.0;
float backward = -1.0;
default {
state_entry() {
llListen(CHANNEL, "", NULL_KEY, ""
; // listen for dialog answers (from multiple users)}
touch_start(integer total_number)
{
llDialog(llDetectedKey(0), "", MENU_MAIN, CHANNEL); // present dialog on click
}
listen(integer channel, string name, key id, string message)
{
if (llListFindList(MENU_MAIN, [message]) != -1) // verify dialog choice
{
llWhisper(0, name + " picked the option '" + message + "'."
; // output the answer// here you have the name and key of the user and can easily verify if they have the permission to use that option or not
}
if (message == "Walk"

{
do {
integer frame = 1;
llMessageLinked(LINK_ALL_CHILDREN, 0, (string)frame, NULL_KEY);
llSleep(delay);
llSetPos(llGetPos() + <0, forward, 0>
;frame = 2;
llMessageLinked(LINK_ALL_CHILDREN, 0, (string)frame, NULL_KEY);
llSleep(delay);
llSetPos(llGetPos() + <0, forward, 0>
;frame = 3;
llMessageLinked(LINK_ALL_CHILDREN, 0, (string)frame, NULL_KEY);
llSleep(delay);
llSetPos(llGetPos() + <0, forward, 0>
;frame = 4;
llMessageLinked(LINK_ALL_CHILDREN, 0, (string)frame, NULL_KEY);
llSleep(delay);
llSetPos(llGetPos() + <0, forward, 0>
;counter = counter + 1;
}
while (counter < 4); // Repeat cycle set number of times.
llResetScript();
}
else if (message == "Back Up"

{
do {
integer frame = 4;
llMessageLinked(LINK_ALL_CHILDREN, 0, (string)frame, NULL_KEY);
llSleep(delay);
llSetPos(llGetPos() + <0, backward, 0>
;frame = 3;
llMessageLinked(LINK_ALL_CHILDREN, 0, (string)frame, NULL_KEY);
llSleep(delay);
llSetPos(llGetPos() + <0, backward, 0>
;frame = 2;
llMessageLinked(LINK_ALL_CHILDREN, 0, (string)frame, NULL_KEY);
llSleep(delay);
llSetPos(llGetPos() + <0, backward, 0>
;frame = 1;
llMessageLinked(LINK_ALL_CHILDREN, 0, (string)frame, NULL_KEY);
llSleep(delay);
llSetPos(llGetPos() + <0, backward, 0>
;counter = counter + 1;
}
while (counter < 4); // Repeat cycle set number of times.
llResetScript();
}
else if (message == "Turn Left"

{
// a rotation of 45 degrees around the z-axis
rotation z_45 = llEuler2Rot( <0,0,45 * DEG_TO_RAD> );
rotation new_rot = z_45 * llGetRot(); // compute local rotation
llSetRot(new_rot); // orient the object accordingly
llResetScript();
}
}
on_rez(integer param)
{
llResetScript();
}
}
