OK....Here's my code exactly as I use it.
The combat routine is written that way 'course I use the same
for junk-looting. It can easily be adjusted to agro/target more mobs.
Could use a nested for etc, but want to make sure there's enough action to hit heal when I need to.
This one works....My number of Mysterious disks shows it
Code: Select all
Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
Opt("MouseClickDragDelay", 100)
#Include <Misc>
;StarWarsGalaxies Forager Version 2 with Auto Delete
Sleep(5000)
While 1
If MsgBox( 4096 + 262144 + 1, "SWG WINDOWS WARNING","YOU MUST RUN SWG IN BORDERLESS WINDOWS MODE." & @CRLF & "SET TOOLBARPANE 3." & @CRLF & "HAVE FIELD OF VIEW TO MAXIMUM (looking down)." & @CRLF & "HAVE YOUR FORAGE MACRO MAPPED TO N") = 2 Then Exit
ExitLoop
WEnd
Sleep (1000)
;Created a /forage macro and mapped it to N
$i = 0
$var1 = "5"; How many times you want to forage Left/Right before going forward
SplashTextOn ( "Setup", "Leftclick on the Main Spot (where foraged item will be)", 400, 100, -1, -1, 1, "Ariel", 14 )
While 1
Sleep ( 100 )
If _IsPressed ( "01" ) Then
$pos = MouseGetPos()
ExitLoop
EndIf
WEnd
SplashOff()
$var3 = $pos[0]
$var4 = $pos[1]
Sleep (1000)
SplashTextOn ( "Setup", "Leftclick on the Backpack", 400, 100, -1, -1, 1, "Ariel", 14 )
While 1
Sleep ( 100 )
If _IsPressed ( "01" ) Then
$pos = MouseGetPos()
ExitLoop
EndIf
WEnd
SplashOff()
$var5 = $pos[0]
$var6 = $pos[1]
Sleep (1000)
;Sets our coords for PixelChecksum to use as a template - also sets us up to check it in the future
SplashTextOn ( "Setup", "Leftclick on 'combatpixels'", 400, 100, -1, -1, 1, "Ariel", 14 )
While 1
Sleep ( 100 )
If _IsPressed ( "01" ) Then
$pos = MouseGetPos()
ExitLoop
EndIf
WEnd
SplashOff()
$portraitx = $pos[0]
$portraity = $pos[1]
Sleep (1000)
$CombatCheck = PixelGetColor(($portraitx), ($portraity))
;Start our loop
Do
For $x = 1 to $var1
CheckCombatState()
Send("{a down}")
Sleep (1300)
Send("{a up}")
Sleep(500)
Send("{n down}")
Send("{n up}")
Sleep(100)
MouseClick ( "right" , $var3, $var4, 1 )
Sleep(200)
send("{2}")
Sleep(200)
MouseClickDrag ( "left" , $var3, $var4, $var5, $var6, 1)
Sleep (1200)
Next
send("{d down}")
Send("{w down}")
Sleep (1200)
Send("{w up}")
Send("{d up}")
Sleep ("50")
For $x = 1 to $var1
CheckCombatState()
Send("{d down}")
Sleep (1300)
Send("{d up}")
Sleep(500)
Send("{n down}")
Send("{n up}")
Sleep(100)
MouseClick ( "right" , $var3, $var4, 1 )
Sleep(200)
send("{2}")
Sleep(200)
MouseClickDrag ( "left" , $var3, $var4, $var5, $var6, 1)
Sleep ("1200")
Next
Send("{a down}")
Send("{w down}")
Sleep (200)
Send("{w up}")
Send("{a up}")
Sleep (50)
Until $i = 1
;Pause Script
Func CheckCombatState()
If PixelGetColor(($portraitx), ($portraity)) = $CombatCheck Then
return
Else
Do
;Combat Routine
send("s") ;target self
send("{TAB}") ;Change this to your hotkey to cycle target outward
MouseDown("left") ;Mousedown or the key that fires your weapon (insted of auto attack)
send("4") ;Change this to your Kill macro
Sleep (2000) ;Change this accordingly to make sure your abilities cycle
;Send("{TAB}") ;Change this to your hotkey to cycle target outward
;MouseUp("left")
;MouseDown("left")
send("4") ;Change this to your Kill macro
Sleep (2000) ;Change this accordingly to make sure your abilities cycle
send("4") ;Change this to your Kill macro
Sleep (500)
send("6")
Sleep (1500) ;Change this accordingly to make sure your abilities cycle
send("S")
send("{TAB}") ;Change this to your hotkey to cycle target outward
MouseUp("left")
MouseDown("left")
send("4") ;Change this to your Kill macro
Sleep (500)
send("6")
Sleep (1500) ;Change this accordingly to make sure your abilities cycle
MouseUp("left")
Until PixelGetColor(($portraitx), ($portraity)) = $CombatCheck
EndIf
return
EndFunc
;Pause Script
Func TogglePause()
$Paused = NOT $Paused
While $Paused
sleep(100)
ToolTip('Script Paused',0,0)
WEnd
ToolTip("")
EndFunc
;Terminate Script
Func Terminate()
Exit 0
EndFunc