View/Edit #6397:roll

Switch to edit mode.

Name(s): roll
1:  if (length(args) != 4)
2:    player:tell("Usage: roll [# of times] [bet amount] [multiplier] [needed result less than X/10000]")
3:    return player:tell("e.g.  roll 500 2.5 2474.5 2")
4:  endif
5:  rolls = toint(args[1])
6:  bet = tofloat(args[2])
7:  multiplier = tofloat(args[3])
8:  needed = toint(args[4])
9:  change = 0.0
10: for x in [1..rolls]
11:   change = change - bet
12:   roll = random(10000) - 1
13:   if (roll < needed)
14:     change = change + bet * multiplier
15:     player:tell("Roll #", x, " WINS ", bet * multiplier, " (roll: ", tofloat(roll) / 100.0, ") -- TOTAL: ", change)
16:   else
17:     if (x == rolls)
18:       player:tell("Roll #", x, " lose ", bet, " (roll: ", tofloat(roll) / 100.0, ") -- total: ", change)
19:     endif
20:   endif
21:   $command_utils:suspend_if_needed(1)
22: endfor
23: "Last modified by James (#6397) on Mon Oct 22 04:04:43 2018 UTC."

Verb arguments: any any any
Verb perms: Readable NOT-Debug
Verb owned by: James (#6397)

You are not logged in.

[home | help | who | search | setup | code]