$L Picker
De DigiWiki.
(Différences entre les versions)
(Page créée avec « This game is unique. I came up with the idea a while ago, and developed this as one of my first sucessfull games. It works liek this. pay from 1 to 10. that becomes your numb… ») |
|||
Ligne 14 : | Ligne 14 : | ||
state_entry() | state_entry() | ||
{ | { | ||
- | + | llSetTimerEvent(1.0); | |
- | + | llSetText("$L Picker \n Click for info \n Pay $L1 to $L10 to play" + "\n" + "Total Payout $L" + (string) ttp,<1.0, 1.0, 1.0>, 1.0); | |
- | + | llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); | |
} | } | ||
+ | |||
touch_start(integer x) | touch_start(integer x) | ||
{ | { | ||
Ligne 24 : | Ligne 25 : | ||
llInstantMessage(llGetOwner(),"$L" + (string) payin + " has been bet."); | llInstantMessage(llGetOwner(),"$L" + (string) payin + " has been bet."); | ||
} | } | ||
+ | |||
if (llDetectedKey(0) != llGetOwner()) | if (llDetectedKey(0) != llGetOwner()) | ||
{ | { | ||
- | + | llInstantMessage(llDetectedKey(0),"This game is simple. Bet from $L1 to $L10 if the computer picks your bet you win 4x the amount. | |
- | + | \nif the computer is off by 1, you win 2x bet. \n Lets say you bet $L5 and the computer randomly picks 5, you'll win $L20. | |
- | + | \nNow lets say you bet $L8 and the computer picks 7, you win $L16. | |
- | + | \n10 is considered to be the number below below 1, and 1 the number above 10, so if you bet $L10 and the computer picks 1, you'll win $L20."); | |
- | + | ||
} | } | ||
- | + | } | |
+ | |||
money(key giver, integer amount) | money(key giver, integer amount) | ||
{ | { | ||
- | |||
payin = payin + amount; | payin = payin + amount; | ||
+ | |||
if (amount > 10) | if (amount > 10) | ||
{ | { | ||
- | + | llInstantMessage(giver,"Sorry, but I can only bet up to $L10 at a time, here is $L" + (string) amount + " back. "); | |
- | + | ||
llGiveMoney(giver,amount); | llGiveMoney(giver,amount); | ||
payin = payin - amount; | payin = payin - amount; | ||
return; | return; | ||
- | + | } | |
- | + | ||
- | + | float Winnum = llFrand(10); | |
- | + | integer W2 = (integer) Winnum + 1; | |
- | + | integer w2x = amount * 2; | |
- | + | integer w4x = amount * 4; | |
- | + | ||
- | + | llInstantMessage(giver,"You bet " + (string) amount + " !"); | |
- | + | llInstantMessage(giver,"The computer picks " + (string) W2 + " !" + "\n "); | |
- | + | ||
- | + | if (amount == W2) | |
- | + | { | |
- | + | llGiveMoney(giver,amount * 4); | |
- | + | llSay(0,"Won $L" + (string) w4x + " !"); | |
- | + | ttp = ttp + w4x; | |
- | + | } | |
- | + | ||
- | + | if (amount == W2 + 1) | |
- | + | { | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
llGiveMoney(giver,amount * 2); | llGiveMoney(giver,amount * 2); | ||
- | + | llSay(0,"Won $L" + (string) w2x + " !"); | |
- | + | ttp = ttp + w2x; | |
- | + | } | |
- | + | ||
- | + | if (amount == W2 - 1) | |
- | + | { | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
llGiveMoney(giver,amount * 2); | llGiveMoney(giver,amount * 2); | ||
- | + | llSay(0,"Won $L"+ (string) w2x + " !"); | |
- | + | ttp = ttp + w2x; | |
- | + | } | |
- | } | + | |
- | + | if (W2 - 9 == amount) | |
+ | { | ||
+ | llGiveMoney(giver,amount * 2); | ||
+ | llSay(0,"Won $L" + (string) w2x + " !"); | ||
+ | ttp = ttp + w2x; | ||
+ | } | ||
+ | |||
+ | if (W2 + 9 == amount) | ||
+ | { | ||
+ | llGiveMoney(giver,amount * 2); | ||
+ | llSay(0,"Won $L" + (string) w2x + " !"); | ||
+ | ttp = ttp + w2x; | ||
+ | } | ||
+ | } | ||
- | + | timer() | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
{ | { | ||
- | + | llSetText("$L Picker \n Click for info \n Pay $L1 to $L10 to play" + "\n" + "Total Payout $L" + (string) ttp, <1.0, 1.0, 1.0>, 1.0); | |
} | } | ||
- | |||
- | |||
- | |||
- | |||
- | |||
+ | run_time_permissions(integer perm) | ||
+ | { | ||
+ | if (PERMISSION_DEBIT & perm) {;} | ||
+ | |||
+ | else | ||
+ | { | ||
+ | llInstantMessage(llGetOwner(),"Sorry, you must click 'yes' to operate this."); | ||
+ | llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); | ||
+ | } | ||
} | } | ||
- | |||
- | |||
- | |||
- | |||
} | } | ||
</lsl> | </lsl> |
Version actuelle en date du 3 juillet 2014 à 11:05
This game is unique. I came up with the idea a while ago, and developed this as one of my first sucessfull games. It works liek this. pay from 1 to 10. that becomes your number the script randomly generates a number from 1 to 10..if it matched win 4x bet. if it is 1 off, win 2x bet.
// $L Picker by Shippou Oud integer ttp; integer payin; default { on_rez(integer x) { llResetScript(); } state_entry() { llSetTimerEvent(1.0); llSetText("$L Picker \n Click for info \n Pay $L1 to $L10 to play" + "\n" + "Total Payout $L" + (string) ttp,<1.0, 1.0, 1.0>, 1.0); llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); } touch_start(integer x) { if (llDetectedKey(0) == llGetOwner()) { llInstantMessage(llGetOwner(),"$L" + (string) payin + " has been bet."); } if (llDetectedKey(0) != llGetOwner()) { llInstantMessage(llDetectedKey(0),"This game is simple. Bet from $L1 to $L10 if the computer picks your bet you win 4x the amount. \nif the computer is off by 1, you win 2x bet. \n Lets say you bet $L5 and the computer randomly picks 5, you'll win $L20. \nNow lets say you bet $L8 and the computer picks 7, you win $L16. \n10 is considered to be the number below below 1, and 1 the number above 10, so if you bet $L10 and the computer picks 1, you'll win $L20."); } } money(key giver, integer amount) { payin = payin + amount; if (amount > 10) { llInstantMessage(giver,"Sorry, but I can only bet up to $L10 at a time, here is $L" + (string) amount + " back. "); llGiveMoney(giver,amount); payin = payin - amount; return; } float Winnum = llFrand(10); integer W2 = (integer) Winnum + 1; integer w2x = amount * 2; integer w4x = amount * 4; llInstantMessage(giver,"You bet " + (string) amount + " !"); llInstantMessage(giver,"The computer picks " + (string) W2 + " !" + "\n "); if (amount == W2) { llGiveMoney(giver,amount * 4); llSay(0,"Won $L" + (string) w4x + " !"); ttp = ttp + w4x; } if (amount == W2 + 1) { llGiveMoney(giver,amount * 2); llSay(0,"Won $L" + (string) w2x + " !"); ttp = ttp + w2x; } if (amount == W2 - 1) { llGiveMoney(giver,amount * 2); llSay(0,"Won $L"+ (string) w2x + " !"); ttp = ttp + w2x; } if (W2 - 9 == amount) { llGiveMoney(giver,amount * 2); llSay(0,"Won $L" + (string) w2x + " !"); ttp = ttp + w2x; } if (W2 + 9 == amount) { llGiveMoney(giver,amount * 2); llSay(0,"Won $L" + (string) w2x + " !"); ttp = ttp + w2x; } } timer() { llSetText("$L Picker \n Click for info \n Pay $L1 to $L10 to play" + "\n" + "Total Payout $L" + (string) ttp, <1.0, 1.0, 1.0>, 1.0); } run_time_permissions(integer perm) { if (PERMISSION_DEBIT & perm) {;} else { llInstantMessage(llGetOwner(),"Sorry, you must click 'yes' to operate this."); llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); } } }