Jump to content

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

Help with simple DDO script, very simple, but beats me B)



  • Please log in to reply
50 replies to this topic
jessebarbier
  • Members
  • 49 posts
  • Last active: Nov 16 2013 06:01 AM
  • Joined: 25 Sep 2013

download link here for updated script.

https://www.dropbox....t Hotkeys.ahk?m

 

Super Awesome!! :D

 

Sorry had been away for a week, just saw this, and its perfect!!



jessebarbier
  • Members
  • 49 posts
  • Last active: Nov 16 2013 06:01 AM
  • Joined: 25 Sep 2013

Okay so that script perfectly fine as advertised xD

But I started messing with it, and got stuck at some point.

VarList_1 = 1|2|3|4|5|6|z
VarRecast_1 = 15000|10000|5000|30000|10000|15000|100
PauseSec_1 = 600


VarList_2 = 8|9|0|{Numpad1}|{Numpad2}|{Numpad3}|{Numpad4}|{Numpad5}
VarRecast_2 = 30000|360000|300000|90000|90000|90000|90000|40000
PauseSec_2 = 3100


Loop, 2
{
	CurrentIndex := A_Index
	Loop, parse, VarList_%CurrentIndex%, |
	{
		CurrentIndex_%CurrentIndex% := A_Index
		Maxnum_%CurrentIndex% := A_Index+1
		var%A_Index%_key_%CurrentIndex% := A_LoopField
		Loop, parse, VarRecast_%CurrentIndex%, |
		{
			if (A_Index = CurrentIndex_%CurrentIndex%)
				var%A_Index%_recast_%CurrentIndex% := A_LoopField
		}
	}
}

#IfWinActive, ahk_class Notepad
a::
Loop
{
	if  (GetKeyState("CapsLock", "T") = 1)
	{
		Loop, parse, VarList_1, |
		{
			num_1 = 1
			if (Start%A_Index%_1 = "")
			{
				Send , % var%A_Index%_key_1
				Start%A_Index%_1 := A_TickCount
				Sleep, %PauseSec_1%
			}
			else
			{
				Elapsed%A_Index%_1 := A_TickCount - Start%A_Index%_1
				if (Elapsed%A_Index%_1 >= Var%A_Index%_recast_1)
				{
					Send , % var%A_Index%_key_1
					Start%A_Index%_1 := A_TickCount
					Sleep, %PauseSec_1%
				}
			}
			if  (GetKeyState("a", "P") = 0)
				break
		}
	}
	else
	{
		Send, a
	}

	break
}
return


v::
Loop
{
	if  (GetKeyState("CapsLock", "T") = 1)
	{
		Loop, parse, VarList_2, |
		{
			num_2 = 1
			if (Start%A_Index%_2 = "")
			{
				Send , % var%A_Index%_key_2
				Start%A_Index%_2 := A_TickCount
				Sleep, %PauseSec_2%
			}
			else
			{
				Elapsed%A_Index%_2 := A_TickCount - Start%A_Index%_2
				if (Elapsed%A_Index%_2 >= Var%A_Index%_recast_2)
				{
					Send , % var%A_Index%_key_2
					Start%A_Index%_2 := A_TickCount
					Sleep, %PauseSec_2%
				}
			}
			if  (GetKeyState("v", "P") = 0)
				break
		}
	}
	else
	{
		send , v
	}

	break
}
return

#IfWinActive

This is what I'm using now, It makes it to where the hotkeys are only active when capslock is on.

 

The problem I'm having is, I remapped these to "LButton" and "RButton" but when I hold down either of the two, it only fires off the first number.

if I continue to press and release it also doesn't work, seems to only do the cycle for the 1st of the buttons.

 

If you see what I'm doing wrong please help :D

 

I tried adding "while getkeystate("LButton" "P") to the LButton hotkey with no success

 

(the reason I want it on the mouse is so that I can click to attack enemies with the same cycle)



jessebarbier
  • Members
  • 49 posts
  • Last active: Nov 16 2013 06:01 AM
  • Joined: 25 Sep 2013

Okay, I got the loop working on the mouse now, but I can't seem to get the true mouse button function to be the else command. I'm tinkering with it now, will update with script in a moment.



jessebarbier
  • Members
  • 49 posts
  • Last active: Nov 16 2013 06:01 AM
  • Joined: 25 Sep 2013

Okay got the looping, and true mouse function figured out, here is updated script.

Gonna be toying around with some other stuff, may update with new functions.

Check next post, Updated code again.

With this script, the rotating keys will be activated by mouse clicks while caps lock is on, when capslock is off, you have true mouse function.

 

Edit: Updated with newest improvements, fixed a loop break bug, also added a notification bubble when hotkeys are enabled/disabled. Also made it to where if you hold MButton for 1-2 seconds it will toggle hotkeys on/off. MButton will still work as normal if not held.



jessebarbier
  • Members
  • 49 posts
  • Last active: Nov 16 2013 06:01 AM
  • Joined: 25 Sep 2013

Okay, VERY close to being finished with making changes to the script.

I have now put the "A" and "V" hotkeys back in the script, along with the LButton and RButton

Also updated the On/Off messages when toggling the hotkeys.

Also fixed a looping bug where the first number would keep looping.

Also added scroll lock toggle for the Keyboard Hotkeys

Also, newest addition, when you Hold down on the mouse wheel and scroll down (MButton+WheelDown) it toggles the Mouse Hotkeys On/Off  - And when you do (MButton+WheelUp) it toggles the Keyboard Hotkeys On/Off

VarList_1 = 1|2|3|4|5|6|z
VarRecast_1 = 15000|10000|5000|30000|10000|15000|100
PauseSec_1 = 600


VarList_2 = 7|8|9|0|{Numpad1}|{Numpad2}|{Numpad3}|{Numpad4}|{Numpad5}
VarRecast_2 = 250|90000|360000|300000|90000|90000|90000|90000|90000
PauseSec_2 = 3000


Loop, 2
{
	CurrentIndex := A_Index
	Loop, parse, VarList_%CurrentIndex%, |
	{
		CurrentIndex_%CurrentIndex% := A_Index
		Maxnum_%CurrentIndex% := A_Index+1
		var%A_Index%_key_%CurrentIndex% := A_LoopField
		Loop, parse, VarRecast_%CurrentIndex%, |
		{
			if (A_Index = CurrentIndex_%CurrentIndex%)
				var%A_Index%_recast_%CurrentIndex% := A_LoopField
		}
	}
}

#IfWinActive, ahk_class Turbine Device Class


LButton::
Loop
{
	if  (GetKeyState("CapsLock", "T") = 1)
	{
		Loop, parse, VarList_1, |
		{
			num_1 = 1
			if (Start%A_Index%_1 = "")
			{
				Send , % var%A_Index%_key_1
				Start%A_Index%_1 := A_TickCount
				Sleep, %PauseSec_1%
			}
			else
			{
				Elapsed%A_Index%_1 := A_TickCount - Start%A_Index%_1
				if (Elapsed%A_Index%_1 >= Var%A_Index%_recast_1)
				{
					Send , % var%A_Index%_key_1
					Start%A_Index%_1 := A_TickCount
					Sleep, %PauseSec_1%
				}
			}
			if  (GetKeyState("LButton", "P") = 0)
				break
		}
	}
	else
	{
		if  (GetKeyState("LButton", "P") = 1)
		{
			Click down
			KeyWait, LButton
			Click up
		}
		break
	}
if  (GetKeyState("LButton", "P") = 0)
	break
}
return


RButton::
Loop
{
	if  (GetKeyState("CapsLock", "T") = 1)
	{
		Loop, parse, VarList_2, |
		{
			num_2 = 1
			if (Start%A_Index%_2 = "")
			{
				Send , % var%A_Index%_key_2
				Start%A_Index%_2 := A_TickCount
				Sleep, %PauseSec_2%
			}
			else
			{
				Elapsed%A_Index%_2 := A_TickCount - Start%A_Index%_2
				if (Elapsed%A_Index%_2 >= Var%A_Index%_recast_2)
				{
					Send , % var%A_Index%_key_2
					Start%A_Index%_2 := A_TickCount
					Sleep, %PauseSec_2%
				}
			}
			if  (GetKeyState("RButton", "P") = 0)
				break
		}
	}
	else
	{
		if  (GetKeyState("RButton", "P") = 1)
		{
			Click down right
			KeyWait, RButton
			Click up right
		}
		break
	}
if  (GetKeyState("RButton", "P") = 0)
	break
}
return


a::
Loop
{
	if  (GetKeyState("ScrollLock", "T") = 1)
	{
		Loop, parse, VarList_1, |
		{
			num_1 = 1
			if (Start%A_Index%_1 = "")
			{
				Send , % var%A_Index%_key_1
				Start%A_Index%_1 := A_TickCount
				Sleep, %PauseSec_1%
			}
			else
			{
				Elapsed%A_Index%_1 := A_TickCount - Start%A_Index%_1
				if (Elapsed%A_Index%_1 >= Var%A_Index%_recast_1)
				{
					Send , % var%A_Index%_key_1
					Start%A_Index%_1 := A_TickCount
					Sleep, %PauseSec_1%
				}
			}
			if  (GetKeyState("a", "P") = 0)
				break
		}
	}
	else
	{
		Send, a
	}

	break
}
return


v::
Loop
{
	if  (GetKeyState("ScrollLock", "T") = 1)
	{
		Loop, parse, VarList_2, |
		{
			num_2 = 1
			if (Start%A_Index%_2 = "")
			{
				Send , % var%A_Index%_key_2
				Start%A_Index%_2 := A_TickCount
				Sleep, %PauseSec_2%
			}
			else
			{
				Elapsed%A_Index%_2 := A_TickCount - Start%A_Index%_2
				if (Elapsed%A_Index%_2 >= Var%A_Index%_recast_2)
				{
					Send , % var%A_Index%_key_2
					Start%A_Index%_2 := A_TickCount
					Sleep, %PauseSec_2%
				}
			}
			if  (GetKeyState("v", "P") = 0)
				break
		}
	}
	else
	{
		send , v
	}

	break
}
return


~CapsLock::
{
	if  (GetKeyState("CapsLock", "T") = 1)
	{
		TrayTip, , HotKeys-Mouse: On, 10, 1
	}
	else if  (GetKeyState("CapsLock", "T") = 0)
	{
		TrayTip, , HotKeys-Mouse: Off, 10, 1
	}
}
return


~ScrollLock::
{
	if  (GetKeyState("ScrollLock", "T") = 1)
	{
		TrayTip, , HotKeys-Key: On, 10, 1
	}
	else if  (GetKeyState("ScrollLock", "T") = 0)
	{
		TrayTip, , HotKeys-Key: Off, 10, 1
	}
}
return


~MButton & WheelDown::
{
	SetStoreCapslockMode, off
	send , {capslock}
	if  (GetKeyState("CapsLock", "T") = 1)
	{
		TrayTip, , HotKeys-Mouse: On, 10, 1
	}
	else if  (GetKeyState("CapsLock", "T") = 0)
	{
		TrayTip, , HotKeys-Mouse: Off, 10, 1
	}	
}
Return


~MButton & WheelUp::
{
	SetStoreCapslockMode, off
	send , {scrolllock}
	if  (GetKeyState("ScrollLock", "T") = 1)
	{
		TrayTip, , HotKeys-Key: On, 10, 1
	}
	else if  (GetKeyState("ScrollLock", "T") = 0)
	{
		TrayTip, , HotKeys-Key: Off, 10, 1
	}
}
Return

#IfWinActive


jessebarbier
  • Members
  • 49 posts
  • Last active: Nov 16 2013 06:01 AM
  • Joined: 25 Sep 2013

@ Temil2008

Would it be too much to ask of you to make the "PauseSec_2" a variable like the rest of the lists? (You could do PauseSec_1 as well, but not needed as much)

The reason is that the first 5 buttons have a 3000ms Cast/Pause time. The last 4 have a 1000ms Pause Time. (takes about 8-10 seconds longer than it should to run the cycle)

 

If you don't feel like messing with it anymore, I can just cope, its already 10000000x better than I planned from the start.

You've been amazingly helpful, Thanks for all your hard work :D I'm loving this script now