Use this script to set the variable:
(when event happens)
<set{ variabe }to( <pick random( 1 )to( 100
[/blocks]That randomizes the variable. Then to reset the variable:
(when event happens)
<if><touching[ sprite
<if><key[ (what you want) ]pressed?>
<set{ variable }to( 0
<end>
<end>[/blocks]
Offline
Something like this, maybe?
[blocks]
<when green flag clicked>
<set{ SomeVariable }to( <pick random( 1 )to( 100
<forever if> << <touching[ SomeSprite <and> <key[ SomeKey ]pressed?> >>
<set{ SomeVariable }to( 0
<end>
[/blocks]
Offline