Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Help with Hold Ctrl+LMB Script


  • Please log in to reply
4 replies to this topic
godlyprodigy
  • New members
  • 3 posts
  • Last active: Oct 07 2015 05:38 AM
  • Joined: 04 Oct 2015

Im trying to make a scipt for rust to mine with one button . Right now i have this

 

z::Send % "{Click " . ( GetKeyState("LButton") ? "Up}" : "Down}" )

 

I want to add control to that line and to also lift with lmb when i press z again



Shadowpheonix
  • Members
  • 268 posts
  • Last active:
  • Joined: 10 Feb 2014

I am not 100% certain what you mean.  My guess is that you are wanting it to do Ctrl+Click Up and Ctrl+Click Down, in which case this should work (untested)...

z::Send % "{Ctrl " . ( GetKeyState("LButton") ? "Up}{Click Up}" : "Down}{Click Down}" )


godlyprodigy
  • New members
  • 3 posts
  • Last active: Oct 07 2015 05:38 AM
  • Joined: 04 Oct 2015

 

I am not 100% certain what you mean.  My guess is that you are wanting it to do Ctrl+Click Up and Ctrl+Click Down, in which case this should work (untested)...

z::Send % "{Ctrl " . ( GetKeyState("LButton") ? "Up}{Click Up}" : "Down}{Click Down}" )

 

I want it to hold ctrl and lmb at the same time when i press the key. When i press the key i want it to stop. Btw ^ didnt work it still did the same thing.



Shadowpheonix
  • Members
  • 268 posts
  • Last active:
  • Joined: 10 Feb 2014

OK.  That makes sense to me.  Here's a version without using the Ternary Operator (which in my opinion makes it easier to read & follow the logic, and therefore easier to learn from)...

#MaxThreadsPerHotkey
*z::
zToggle := !zToggle
If zToggle
    Send {Ctrl Down}{LButton Down}
Else
    Send {LButton Up}{Ctrl Up}
Return

And here's the same functionality using the Ternary Operator...

#MaxThreadsPerHotkey
*z::Send % (zToggle := !zToggle ? "{Ctrl Down}{LButton Down}" : "{LButton Up}{Ctrl Up}")


godlyprodigy
  • New members
  • 3 posts
  • Last active: Oct 07 2015 05:38 AM
  • Joined: 04 Oct 2015

 

OK.  That makes sense to me.  Here's a version without using the Ternary Operator (which in my opinion makes it easier to read & follow the logic, and therefore easier to learn from)...

#MaxThreadsPerHotkey
*z::
zToggle := !zToggle
If zToggle
    Send {Ctrl Down}{LButton Down}
Else
    Send {LButton Up}{Ctrl Up}
Return

And here's the same functionality using the Ternary Operator...

#MaxThreadsPerHotkey
*z::Send % (zToggle := !zToggle ? "{Ctrl Down}{LButton Down}" : "{LButton Up}{Ctrl Up}")

 

Omg Thanks Bro!!! This workes perfectly. Thanks for the info. Ill make sure to try the Ternary Operator sometime