This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-12-07 13:25:26

Linkquest
New Scratcher
Registered: 2012-12-05
Posts: 4

Button held down

So I want to write a script that senses when a specific button is held down as opposed to pressed; however, I'm not sure this is possible in scratch currently, but if it is, please post a script that does this.

Offline

 

#2 2012-12-07 13:47:30

Nerd_Herd
Scratcher
Registered: 2012-10-12
Posts: 12

Re: Button held down

When flag clicked
forever
| if key space pressed
|wait 0.5 secs
||if key space pressed
||do what you want it to do
   |----->                 
                    --------^

Offline

 

#3 2012-12-07 16:52:59

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Button held down

when key [space v] pressed
set [down_time v] to (timer)
wait until<not<key [space v] pressed?>>
if<((timer)-(down_time)) > (some length of time)>
broadcast [long press v]
end


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

Board footer