Posted: Fri Nov 04, 2005 6:59 pm Post subject: Dice-Turing Help Needed :(
I need help with making a dice. I tried to make the dice roll using randomize but i have to click pause to make it stop. I need your help to make it stop using a key from the keyboard and then make it work again, so that i can roll the dice easily. Here is what i got:
Rand.Set (16#1234ABCD)
loop
put "Rolled ", Rand.Int (1, 6)
end loop
I would really appreciate your feedback. Thanx a million.
Sponsor Sponsor
Cervantes
Posted: Fri Nov 04, 2005 7:18 pm Post subject: (No subject)
You could use Input.Pause(). Or you could use the following structure:
code:
loop
exit when hasch
end loop
with a possible use of Input.Flush().
[Gandalf]
Posted: Fri Nov 04, 2005 7:42 pm Post subject: (No subject)
Check out:
Input.Pause
Input.Keydown()
getch()
probably in order of which is best for your situation.
*edit* wow, I really should refresh more often.
jacklarry
Posted: Sat Nov 05, 2005 12:24 pm Post subject: (No subject)
i tried the code that u told me to write. it stops the dice and also exits it. But when i run the program i just want one rolled number to appear not the whole thing. for example, when i say run, it prints the following:
You rolled 5
You rolled 6
you rolled 1
you rolled 4................and so on. The code that i typed is:
[/code] Rand.Set (16#1234ABCD)
put "Press any key to stop the dice from rolling"
delay (1000)
cls
loop
put ""
put "You rolled ", Rand.Int (1, 6)
exit when hasch
end loop
code:
jacklarry
Posted: Sat Nov 05, 2005 12:34 pm Post subject: (No subject)
Thanx guys. I have found out what to do. My program now works. Thanx a lot.
jacklarry
Posted: Sat Nov 05, 2005 12:44 pm Post subject: (No subject)
I have finished my dice rolling. Thanx for the help. My dice code is:
Rand.Set (16#1234ABCD)
loop
put "Press any key to roll the dice again."
put""
put "You rolled ", Rand.Int (1, 6)
Input.Pause
cls
put "Thanks for rolling. "..
end loop
[Gandalf]
Posted: Sat Nov 05, 2005 11:29 pm Post subject: (No subject)
You should edit your previous posts with the "edit" button to prevent mutliple posts one after another. Also, use [code ][ /code] or syntax tags for code instead of centering it.