Perhaps this cannot be called as "double function". I want the first press to do something, and press that again to undo it, but how can i be done?
(Actually, I set the first press to set ghost effect(forever), the second press to cancel it)
Any suggestions would be appreciate. Thanks.
Offline
ok here's a simple way if it's ok to have it in it's own script:
<when[ ]clicked>
<set[ ghost ]effect to( 50
<wait until> <mouse down?>
<set[ ghost ]effect to( 0
(Otherwise you can have a variable that you check to see if it's on or not.)
Offline
tezkalow wrote:
That's not mouse down!!
I want to press a key to active it's effect, and again to cancel.
Thanks any way.
You can just replace <mouse down?>[/blocks] with <key[ ]pressed?>[/blocks] and it'll do the same thing.
Offline
This is called a "toggle". Example: an on/off switch.
I've always done it with a variable.
create a variable called "on"
set "on" to true (or 1)
When button pressed
if "on" is true (or 1)
set "on" to false (or 0)
else set "on" to true (or1)
Good luck! Remember to set your variable to false in the beginning.
When Flag clicked
set "on" to false
~Tony
<{ on }>
<when green flag clicked>
<set{ on }to( false
<forever><if><key[ ]pressed?>
<if> <( <{ on }> <=> true )>
DO OFF ACTION HERE, like "Turn Off The Lights"
<set{ on }to( false <-- Let the program know the lights are off
<else> (on is already false, the lights are already off)
DO ON ACTION HERE, like "Turn On The Lights"
<set{ on }to( true <-- Let the program know the lights are on
Last edited by infinitum3d (2010-03-16 16:29:30)
Offline