
-----------------------------------
jacklarry
Fri Nov 04, 2005 6:59 pm

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.  :cry:

-----------------------------------
Cervantes
Fri Nov 04, 2005 7:18 pm


-----------------------------------
You could use Input.Pause().  Or you could use the following structure:

loop
  exit when hasch
end loop

with a possible use of Input.Flush().

-----------------------------------
[Gandalf]
Fri Nov 04, 2005 7:42 pm


-----------------------------------
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
Sat Nov 05, 2005 12:24 pm


-----------------------------------
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:


-----------------------------------
jacklarry
Sat Nov 05, 2005 12:34 pm


-----------------------------------
Thanx guys. I have found out what to do. My program now works. Thanx a lot.

 :D :scatter:  :color:

-----------------------------------
jacklarry
Sat Nov 05, 2005 12:44 pm


-----------------------------------
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
 :D

-----------------------------------
[Gandalf]
Sat Nov 05, 2005 11:29 pm


-----------------------------------
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.
