The Daily Click ::. Forums ::. Klik Coding Help ::. Multi-Function Mouse Click (or key)
 

Post Reply  Post Oekaki 
 

Posted By Message

SolarB



Registered
  26/12/2011
Points
  564
26th December, 2011 at 17:48:14 -

Hi,

I'm building an RTS and would like to have hold right mouse scroll the screen and when it's not scrolling have right click deselect any units. Is this possible (and have I been clear)?

Both are already coded but of course whenever I right click and hold to scroll all units get deselected. It seems that 'when mouse key is pressed' is basically 'user clicks' + hold. I have experimented with values, flags, timers, etc. My most productive trial was with click + drag = scroll and just click = deselect, but still the same issue.

Please help, most RTS's have this function and it's driving me nuts!

Thanks so much.

 
My Open Source Examples: http://bit.ly/YyUFUh

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
26th December, 2011 at 18:33:36 -

+ User clicks with right mouse button
-> Set DragX to XMouse
-> Set DragY to YMouse
-> Set MouseDown to 1
-> Set ClickLength to 0

+ Repeat while right mouse button is pressed
-> Centre horizontal position of frame at: ((X Left Frame+X Right Frame)/2)+(DragX-XMouse)
-> Centre vertical position of frame at: ((Y Top Frame+Y Bottom Frame)/2)+(DragY-YMouse)
-> Add 1 to ClickLength

+ Repeat while right mouse button is NOT pressed
+ MouseDown = 1
+ ClickLength < 9 // change this value to vary the delay between click and click/drag
-> De-select all units...

+ Repeat while right mouse button is NOT pressed
-> Set MouseDown to 0

eg:
https://skydrive.live.com/redir.aspx?cid=b1e7ee094271bbda&resid=B1E7EE094271BBDA!478&parid=B1E7EE094271BBDA!131&authkey=!

Edited by Sketchy

 
n/a

SolarB



Registered
  26/12/2011
Points
  564
26th December, 2011 at 19:08:03 -

Mad! Works perfect, thanks.

What got me was:
+ Repeat while right mouse button is NOT pressed
+ MouseDown = 1
+ ClickLength < 9

NOT pressed! aha.... seems counter-intuitive at first but I get it now.


Cheers!

 
My Open Source Examples: http://bit.ly/YyUFUh
   

Post Reply



 



Advertisement

Worth A Click