Betting Orbs
De DigiWiki.
This is one of my more feature laden gaming scripts. I put it to change the object name, due to the fact I made a lot of different dominations of orbs, and was getting them confused. Made it very eayy to tell which one was which.
// Betting Orbs by Shippou Oud integer p1 = 10; integer p2; string lpl; integer tpi; integer tpo; integer tpp; default { on_rez(integer x) { llResetScript(); } state_entry() { p2 = p1 * 10; tpi = 0; tpo = 0; tpp = 0; lpl = ""; llSetObjectName("Betting Orb $L" + (string) p1); llSetText("Bet $L" + (string) p1+ " - Win $L" + (string) p2 + "\n Last Player: " + lpl,<1,1,1>,1); llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); llSetPayPrice(PAY_HIDE, [p1, PAY_HIDE, PAY_HIDE, PAY_HIDE]); } touch_start(integer x) { if (llDetectedKey(0) != llGetOwner()) { llInstantMessage(llDetectedKey(0),"Please pay $L" + (string) p1 + " to play. \n You can win $L" + (string) p2); } if (llDetectedKey(0) == llGetOwner()) { llInstantMessage(llGetOwner()," \n Total pay in - $L" + (string) tpi + "\n Total pay out - $L" + (string) tpo + " \n Total times played - " + (string) tpp); } } money(key pla, integer mon) { tpp = tpp + 1; tpi = tpi + mon; lpl = llKey2Name(pla); llInstantMessage(pla,"Good luck, " + lpl + "."); integer num1 = (integer) llFrand(14) + 1; integer num2 = (integer) llFrand(14) + 1; if (num1 == num2) { llInstantMessage(pla,"You won $L" + (string) p2 + " !"); llGiveMoney(pla,p2); tpo = tpo + p2; } llInstantMessage(pla,"Thank you for playing."); llSetText("Bet $L" + (string) p1+ " - Win $L" + (string) p2 + "\n Last Player: " + lpl,<1,1,1>,1); } run_time_permissions(integer perm) { if (PERMISSION_DEBIT & perm) {;} else { llInstantMessage(llGetOwner(),"Sorry, you must click 'yes' to operate this. "); llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); } } }