hi.. I am creating a VB6 version of the popular CRAPS game..i think most programmers have come across it..if u dont kno it ..here r the rules..
it involves the player rolling two dies..if the sum of the two dies is 7 or 11 on first throw..the player wins...if the sum is 2,3 or 12..he loses..if it is 4,5,6,8,9 or 10,it becomes the players point and he must continue rolling the die till he makes point again..if he rolls 7 before making a point..he loses.
i used a random no generator to simulate the die rolling and created 6 .gif images to display the die images after they are rolled.
the code i used is
now the problem is..whenever i run the program.. it gives an error
and highlights the portion of the code
i cant find the problem..possibly its some sort of syntax error..
can you help me?
--------------------------------------------------------------------------------------
i have another question. i am an engg student and i wish to develop a program of CRAFT using VB6..is that possible.by CRAFT i mean Computerised Relative Allocation of Facilities Technique.its a part of a subject called plant layout that i have ti study.r there any engg or management students who can help me with this problem????
it involves the player rolling two dies..if the sum of the two dies is 7 or 11 on first throw..the player wins...if the sum is 2,3 or 12..he loses..if it is 4,5,6,8,9 or 10,it becomes the players point and he must continue rolling the die till he makes point again..if he rolls 7 before making a point..he loses.
i used a random no generator to simulate the die rolling and created 6 .gif images to display the die images after they are rolled.
the code i used is
Code:
Dim mdie1 As Integer, mdie2 As Integer, mypoints As Integer
Dim sum As Integer
Option Explicit
Private Sub cmdexit_Click()
End
End Sub
Private Sub cmdplay_Click()
Dim imgpoint1 As Image, imgpoint2 As Image
mypoints = 0
sum = rolldice()
Select Case sum
Case Is = 7, 11
lbldisplay1.Caption = " You Win!!!! "
cmdroll.Enabled = False
cmdplay.Enabled = True
Case Is = 2, 3, 12
lbldisplay1.Caption = " Sorry, You Lose "
cmdroll.Enabled = False
cmdplay.Enabled = True
Case Is = 4, 5, 6, 8, 9, 10
lbldisplay1.Caption = " Roll Again "
mypoints = sum
Frame1.Caption = "Point is " & sum
Call displaydie(imgpoint1, mdie1)
Call displaydie(imgpoint2, mdie2)
cmdroll.Enabled = True
cmdplay.Enabled = False
End Select
End Sub
Private Function rolldice()
Dim die1 As Integer, die2 As Integer, diesum As Integer, img1 As Image, img2 As Image
die1 = 1 + Int(6 * Rnd())
die2 = 1 + Int(6 * Rnd())
Call displaydie(img1, die1)
Call displaydie(img2, die2)
mdie1 = die1
mdie2 = die2
diesum = die1 + die2
rolldice = diesum
End Function
Private Sub displaydie(imgdie As Image, face As Integer)
imgdie.Picture = LoadPicture("c:\dice\" & face & ".gif")
End Sub
Private Sub cmdroll_Click()
sum = rolldice()
Select Case sum
Case mypoints
lbldisplay1.Caption = " You Win!!! "
cmdroll.Enabled = False
cmdplay.Enabled = True
Case 7
lbldisplay1.Caption = " Sorry, You Lose "
cmdroll.Enabled = False
cmdplay.Enabled = True
Case Else
lbldisplay1.Caption = " Roll Again "
cmdroll.Enabled = True
cmdplay.Enabled = False
End Select
End Sub
Code:
Runtime Error 91
Object variable or With variable block not set
and highlights the portion of the code
Code:
imgdie.Picture = LoadPicture("c:\dice\" & face & ".gif")
i cant find the problem..possibly its some sort of syntax error..
can you help me?
--------------------------------------------------------------------------------------
i have another question. i am an engg student and i wish to develop a program of CRAFT using VB6..is that possible.by CRAFT i mean Computerised Relative Allocation of Facilities Technique.its a part of a subject called plant layout that i have ti study.r there any engg or management students who can help me with this problem????