I am trying to add $$ to a bankroll when a player wins his bet. Set up the following but it appears to periodically display random numbers NOT the +15 added to the bankroll as I set up.
My problem - staring with a $1000 bankroll - "touch" the bet button - which DOES subtract the appropriate amount bet - (the payout scheme works) - which compares the chosen bet to the random outcome and pays out $$$ - but its not always the correct pay out.
It needs to be a ongoing addition and subtraction to the bankroll depending if the player wins or loses. Sort of a score keeping idea I guess.
gyroscopeI am here.Member, Sous Chef, PROPosts: 6,598
Hi Bruce, you need a bankroll attribute to update. (Or have you got it working now anyway?)
The only thing I can think of is that the bank roll may get to large for an integer to handle. Try changing game.bankroll to a real. Hope that helps.
gyroscopeI am here.Member, Sous Chef, PROPosts: 6,598
Hi osucowboy18: integers can can go into the tens of millions so I don't think it'll be that.
Hi Bruce, if you're using what I suggested to you 3 or 4 days ago, i.e PlayerAmount + (UserBet *2), it could be that you haven't put the brackets around UserBet*2 possibly?
do you have the payout set to random, because then it will pick between the min and max no matter what the actual outcome is. If so you need to make a new attribute pay out and constrain that number to whatever the random outcome number is. That way the outcome is random but the payout will always add or subtract depending on outcome.
Okay - made some changes. Heres what I have now and it works but needs a tuneup.
In the bet button - touch.inside - change attribute - bet to bet +10 change attribute - bankroll to bankroll - 10 display text - game.bankroll
In the outcome actor attribute - game.firstCheckbox - is true attribute - game.pickAdice = 1 change attribute - game.bankroll to game.bankroll + bet
It subtracts the $5 bet from the bankroll and displays it okay and then will add $5 to the bankroll when the player wins.
I want to be able to payout odds (say 2:1 ) for each bet.
How can I get the "game.bankroll + bet" to add the initial $5 and the 2:1 odds payout - which would be $10? I could just say ""game.bankroll+10 But is there an easier or more efficient way when I will be having bets up to $100.
gyroscopeI am here.Member, Sous Chef, PROPosts: 6,598
Hi Bruce; a couple of things here: if a user can click on as many bet buttons as they like up to $100 dollars, then in the bet button, you should add: When attribute bet < 101
And then for a 2 to 1 payout as you want, in the outcome actor, the bankroll line should be: Change attribute game.bankroll to game.bankroll + (bet*2)
Okay I can see what should happen! game.bankroll ($1000) to game.bankroll($1000) + (bet ($10)*2)
should equal
$1000 + 10 * 2 =$1020
But what happens is this - $1000 + 10*2 +10 =$1030
The multiplication (bet*2) works but the formula always adds an extra $10 not matter what value bet in inserted. I can work this out backwards to get the payout correct. But what is going on?
Thanks. This stuff addictive.
gyroscopeI am here.Member, Sous Chef, PROPosts: 6,598
My guess is that when the roll button, or whatever you have, is pressed after the total bet is made, the bet itself is not being deleted from the bankroll. (In the Roll or Go button, put change attribute game.Bankroll to game.Bankroll - Bet )
So what should be happening is:
($1000 - 10) + (10*2) Bankroll, minus the $10 bet = 990, plus the win, which is twice the original bet of $10, making $20; 990 + 20 equals $1010. So the user, by winning, has doubled the bet.
Wow I figured something out myself - I am subtracting the user bet from the bankroll as seen below http://i51.tinypic.com/wm146a.png
But I think what is happening is that the $10 bet is coming out of the "display text" bankroll like you suggested - but - the $10 bet is not being taken out of the calculation - looks like I might have to subtract the bet somewhere else too.
As stated above the subtracting a bet from the original bankroll works HOWEVER when you subtract additional bets after a win things get crazy.
First bet
1000 (-) 100 bet = 900 pays out at 2:1 (200) plus the 900 = total of 1100 CORRECT.
Second bet
1100 (-) 100 bet should equal 1000 but it makes it 900 again. However it pays out at 2:1 (200) plus the starting 1100 = 1300.
Third bet
1300 (-) 100 should equal 1200 but it makes it 1000. This time it pays out 300 (3:1) plus the starting 1300 = 1600.
Fourth bet
1600 (-) 100 should equal 1500 but it makes it 1200. This time it pays out 400 (4:1) plus the starting 1600 = 2000.
It looks like it subtracts correctly the first time but then somehow "adds" bets together - subtracts 200, 300, 400 and pays out in the reverse adding 200, 300, 400.
It should subtract one bet from the running total bankroll each time and add the same payout to the new running bankroll.
Help
gyroscopeI am here.Member, Sous Chef, PROPosts: 6,598
It's all down to the math somewhere: my guess is you've duplicated one of the equations. It's difficult to help without seeing the actual gamefile, but hopefully you'll get it sorted from this advice, fingers crossed. If you still have trouble, I'll take a look at your file if you like. Sometime tomorrow (Wednesday) though; it's 3.25am here in the UK and this insomniac is off to sleep! Goodnight! :-)
Comments
Any suggestions?
http://i56.tinypic.com/2zf8xs1.png
It needs to be a ongoing addition and subtraction to the bankroll depending if the player wins or loses. Sort of a score keeping idea I guess.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Hi Bruce, if you're using what I suggested to you 3 or 4 days ago, i.e PlayerAmount + (UserBet *2), it could be that you haven't put the brackets around UserBet*2 possibly?
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
In the bet button -
touch.inside - change attribute - bet to bet +10
change attribute - bankroll to bankroll - 10
display text - game.bankroll
In the outcome actor
attribute - game.firstCheckbox - is true
attribute - game.pickAdice = 1
change attribute - game.bankroll to game.bankroll + bet
It subtracts the $5 bet from the bankroll and displays it okay and then will add $5 to the bankroll when the
player wins.
I want to be able to payout odds (say 2:1 ) for each bet.
How can I get the "game.bankroll + bet" to add the initial $5 and the 2:1 odds payout - which would be $10?
I could just say ""game.bankroll+10
But is there an easier or more efficient way when I will be having bets up to $100.
When attribute bet < 101
And then for a 2 to 1 payout as you want, in the outcome actor, the bankroll line should be:
Change attribute game.bankroll to game.bankroll + (bet*2)
Hope that sorts it for you. :-)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
game.bankroll ($1000) to game.bankroll($1000) + (bet ($10)*2)
should equal
$1000 + 10 * 2 =$1020
But what happens is this - $1000 + 10*2 +10 =$1030
The multiplication (bet*2) works but the formula always adds an extra $10 not matter what value bet in inserted. I can work this out backwards to get the payout correct. But what is going on?
Thanks. This stuff addictive.
So what should be happening is:
($1000 - 10) + (10*2)
Bankroll, minus the $10 bet = 990, plus the win, which is twice the original bet of $10, making $20; 990 + 20 equals $1010. So the user, by winning, has doubled the bet. It certainly can be! :-)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
http://i51.tinypic.com/wm146a.png
But I think what is happening is that the $10 bet is coming out of the "display text" bankroll like you suggested - but - the $10 bet is not being taken out of the calculation - looks like I might have to subtract the bet somewhere else too.
Thanks for your help
First bet
1000 (-) 100 bet = 900 pays out at 2:1 (200) plus the 900 = total of 1100 CORRECT.
Second bet
1100 (-) 100 bet should equal 1000 but it makes it 900 again. However it pays out at 2:1 (200) plus the starting 1100 = 1300.
Third bet
1300 (-) 100 should equal 1200 but it makes it 1000. This time it pays out 300 (3:1) plus the starting 1300 = 1600.
Fourth bet
1600 (-) 100 should equal 1500 but it makes it 1200. This time it pays out 400 (4:1) plus the starting 1600 = 2000.
It looks like it subtracts correctly the first time but then somehow "adds" bets together - subtracts 200, 300, 400 and pays out in the reverse adding 200, 300, 400.
It should subtract one bet from the running total bankroll each time and add the same payout to the new running bankroll.
Help
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps