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

#1 2010-04-04 00:17:12

urhungry
Scratcher
Registered: 2009-07-03
Posts: 1000+

any mouse button pressed?

ok, so i have managed to add the right and middle mouse clicks to scratch, but i would like to be able to make a any mouse button pressed block, for left right or middle. any ideas of how i would do this? thanks.

Offline

 

#2 2010-04-04 00:31:33

Paradox
Scratcher
Registered: 2010-01-07
Posts: 500+

Re: any mouse button pressed?

Right click on Scratch in the item bar VVVVV
Then mess around with VM features


http://i50.tinypic.com/9942z7.png
Paradox is gone.

Offline

 

#3 2010-04-04 00:37:25

urhungry
Scratcher
Registered: 2009-07-03
Posts: 1000+

Re: any mouse button pressed?

i know that, ive made a few new blocks already

Offline

 

#4 2010-04-04 00:39:48

Paradox
Scratcher
Registered: 2010-01-07
Posts: 500+

Re: any mouse button pressed?

Okay, I have no idea what you're asking
I read the post again, but what I said is completely wrong


http://i50.tinypic.com/9942z7.png
Paradox is gone.

Offline

 

#5 2010-04-04 02:19:52

urhungry
Scratcher
Registered: 2009-07-03
Posts: 1000+

Re: any mouse button pressed?

Yeah, I have already implemented left, right, and middle click in separate blocks, but I would like a block which detects any of the three.

Offline

 

#6 2010-04-16 05:52:28

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: any mouse button pressed?

the original 'mouse down?' block already reports if any of the three (or maybe only two cant remember) are pressed. another way around it is a longer but efficient
< <'left pressed' OR 'right pressed> OR 'middle pressed' >

EDIT!!!!!
i found out the right button pressed (it's yellow) and
I FOUND OUT HOW TO DO ANY BUTTON!!

instead of the default    

Code:

 ^ Sensor redButtonPressed

use

Code:

 ^ Sensor anyButtonPressed

could you please add the code for the middle button please?

Last edited by LS97 (2010-04-16 06:17:28)

Offline

 

#7 2010-04-16 15:09:33

urhungry
Scratcher
Registered: 2009-07-03
Posts: 1000+

Re: any mouse button pressed?

middle is blue. thanks for the any, ill try it now.

Offline

 

#8 2010-04-17 05:19:21

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: any mouse button pressed?

ok great! now i've also got the three buttons. but to save space in the block palette i created a <%s mouse down?> boolean block, where you can enter 'left' , 'right' , 'middle' , or 'any' in the (%s) space.
the code for the block is:

Code:

 mousePressed: t1 
    t1 = 'left' ifTrue: [^ Sensor redButtonPressed].
    t1 = 'right' ifTrue: [^ Sensor yellowButtonPressed].
    t1 = 'middle' ifTrue: [^ Sensor blueButtonPressed].
    t1 = 'any' ifTrue: [^ Sensor anyButtonPressed].
    t1 = 'left ' ifTrue: [^ Sensor redButtonPressed].
    t1 = 'right ' ifTrue: [^ Sensor yellowButtonPressed].
    t1 = 'middle ' ifTrue: [^ Sensor blueButtonPressed].
    t1 = 'any ' ifTrue: [^ Sensor anyButtonPressed].
    ^ Sensor redButtonPressed

i hope that helps!

Offline

 

#9 2010-04-18 02:42:09

urhungry
Scratcher
Registered: 2009-07-03
Posts: 1000+

Re: any mouse button pressed?

Awesome! I wanted to do that, but never knew how. Thanks!

Offline

 

#10 2010-04-18 03:08:57

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: any mouse button pressed?

hey! i see youre online! EDIT no youre not
btw, why not go see my almost up forum on tricks with the source code?
i'm gonna add many other tricks and (maybe) a detailed tutorial (that might come later).

Last edited by LS97 (2010-04-18 03:09:23)

Offline

 

#11 2010-04-19 12:10:37

urhungry
Scratcher
Registered: 2009-07-03
Posts: 1000+

Re: any mouse button pressed?

ok, so i have this in my mod, thanks a ton. do you have any way of making it a drop down list instead? it would be a bit more useful. Thanks!

Offline

 

#12 2010-05-19 11:19:33

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: any mouse button pressed?

ok, sorry for the very late reply. i can make it into a drop-down menu, but that implements loads of other coding which i don't want to go into. so for the time being, keep it like this  smile

Offline

 

Board footer