I decided that the higher/lower machines in Sore Losers are too easy to win on so I weighted them, basically meaning that some games cannot be won no matter what the player does. Just like a real machine, to be honest. Anyway...The machine is split into two parts, the machine itself and the common event it calls. The machines simply inform the player what the game is about and allows them to decide whether or not they are going to bet. The code for it is simple, and also allows you to dictate that the player is facing up (i.e. facing the machine, which you can obviously change if your gambling machine sprite needs the player facing in a different direction). The code goes a little something like this:
The second part of the machine, the common event, is what actually controls the game. In this example, the game has a 10% chance of simply disallowing the player a chance to win. It does this by forcing the second number to be 12 when the player selects lowers and to be 1 when the player selects higher. You can change this chance by altering the random number check; lowing the amount of numbers it can choose from will lower the chance the player can actually win and vice-versa.
The code for it goes something like this.
And that's it.