Script name: menu
//Starting the Gamble script in a menu
Menu[[Gamble 200 Coin][Gamble]]
Script name:Gamble
//This machine has 2 chances of getting something,
//But is infinitely expandable.
If
HasInventory [player] [goldpieces] [=>] [200]
IsRandom [5,100] //5% Percent chance of winning
Then
Inventory [player] [take] [goldpieces] [200]
Inventory [player] [add] [goldpieces] [5000]
Notify [You won 5000 Coin! Jackpot!] [local]
Script [menu]
Script [Gamble] [cancel]
//To ensure this was the only thing won, I put the cancel Script.
//Then, If the player didn't win, he would automatically be entered into another.
//This one is not as big as reward though.
Elseif
HasInventory [player] [goldpieces] [=>] [200]
IsRandom [10,100] //10% Percent chance of winning
Then
Inventory [player] [take] [goldpieces] [200]
Inventory [player] [add] [goldpieces] [1000]
Notify [You won 1000 Coin!] [local]
Script [menu]
Script [Gamble] [cancel]
//To ensure this was the only thing won, I put the cancel Script.
Else
Inventory [player] [take] [golspieces] [200]
Notify [You won nothing.] [local]
//Now, Im starting the menu script.
Script [menu]
Endif