Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- integer line;
- string notecard;
- list steps;
- list done;
- integer index;
- integer starting;
- integer listener;
- debug(string str) { llOwnerSay(str);}
- default
- {
- state_entry()
- {
- notecard=llGetInventoryName(INVENTORY_NOTECARD,0);
- line=0; done=[];
- llGetNotecardLine(notecard,line);
- }
- dataserver(key id,string data)
- {
- if(data!=EOF){
- steps+=[data];
- line++;
- llGetNotecardLine(notecard,line);
- return;
- }
- state ready;
- }
- }
- state ready
- {
- state_entry()
- {
- starting=llGetUnixTime();
- llSetColor(<1,1,1>,ALL_SIDES);
- llSay(0,"Ready "+(string)(line)+" steps ");
- index=0; done=[]; llSetText("Inizia esperimento",<1,1,1>,1);
- llListen(100,"",NULL_KEY,"");
- }
- touch_start(integer count)
- {
- key id=llDetectedKey(0);
- if(index==0) {
- starting=llGetUnixTime();
- // llSay(0,"starting is "+(string)starting);
- }
- listener=llListen(-1,"",id,"");
- llSetTimerEvent(10);
- llDialog(id,"Scegli",["SCALDA","FILTRA","GHIACCIA","VERSA","MESCOLA","RESET" ],-1);
- }
- timer()
- {
- llSetTimerEvent(0);
- listener=-1;
- llSay(0,"timeout");
- }
- listen(integer channel,string name,key id,string str)
- {
- llSetTimerEvent(0);
- llListenRemove(listener);
- if(str=="RESET"){
- llResetScript();
- return;
- }
- debug("ricevuto "+str+" sul canale "+(string)channel);
- string right=llStringTrim(llList2String(steps,index),STRING_TRIM_TAIL);
- // debug("confronto "+str+" con "+right);
- if(right==str)
- {
- index++;
- if(index>=llGetListLength(steps))
- {
- llSay(0,"Complimenti, hai prodotto "+notecard+" in "+(string)(llGetUnixTime()-starting)+" secondi");
- llResetScript();
- return;
- }
- llSay(0,"il passo č giusto, vai avanti");
- llSetColor(<0,1,0>,ALL_SIDES);
- done+=[ (string)index+")"+str ];
- llSetText(llDumpList2String(done,"\n"),<1,1,1>,1);
- return;
- }
- llSetColor(<1,0,0>,ALL_SIDES);
- llSay(0,"Mi dispiace, hai sbagliato devi ricominciare da capo");
- llResetScript();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement