Page 1 of 1

OnceKeypress

Posted: 31 Dec 2016, 20:22
by Zwertll
I think it would be helpful if Teascript had a way of detecting when a button was pressed only once (not holding). It would be nice to create custom power-ups and gimmicks.

Posted: 31 Dec 2016, 21:01
by Erwill
It can help you :

If keypress(XX) then
Do something.
Press:
If keypress(XX) then
Call sleep(1)
goto Press:
End if
End if

But your suggestion is useful.

Posted: 1 Jan 2017, 3:51
by Yoshi021
There could be a sysrtem. There are two different buttons: Keyboard (A,B,C...Y,Z...1,2...9,0...plus symbols) and player (jump, run, pause etc.). You can detect, if the button is pressed, hold, and released.

Posted: 1 Jan 2017, 20:40
by Zwertll
Catskart wrote:It can help you :

If keypress(XX) then
Do something.
Press:
If keypress(XX) then
Call sleep(1)
goto Press:
End if
End if

But your suggestion is useful.
I did this test but it's crashing:

Code: Select all

If keypress(-16) then
Do
val(valtest)= val(valtest)+1
Press:
If keypress(-16) then
Call sleep(1)
goto Press
End if
loop
End if

Posted: 1 Jan 2017, 20:53
by Erwill
The do something isn't a loop, it's just nothing, remove do and loop.

Posted: 1 Jan 2017, 20:59
by Zwertll
Catskart wrote:The do something isn't a loop, it's just nothing, remove do and loop.
Ah... Sorry ... You used the italic for highlight... I did not realize... I'll test now. Very thanks.
Update: Genial script. Works. I will post any application for this scrpit. Thanks again.