Code:
$Wintitle = InputBox ("Welcome to Macro 2","Enter Window Name:")
If Not WinExists($Wintitle) Then
MsgBox(0, "", "Please run " & $Wintitle & @CRLF & "then click OK.")
EndIf
If Not WinExists($Wintitle) Then
Exit
EndIf
;read setup file
$file = FileOpen ("MAC.TXT",0)
$mask = FileReadLine ($file)
$macro = StringSplit ($mask,":")
HotKeySet ($macro [1],"macro1")
$mac1 = $macro [2]
$mask = FileReadLine ($file)
$macro = StringSplit ($mask,":")
HotKeySet ($macro [1],"macro2")
$mac2 = $macro [2]
$mask = FileReadLine ($file)
$macro = StringSplit ($mask,":")
HotKeySet ($macro [1],"macro3")
$mac3 = $macro [2]
$mask = FileReadLine ($file)
$macro = StringSplit ($mask,":")
HotKeySet ($macro [1],"macro4")
$mac4 = $macro [2]
$mask = FileReadLine ($file)
$macro = StringSplit ($mask,":")
HotKeySet ($macro [1],"macro5")
$mac5 = $macro [2]
$mask = FileReadLine ($file)
$macro = StringSplit ($mask,":")
HotKeySet ($macro [1],"macro6")
$mac6 = $macro [2]
$mask = FileReadLine ($file)
$macro = StringSplit ($mask,":")
HotKeySet ($macro [1],"macro7")
$mac7 = $macro [2]
$mask = FileReadLine ($file)
$macro = StringSplit ($mask,":")
HotKeySet ($macro [1],"macro8")
$mac8 = $macro [2]
$mask = FileReadLine ($file)
$macro = StringSplit ($mask,":")
HotKeySet ($macro [1],"macro9")
$mac9 = $macro [2]
$pc1 = 0
$time1 = 0
$pc2 = 0
$time2 = 0
$pc3 = 0
$time3 = 0
$pc4 = 0
$time4 = 0
$pc5 = 0
$time5 = 0
$pc6 = 0
$time6 = 0
$pc7 = 0
$time7 = 0
$pc8 = 0
$time8 = 0
$mask = FileReadLine ($file)
$m = StringSplit ($mask,":")
If $m[0] = 3 Then
$time1 = $m[1]
$pc1 = $m[2]
$keys1 = $m[3]
EndIf
$mask = FileReadLine ($file)
$m = StringSplit ($mask,":")
If $m[0] = 3 Then
$time2 = $m[1]
$pc2 = $m[2]
$keys2 = $m[3]
EndIf
$mask = FileReadLine ($file)
$m = StringSplit ($mask,":")
If $m[0] = 3 Then
$time3 = $m[1]
$pc3 = $m[2]
$keys3 = $m[3]
EndIf
$mask = FileReadLine ($file)
$m = StringSplit ($mask,":")
If $m[0] = 3 Then
$time4 = $m[1]
$pc4 = $m[2]
$keys4 = $m[3]
EndIf
$mask = FileReadLine ($file)
$m = StringSplit ($mask,":")
If $m[0] = 3 Then
$time5 = $m[1]
$pc5 = $m[2]
$keys5 = $m[3]
EndIf
$mask = FileReadLine ($file)
$m = StringSplit ($mask,":")
If $m[0] = 3 Then
$time6 = $m[1]
$pc6 = $m[2]
$keys6 = $m[3]
EndIf
$mask = FileReadLine ($file)
$m = StringSplit ($mask,":")
If $m[0] = 3 Then
$time7 = $m[1]
$pc7 = $m[2]
$keys7 = $m[3]
EndIf
$mask = FileReadLine ($file)
$m = StringSplit ($mask,":")
If $m[0] = 3 Then
$time8 = $m[1]
$pc8 = $m[2]
$keys8 = $m[3]
EndIf
FileClose ($file)
$skill1 = TimerInit()
$skill2 = TimerInit()
$skill3 = TimerInit()
$skill4 = TimerInit()
$skill5 = TimerInit()
$skill6 = TimerInit()
$skill7 = TimerInit()
$skill8 = TimerInit()
$Toggle = False
HotKeySet ("0","Auto_Attack")
While 1
Unstick ()
If $Toggle Then
Sleep (50)
Skill_Check ()
EndIf
Sleep (random (250,1000,1))
WEnd
Func Unstick ()
$dll = DllOpen("user32.dll")
$vkvalue = 16
;DllCall to unstick shift key as it gets stuck somehow.
DllCall($dll,"int","keybd_event","int",$vkvalue,"int",0,"long",2,"long",0)
DllClose($dll)
EndFunc
Func Skill_Check ()
$percent = Random (1,100,1)
If Int (TimerDiff ($skill1)/1000) > $time1 and $percent <= $pc1 Then
ControlSend ($Wintitle,"","",$keys1)
$skill1 = TimerInit()
EndIf
If Int (TimerDiff ($skill2)/1000) > $time2 and $percent <= $pc2 Then
ControlSend ($Wintitle,"","",$keys2)
$skill2 = TimerInit()
EndIf
If Int (TimerDiff ($skill3)/1000) > $time3 and $percent <= $pc3 Then
ControlSend ($Wintitle,"","",$keys3)
$skill3 = TimerInit()
EndIf
If Int (TimerDiff ($skill4)/1000) > $time4 and $percent <= $pc4 Then
ControlSend ($Wintitle,"","",$keys4)
$skill4 = TimerInit()
EndIf
If Int (TimerDiff ($skill5)/1000) > $time5 and $percent <= $pc5 Then
ControlSend ($Wintitle,"","",$keys5)
$skill5 = TimerInit()
EndIf
If Int (TimerDiff ($skill6)/1000) > $time6 and $percent <= $pc6 Then
ControlSend ($Wintitle,"","",$keys6)
$skill6 = TimerInit()
EndIf
If Int (TimerDiff ($skill7)/1000) > $time7 and $percent <= $pc7 Then
ControlSend ($Wintitle,"","",$keys7)
$skill7 = TimerInit()
EndIf
If Int (TimerDiff ($skill8)/1000) > $time8 and $percent <= $pc8 Then
ControlSend ($Wintitle,"","",$keys8)
$skill8 = TimerInit()
EndIf
EndFunc
Func Auto_Attack ()
$Toggle = Not $Toggle
EndFunc
Func macro1 ()
ControlSend($Wintitle,"","",$mac1)
$Toggle = False
EndFunc
Func macro2 ()
ControlSend($Wintitle,"","",$mac2)
$Toggle = False
EndFunc
Func macro3 ()
ControlSend($Wintitle,"","",$mac3)
$Toggle = False
EndFunc
Func macro4 ()
ControlSend($Wintitle,"","",$mac4)
$Toggle = False
EndFunc
Func macro5 ()
ControlSend($Wintitle,"","",$mac5)
$Toggle = False
EndFunc
Func macro6 ()
ControlSend($Wintitle,"","",$mac6)
$Toggle = False
EndFunc
Func macro7 ()
ControlSend($Wintitle,"","",$mac7)
$Toggle = False
EndFunc
Func macro8 ()
ControlSend($Wintitle,"","",$mac8)
$Toggle = False
EndFunc
Func macro9 ()
ControlSend($Wintitle,"","",$mac9)
$Toggle = False
EndFunc
There are programs I have used to read pixels and compare images off the screen. But I have always found other methods the avoid using them since image reading can slow the process down and make mistakes. As to swapping accounts in Neverwinter, I saved the same user interface for all my accounts and characters. This also means that should I tell the mouse to click at X Y, the coordinate may not match to other users who have different resolutions and UI setups.