Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- list buttons = ["rps_countdown ", "rps_paper ", "rps_rock ", "rps_scissors "];
- string dialogInfo = "\nSelect Animation.";
- key ToucherID;
- integer dialogChannel;
- integer listenHandle;
- string message;
- default
- {
- state_entry()
- {
- llSitTarget( <0.0, 0.0, 0.01>, ZERO_ROTATION ); //sets sit target to prim center
- // llSetSitText(llToUpper(animation));
- // llSetClickAction(CLICK_ACTION_SIT);//mouse over objeect gives chair icon
- dialogChannel = -1 - (integer)("0x" + llGetSubString( (string)llGetKey(), -7, -1) );
- }
- changed(integer change)
- {
- if (change & CHANGED_LINK)
- {
- key sitter = llAvatarOnSitTarget(); // gets sitters name
- if(sitter != NULL_KEY) llRequestPermissions(sitter , PERMISSION_TRIGGER_ANIMATION);
- else run_time_permissions(integer perm)
- {
- if ( perm & PERMISSION_TRIGGER_ANIMATION )
- {
- // llSetAlpha(0.0, ALL_SIDES); // hide prim
- if (message == "rps_countdown")
- {
- // process Red here
- llStartAnimation("rps_countdown");//stand
- llStopAnimation("sit");//cancels sit animation
- }
- if (message == "rps_paper")
- {
- // process Red here
- llStartAnimation("rps_paper");//stand
- llStopAnimation("sit");//cancels sit animation
- }
- if (message == "rps_rock")
- {
- // process Red here
- llStartAnimation("rps_rock");//stand
- llStopAnimation("sit");//cancels sit animation
- }
- else if (message == "rps_scissors")
- {
- // process Green here
- llStartAnimation("rps_scissors");//stand
- llStopAnimation("sit");//cancels sit animation
- }
- {
- if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) llStopAnimation(message);
- llSay(0,"stood up");
- // llSetAlpha(1.0, ALL_SIDES); // show prim
- }
- }
- }
- touch_start(integer num_detected)
- {
- ToucherID = llDetectedKey(0);
- llListenRemove(listenHandle);
- listenHandle = llListen(dialogChannel, "", ToucherID, "");
- llDialog(ToucherID, dialogInfo, buttons, dialogChannel);
- llSetTimerEvent(60.0); // Here we set a time limit for responses
- }
- listen(integer channel, string name, key id, string message)
- {
- if (message == "-")
- {
- llDialog(ToucherID, dialogInfo, buttons, dialogChannel);
- return;
- }
- }
- timer()
- {
- // stop timer
- llSetTimerEvent(0);
- llListenRemove(listenHandle);
- llWhisper(0, "Sorry. You snooze; you lose.");
- }
- //}
- run_time_permissions(integer perm)
- {
- if ( perm & PERMISSION_TRIGGER_ANIMATION )
- {
- // llSetAlpha(0.0, ALL_SIDES); // hide prim
- if (message == "rps_countdown")
- {
- // process Red here
- llStartAnimation("rps_countdown");//stand
- llStopAnimation("sit");//cancels sit animation
- }
- if (message == "rps_paper")
- {
- // process Red here
- llStartAnimation("rps_paper");//stand
- llStopAnimation("sit");//cancels sit animation
- }
- if (message == "rps_rock")
- {
- // process Red here
- llStartAnimation("rps_rock");//stand
- llStopAnimation("sit");//cancels sit animation
- }
- else if (message == "rps_scissors")
- {
- // process Green here
- llStartAnimation("rps_scissors");//stand
- llStopAnimation("sit");//cancels sit animation
- }
- llListenRemove(listenHandle);
- // stop timer since the menu was clicked
- llSetTimerEvent(0);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement