hotkeys
Author |
Message |
hackman
|
Posted: Thu Sep 25, 2003 3:35 pm Post subject: hotkeys |
|
|
First of all, im new here and new to programing. I started programing with turing about 4 weeks ago. Well anyway, i was wondering if anyone could tell me how to set a hotkey(ex. in a slotmachine game, how to make it so i just have to press space bar to pull the lever instead of typing Y +enter).
Well thats all ive got to say for now. Thanks. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Dan
![](http://wiki.compsci.ca/images/archive/3/3c/20100325043407!Danspic.gif)
|
Posted: Thu Sep 25, 2003 5:04 pm Post subject: (No subject) |
|
|
for this you whould whont to use the getch comand.
getch(string(1)) - note that string(1) is a string with only one letter or a charticher.
ex.
code: |
var name:string(1) %has to be string(1) or char
put "Hi, what is the 1st letter of your name?"
getch(name)
put "your 1st letter is ", name
|
now that is how you get input with out needing enter to be hit but you will need to use if's to check what button was hit. also getch puts the ACII char in the string(1) or char and not it's value so you will need to conver it.
ex.
code: |
var key : string (1)
put "hit a key (hit esc key to exit)"
loop
getch (key)
if ord (key) = 27 then %27 is the code for the esc key
exit
else
put "the ACII value for that key is: ", ord(key)
end if
end loop
|
this will stop the progaming from ruing while it weghts for input just like get but dose not need enter. if you whont an non-blocking way of doing it you wil have to use hasch or input.keydown (truing 4.x only)[/code] |
Computer Science Canada
Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more! |
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Thu Sep 25, 2003 6:52 pm Post subject: (No subject) |
|
|
heh, Dan - are you forgetting Input.KeyDown?
hackman - if you're using WinOOT 4.x , you're better off using Input.KeyDown - it generates a boolean array of all the keys pressed (well, as much as your hardware supports (which is usually 3 characters + 3 system).
There's a tutorial on that somewhere under Turing -> Tutorials. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
hackman
|
Posted: Thu Sep 25, 2003 9:16 pm Post subject: (No subject) |
|
|
Thank you so much! Everything is up and runing smooth now.
p.s. im using version 3.1 somthin |
|
|
|
|
![](images/spacer.gif) |
|
|