Page 1 of 1

Auto-swing or auto-use keybind macro?

Posted: Mon Dec 26, 2016 10:59 pm
by MisterFister
I tried searching for a fair bit of combos of the keywords in this thread's title ("macro" yielded a lot of false positives, "macroeconomics" and whatnot). Any suggestions on how I might turn my left-click into a toggle instead of a click-to-hold? For large digging projects and somesuch.

For example, I've found https://autohotkey.com/board/topic/9506 ... se-button/ and some others, but I have no clue how to "run" or "install" such a string. I have also seen mods, but none that clearly indicate compatibility with v1.5.2. :-\ (I am also flummoxed by one specifying that I should install to a .minecraft\mods folder, which I cannot seem to find...)

#NoobAlert

Re: Auto-swing or auto-use keybind macro?

Posted: Tue Dec 27, 2016 2:09 am
by Gilberreke
You don't need a Minecraft mod, just a mouse script.

http://ahkscript.org/

Re: Auto-swing or auto-use keybind macro?

Posted: Thu Jan 19, 2017 12:59 am
by Dorugami
If you have AutoHotkey, you're welcome to use my script

Code: Select all

pause::suspend


z::
    toggle := !toggle
	if (toggle) {
	SendInput {LButton Down}
	}
	else {
	SendInput {LButton Up}
	}
return

c::
    toggle := !toggle
	if (toggle) {
	SendInput {w Down}
	}
	else {
	SendInput {w Up}
	}
return 
Just paste it on a notepad and save it as filename.ahk and can be run like an executable if you have autohotkey. The keys I bound are
Z [on toggle] - for autoswing
C [on toggle] - for autorun
and Pause/Break - for Suspend (which pauses the script) when you want to type something and don't want your Cs to turn into Ws.

If you wanna change the bindings just change the c:: or z:: to any letter on the keyboard. Since you want your left click to be a toggle, replace the z:: with LButton::

Re: Auto-swing or auto-use keybind macro?

Posted: Thu Jan 19, 2017 2:42 am
by Daisjun
Another good macro:
Spoiler
Show
Image

Re: Auto-swing or auto-use keybind macro?

Posted: Sun Apr 16, 2017 4:55 pm
by MisterFister
As old as this thread is, I submit that this is not truly a necro, because I have a follow-up question to the exact solution originally suggested here (thank you @Dorugami!)

The script I've been using to this point is as follows:

Code: Select all

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

x::Send % "{Click " . ( GetKeyState("RButton") ? "Up r}" : "Down r}" )
The z-key (seems to be case sensitive and requires lowercase *shrug*) autoswings, and x (also seemingly lowercase-required) auto-interacts.

The reason I say that it seems to be lowercase-sensitive is because when holding LShift around ledges or lava (which I'm doing right now in a large lava level excavation project) the keybinds won't recognize unless I momentarily release the LShift. I dislike even that momentary vulnerability, but I've learned to live with that. My dawning issue now is that I have a desire to develop a keybind to hold LShift, alleviating stress on my poor misbegotten pinky finger.

1.) I note in the script I'm using that the right-click-hold x-keybind uses arguments "Up r}" and "Down r}" whereas the autoswing z-keybind is merely "Up}" and "Down}". I'm phonetically parroting and mimicking here, does anyone have any insight as to the syntactical meaning of the difference between those two argument strings?

2.) In attempting to use the following as a LShift-hold:

Code: Select all

c::Send % "{Shift" . ( GetKeyState("Shift") ? "Up}" : "Down}" )
... I note that the only way to un-toggle the LShift-hold is to tap LShift. In the z- and x-keybinds, I can toggle-off either by clicking / right-clicking (respectively) or I can re-tap the original keybind. In other words, a second tap to the z-key or the x-key toggles that respective keybind off again, without needing to perform any clicks or right-clicks on the mouse. Re-tapping the c-keybind shown here doesn't toggle-off the LShift-hold keybind. I suspect that this is because the keybind string is mapped to a lowercase-sensitive key.

Therefore, how do I reorient the strings to specify case-insensitive keybinds? I already tried duplicating the lines with a "!z" and "!x" arguments, but that didn't cause behavior that I could explain.

I've attempted to google and search through both the AHK and vMC forums, but I encountered no promising leads toward an answer.

Re: Auto-swing or auto-use keybind macro?

Posted: Sun Apr 16, 2017 11:47 pm
by jakerman999
MisterFister wrote:...
It's not that hotkeys are case sensitive (try with caps lock to test this) it's that shift is a modifier key. Documentation can be found at https://www.autohotkey.com/docs/Hotkeys.htm

Duplicating the keybinds with the + modifier (for shift) would just give you too macoes, one with shift and one without (not what you want). Instead, add the * modifier (no duplicates).