The other day, I wrote my first program, that I thought was complete. It is a simple dice roller program for dungeons and dragons. The way it works is when you click on an image of a die, it generates a random number IE: a 12 sided die would roll 1 to 12 (obviously). The problem is, I am using mouse clicks, and you can hold the mouse button down, and watch the numbers keep rolling. Is it possible to make it display only the first number the program comes across when the mouse is clicked? here is the code I used.
Sync On : Sync Rate 60
Randomize Timer()
CLS RGB(255,255,255)
Set Text Size 50
Load Image "Images\4sided_die.jpg",1,1
Load Image "Images\6sided_die.jpg",2,1
Load Image "Images\8sided_die.jpg",3,1
Load Image "Images\10sided_die.jpg",4,1
Load Image "Images\12sided_die.jpg",5,1
Load Image "Images\20sided_die.jpg",6,1
Load Image "Images\100sided_die.jpg",7,1
INK RGB(0,0,0),0
Do
Paste Image 1,0,0
Paste Image 2,100,0
Paste Image 3,180,0
Paste Image 4,280,0
Paste Image 5,50,100
Paste Image 6,140,100
Paste Image 7,240,100
If MouseX() > 0 AND MouseX() < 99 AND MouseY() > 0 AND MouseY() < 99
If MouseClick()=1
CLS RGB(255,255,255)
D4 = RND(3)+1
Text 175,250,Str$(D4)
EndIf
EndIf
If MouseX() > 100 AND MouseX() < 179 AND MouseY() > 0 AND MouseY() < 99
If MouseClick()=1
CLS RGB(255,255,255)
D6 = RND(5)+1
Text 175,250,Str$(D6)
EndIf
EndIf
If MouseX() > 180 AND MouseX() < 279 AND MouseY() > 0 AND MouseY() < 99
If MouseClick()=1
CLS RGB(255,255,255)
D8 = RND(7)+1
Text 175,250,Str$(D8)
EndIf
EndIf
If MouseX() > 280 AND MouseX() < 365 AND MouseY() > 0 AND MouseY() < 99
If MouseClick()=1
CLS RGB(255,255,255)
D10 = RND(9)+1
Text 175,250,Str$(D10)
EndIf
EndIf
If MouseX() > 50 AND MouseX() < 139 AND MouseY() > 100 AND MouseY() < 199
If MouseClick()=1
CLS RGB(255,255,255)
D12 = RND(11)+1
Text 175,250,Str$(D12)
EndIf
EndIf
If MouseX() > 140 AND MouseX() < 239 AND MouseY() > 100 AND MouseY() < 199
If MouseClick()=1
CLS RGB(255,255,255)
D20 = RND(19)+1
Text 175,250,Str$(D20)
EndIf
EndIf
If MouseX() > 240 AND MouseX() < 300 AND MouseY() > 100 AND MouseY() < 199
If MouseClick()=1
CLS RGB(255,255,255)
D100 = RND(99)+1
Text 175,250,Str$(D100)
EndIf
EndIf
If Keystate(1) = 1
Exit
Endif
Sync
Loop
The darkest minds, are often the brightest.