Question Slot Machine payout code?

karsz

Member
Joined
Aug 21, 2009
Messages
7
Programming Experience
Beginner
I have made the slot machine. It all works good except, I have encounted one problem though.

When you get two of the same images or all three, you don't win anything.
i have tried some code. This code has no erros what so ever, but it doesnt seem to work.

i have made a new private sub called get payout.( it doesnt make anything appear on the page).

Code for the payout i have used is below(doesnt come up with erros though)


Private Function GetPayout(ByVal S1 As Integer, ByVal S2 As Integer, ByVal S3 As Integer, ByVal Bet As Double) As Double

Dim Payout As Double

If S1 = 1 And S2 = 1 And S3 = 1 Then
Payout += 4 + (Bet * 0.06)

ElseIf S1 = 1 And S2 = 1 Then
Payout += (Bet * 0.03) + 0.2
ElseIf S2 = 1 And S3 = 1 Then
Payout += (Bet * 0.03) + 0.2
ElseIf S3 = 1 And S1 = 1 Then
Payout += (Bet * 0.03) + 0.2
End If
If S1 = 2 And S2 = 2 And S3 = 2 Then
Payout += 8 + (Bet * 0.12)
ElseIf S1 = 2 And S2 = 2 Then
Payout += (Bet * 0.06) + 0.4
ElseIf S2 = 2 And S3 = 2 Then
Payout += (Bet * 0.06) + 0.4
ElseIf S3 = 2 And S1 = 2 Then
Payout += (Bet * 0.06) + 0.4
End If
If S1 = 3 And S2 = 3 And S3 = 3 Then
Payout += 25 + (Bet * 0.24)
ElseIf S1 = 3 Or S2 = 3 Or S3 = 3 Then
If S1 = 3 Then Payout += (Bet * 0.03) + 0.8
If S2 = 3 Then Payout += (Bet * 0.03) + 0.8
If S3 = 3 Then Payout += (Bet * 0.03) + 0.8
End If
If S1 = 5 And S2 = 5 And S3 = 5 Then Payout += 1000 + (Bet * 5)
Return Math.Round(Payout, 2)
End Function


Regards
Jarryd Karsz

if anyone is able to help me please post back on the forum

Thanks :)
 
Last edited by a moderator:
Zip File code doesnt work for me

The zip file you sent me didn't really help me.

My slot boxes are picture boxs not labels.

Would you like me to e-mail you the zip file of my slot machine any maybe you could help me with the payout for it?


Regards
Jarryd
 
Slot machine Project

i have Private messaged you the zip file of my project.

Reason why is all explained in the private message. :)
 
i got the payout code to work :)

Thanks kulrom for all your help
i got the payout code to wok with help from another guy.
 
Back
Top