Home |
Add a script
|
||
|---|---|---|---|
| Category: | Contributor: | Description | |
| Games | Nitsuj Kidd | A speed-click game by Nitsuj Kidd | |
A simple clicking game
The Script
Download this script - Please use this link to get this script. If you see all the code on one long line, please use Wordpad or another editor, such as LSLEdit.exe. The .LSL file you will download is an ordinary text file.
1 //A simple clicking game. 2 //By TSL Resident: Nitsuj Kidd 3 txt(string what) 4 { 5 llSetText(what,<1,1,1>,1); 6 } 8 { 9 return one - two; 10 } 11 key bist; 12 string playur; 13 key winner; 14 integer clicks; 15 key player; 16 integer time; 17 //////////////////////////////////////////////////////CLICKS/////////////////////////////////////////////////////////////////////////////// 18 integer high = 50; 19 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 20 string best = "Mr. Nobody"; 21 default 22 { 23 state_entry() 24 { 25 txt("Requesting permissions..."); 28 } 30 { 31 if(c && CHANGED_OWNER) 32 { 33 llResetScript(); 34 } 35 } 37 { 38 llResetScript(); 39 } 41 { 42 if(p && PERMISSION_DEBIT) 43 { 44 state active; 45 } 46 else 47 { 49 } 50 } 51 } 52 state active 53 { 54 state_entry() 55 { 56 llSetTouchText("Click!"); 57 txt("The clicking game\n Pay me 1L$ to play\nBest: "+best+" - Clicks: "+(string)high); 58 } 60 { 61 62 if(ammount == 1) 63 { 64 time = 0; 65 txt("The clicking game\n Current player: " + llKey2Name(giver)); 66 player = giver; 67 llSetTimerEvent(10); 68 clicks = 0; 69 } 70 if(ammount > 1) 71 { 72 integer change = minus(ammount,1); 73 llGiveMoney(giver,change); 74 } 75 } 76 touch_start(integer total_number) 77 { 78 if(llDetectedKey(0) == player) 79 { 80 playur = llKey2Name(player); 81 clicks++; 82 txt("The clicking game\n\n Current player: " + llKey2Name(player) + "\n Clicks: " + (string)clicks); 83 } 84 } 85 timer() 86 { 87 { 88 state check; 89 } 90 } 91 } 92 state check 93 { 94 state_entry() 95 { 96 txt("Game over!\n " + playur + " had " + (string)clicks + " clicks!"); 97 player = NULL_KEY; 98 llSleep(2); 99 llSetTimerEvent(0);100 if(clicks>high)101 {102 txt("You got the best score!");103 llSleep(2);104 high = clicks;105 best = playur;106 bist = player;107 player = "";108 state active;109 }110 else111 {112 txt("You didn't get the high score!");113 llSleep(2);114 state active;115 }116 player = "";117 clicks = 0;118 }119 }