Here's the script for the chips. The timer represents the number of seconds it waits before giving a response.
list numberchoices = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"];
string msg = "Please select a number.";
key ToucherID;
integer channel_dialog;
integer listen_id;
integer num1;
integer num2;
integer numop;
default{
state_entry() {
channel_dialog = ( -1 * (integer)("0x"+llGetSubString((string)llGetKey(),-5,-1)) );
}
touch_start(integer total_number) {
ToucherID = llDetectedKey(0);
llDialog(ToucherID, msg,numberchoices, channel_dialog);
listen_id = llListen( channel_dialog, "", ToucherID, "");
}
listen(integer channel, string name, key id, string choice) {
if (choice == "-") {
llDialog(ToucherID, msg,numberchoices, channel_dialog);
}
else if (choice == "1") {
num1 = 1;
}
else if (choice == "2") {
num1 = 2;
}
else if (choice == "3") {
num1 = 3;
}
else if (choice == "4") {
num1 = 4;
}
else if (choice == "5") {
num1 = 5;
}
else if (choice == "6") {
num1 = 6;
}
else if (choice == "7") {
num1 = 7;
}
else if (choice == "8") {
num1 = 8;
}
else if (choice == "9") {
num1 = 9;
}
else if (choice == "0") {
num1 = 0;
}
else {
//do something else.
llListenRemove(listen_id);
}
llSetTimerEvent(0.1);
}
timer()
{ //TIME’S UP!
llWhisper(0, "You have selected " + (string) num1 + ". This is a very fast chip! It might have come out last year.");
llSetTimerEvent(0.0); //Stop the timer from being called repeatedly
//do something
llListenRemove(listen_id);
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment