Hi,
I am trying to write a routine where coins can be won and added to the total
I have set gold as a variable in startup and have begun writing the gosub
This is as far as I have got :
Test of gambling
*temp goldwin
Place your bet
*input_number gold 1 5
----
As this is the winning option I want to double the number of coins bet but I can’t work out how to do this? How do I refer to the inputted number between 1 and 5 in the code? please
You need to *temp variables that you intend to use as number in a particular way – you have to tell choicescript that “goldwin” is a numerical variable. (like *temp goldwin 0)
*temp gold 0
*temp bet 0
Place your bet
*input_number bet 1 5
Stuff that determines if you win or lose
*if win
*set bet (bet * 2)
*set gold (gold + bet)
"You bet ${bet} and you now have ${gold} gold!
I’m not sure whether my snippet is bug-free, as it’s simply something that pops out of mind. So, do keep in mind about that. However, it should cover most of the basics to make a functional betting system.