0 registered members (),
1,459
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: detect when a key is released
[Re: Darkmax]
#337287
08/09/10 22:18
08/09/10 22:18
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
that's simple:
on_space=light_on;
IMPORTANT: when using the on_... (on_enter,on_f1 (that works for every key)) the function (in this case) light_on will just called once if you press the key. So you don't have the problem, that the function will called more than once per keypress. and you just have to call it once, or if you want to bind the key to another function. And you can't use brackets: on_space=light_on(); doesn't work
i hope this helps you
Kartoffel
POTATO-MAN saves the day! - Random
|
|
|
Re: detect when a key is released
[Re: Widi]
#337844
08/13/10 21:34
08/13/10 21:34
|
Joined: Jul 2008
Posts: 1,178 England
MrGuest
Serious User
|
Serious User
Joined: Jul 2008
Posts: 1,178
England
|
void toggle_switch(){
while(key_space){ wait(1); }
//turn off switch here
}
void main(){
...
on_space = toggle_switch;
...
}
|
|
|
Re: detect when a key is released
[Re: MrGuest]
#337869
08/14/10 00:13
08/14/10 00:13
|
Joined: Oct 2007
Posts: 5,210 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
|
@widi key_space is not a function it's a variable
3333333333
|
|
|
|