Thursday, September 3, 2009

SWG Scripts - New RE script. Flawless!!



Share

I have recently created a Reverse Engineering script to automatically create +35 powerbits and move them when finished. I also have it compensate for lag.
Screenshots will come later, as the servers are currently down!
I have only tested this with tailor, it does not include the check for items without sockets, as I have never had this happen to me.


Don't forget to turn off "Allow object icon rotation" in your options under interface in options
Turn on Option->Interface->"Dragging onto containers puts item into container (instead of reordering items)"

I have written this script myself, and this is its first public release.
Code:

Good luck REing!


    Global $Paused
    Global $35check
    Global $cratecheck
    Global $movecheck
    Global $shoecheck
    Global $unfinishedcheck
    HotKeySet("{PAUSE}", "TogglePause")
    HotKeySet("{ESC}", "Terminate")
    Opt("MouseClickDragDelay", 100)
    #include

    Sleep("1000") ; Pause to switch to SWG - Windowed Mode
    $i = 0 ; Infinite loop

    SplashTextOn("Setup", "Leftclick somewhere on screen that turns dark with attach SEA popup", 400, 100, -1, -1, 1, "Ariel", 14)
    While 1
    Sleep(100)
    If _IsPressed("01") Then
    $pos = MouseGetPos()
    ExitLoop
    EndIf
    WEnd
    SplashOff()

    $popX = $pos[0]
    $popY = $pos[1]
    Sleep(300)



    SplashTextOn("Setup", "Click on the +35 powerbit (left blue side). Make sure the status menu opens", 400, 100, -1, -1, 1, "Ariel", 14)
    While 1
    Sleep(100)
    If _IsPressed("01") Then
    $pos = MouseGetPos()
    ExitLoop
    EndIf
    WEnd
    SplashOff()

    $modX = $pos[0]
    $modY = $pos[1]
    Sleep(1000)

    SplashTextOn("Setup", "Click just left above Power in the status menu", 400, 100, -1, -1, 1, "Ariel", 14)
    While 1
    Sleep(100)
    If _IsPressed("01") Then
    $pos = MouseGetPos()
    ExitLoop
    EndIf
    WEnd
    SplashOff()

    $pX = $pos[0]
    $pY = $pos[1]
    Sleep(1000)



    SplashTextOn("Setup", "Click just leftabove the 35 in the status menu", 400, 100, -1, -1, 1, "Ariel", 14)
    While 1
    Sleep(100)
    If _IsPressed("01") Then
    $pos = MouseGetPos()
    ExitLoop
    EndIf
    WEnd
    SplashOff()

    $35Cx1 = $pos[0]
    $35Cy1 = $pos[1]
    $35Cx2 = $pos[0] + 14
    $35Cy2 = $pos[1] + 10

    Sleep(300)

    SplashTextOn("Setup", "Leftclick on the spot right of the +35 in inventory, so you'll touch the item you use for grinding", 400, 100, -1, -1, 1, "Ariel", 14)
    While 1
    Sleep(100)
    If _IsPressed("01") Then
    $pos = MouseGetPos()
    ExitLoop
    EndIf
    WEnd
    SplashOff()

    $mod2X = $pos[0]
    $mod2Y = $pos[1]
    Sleep(300)

    SplashTextOn("Setup", "Leftclick on the +35 Powerbit storage", 400, 100, -1, -1, 1, "Ariel", 14)
    While 1
    Sleep(100)
    If _IsPressed("01") Then
    $pos = MouseGetPos()
    ExitLoop
    EndIf
    WEnd
    SplashOff()

    $storageX = $pos[0]
    $storageY = $pos[1]
    Sleep(300)

    SplashTextOn("Setup", "Leftclick on the crate of items you use for grinding", 400, 100, -1, -1, 1, "Ariel", 14)
    While 1
    Sleep(100)
    If _IsPressed("01") Then
    $pos = MouseGetPos()
    ExitLoop
    EndIf
    WEnd
    SplashOff()

    $shoeX = $pos[0]
    $shoeY = $pos[1]
    Sleep(300)

    SplashTextOn("Setup", "Leftclick on the junktool", 400, 100, -1, -1, 1, "Ariel", 14)
    While 1
    Sleep(100)
    If _IsPressed("01") Then
    $pos = MouseGetPos()
    ExitLoop
    EndIf
    WEnd
    SplashOff()

    $junkX = $pos[0]
    $junkY = $pos[1]
    Sleep(300)

    SplashTextOn("Setup", "Leftclick on the RE tool", 400, 100, -1, -1, 1, "Ariel", 14)
    While 1
    Sleep(100)
    If _IsPressed("01") Then
    $pos = MouseGetPos()
    ExitLoop
    EndIf
    WEnd
    SplashOff()

    $reX = $pos[0]
    $reY = $pos[1]
    Sleep(300)

    SplashTextOn("Setup", "Leftclick on the unfinished powerbit (storage)", 400, 100, -1, -1, 1, "Ariel", 14)
    While 1
    Sleep(100)
    If _IsPressed("01") Then
    $pos = MouseGetPos()
    ExitLoop
    EndIf
    WEnd
    SplashOff()

    $unfinishedX = $pos[0]
    $unfinishedY = $pos[1]
    Sleep(300)

    MouseClick("left", $modX, $modY, 1, 3)
    Sleep(1500)
    $pre35check = PixelChecksum($pX, $pY, $pX + 10, $pY + 10)
    $35check = PixelChecksum($35Cx1, $35Cy1, $35Cx2, $35Cy2)
    $popcheck = PixelGetColor($popX, $popY)
    $cratecheck = PixelChecksum($shoeX - 5, $shoeY - 5, $shoeX + 5, $shoeY + 5)
    $shoecheck = PixelChecksum($mod2X, $mod2Y, $mod2X + 10, $mod2Y + 10)
    $unfinishedcheck = PixelChecksum($unfinishedX - 10, $unfinishedY - 10, $unfinishedX + 10, $unfinishedY + 10)
    Sleep(100)
    MouseClickDrag("left", $modX, $modY, $storageX, $storageY, 3)
    Sleep(1000)
    $movecheck = PixelChecksum($modX - 5, $modY - 5, $modX + 5, $modY + 5)
    Sleep(1000)
    MouseClickDrag("left", $unfinishedX, $unfinishedY, $modX, $modY, 3)
    Do
    Sleep(100)
    Until Not isempty()
    Sleep(1000)
    Do
    MouseClick("left", $modX, $modY, 1, 3)
    ToolTip("1", 0, 0)
    Do
    Sleep(100)
    Until PixelChecksum($pX, $pY, $pX + 10, $pY + 10) == $pre35check
    ToolTip("")
    If check35() Then
    Do
    MouseClickDrag("left", $modX, $modY, $storageX, $storageY, 3)
    Sleep(600)
    Until isempty()
    Do
    If Not unfinishedcheck() Then
    Exit 0
    EndIf
    MouseClickDrag("left", $unfinishedX, $unfinishedY, $modX, $modY, 3)
    Sleep(500)
    If (isempty()) Then
    Sleep(500)
    If (isempty()) Then
    Sleep(500)
    If (isempty()) Then
    Sleep(500)
    EndIf
    EndIf
    EndIf
    Until Not isempty()
    EndIf

    If Not cratecheck() Then
    Exit 0
    EndIf
    Do
    MouseClickDrag("left", $modX, $modY, $reX, $reY, 3)
    Sleep(1000)
    Until isempty()
    Do
    MouseClick("right", $junkX, $junkY, 1, 3)
    Sleep(1000)
    Send("5")
    MouseClick("left", $junkX, $junkY, 1, 3)
    Sleep(500)
    $xx = 0
    Do
    Sleep(500)
    $xx = $xx + 1
    Until Not isempty() Or $xx > 10
    Until Not isempty()
    Do
    MouseClickDrag("left", $modX, $modY, $reX, $reY, 3)
    Sleep(1000)
    Until isempty()
    Do
    MouseClick("right", $reX, $reY, 1, 3)
    Sleep(1000)
    Send("6")
    MouseClick("left", $reX, $reY, 1, 3)
    Sleep(500)
    Until Not isempty()
    MouseClick("left", $shoeX, $shoeY, 2, 3)
    Sleep(200)
    Do
    Sleep(500)
    Until Not shoecheck()
    Do
    MouseClickDrag("left", $modX, $modY, $mod2X, $mod2Y, 3)
    Sleep(1000)
    Until popup()
    Send("{enter}")
    Do
    Sleep(600)
    Until Not popup()
    Do
    MouseClickDrag("left", $modX, $modY, $reX, $reY, 3)
    Sleep(1000)
    Until isempty()
    Do
    MouseClick("right", $reX, $reY, 1, 3)
    Sleep(1000)
    Send("5")
    MouseClick("left", $reX, $reY, 1, 3)
    Sleep(500)
    Until Not isempty()
    Until $i = 1

    Func check35()
    Return PixelChecksum($35Cx1, $35Cy1, $35Cx2, $35Cy2) == $35check
    EndFunc ;==>check35

    Func shoecheck()
    Return PixelChecksum($mod2X, $mod2Y, $mod2X + 10, $mod2Y + 10) == $shoecheck
    EndFunc ;==>shoecheck

    Func isempty()
    Return PixelChecksum($modX - 5, $modY - 5, $modX + 5, $modY + 5) == $movecheck
    EndFunc ;==>isempty

    Func cratecheck()
    Return PixelChecksum($shoeX - 5, $shoeY - 5, $shoeX + 5, $shoeY + 5) == $cratecheck
    EndFunc ;==>cratecheck

    Func unfinishedcheck()
    ;Return PixelChecksum($unfinishedX - 5, $unfinishedY - 5, $unfinishedX + 5, $unfinishedY + 5) == $unfinishedcheck
    Return True
    EndFunc ;==>unfinishedcheck

    ;Pause Script
    Func TogglePause()
    $Paused = Not $Paused
    While $Paused
    Sleep(100)
    ToolTip('Script Paused', 0, 0)
    WEnd
    ToolTip("")
    EndFunc ;==>TogglePause

    Func popup()
    Return PixelGetColor($popX, $popY) <> $popcheck
    EndFunc ;==>popup

    ;Terminate Script
    Func Terminate()
    Exit 0
    EndFunc ;==>Terminate


Edit:
For people still having truble using this try this:




Global $Paused
Global $35check
Global $cratecheck
Global $movecheck
Global $shoecheck
Global $unfinishedcheck
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
Opt("MouseClickDragDelay", 100)
#include

Sleep("1000") ; Pause to switch to SWG - Windowed Mode
$i = 0 ; Infinite loop

SplashTextOn("Setup", "Leftclick somewhere on screen that turns dark with attach SEA popup", 400, 100, -1, -1, 1, "Ariel", 14)
While 1
Sleep(100)
If _IsPressed("01") Then
$pos = MouseGetPos()
ExitLoop
EndIf
WEnd
SplashOff()

$popX = $pos[0]
$popY = $pos[1]
Sleep(300)



SplashTextOn("Setup", "Click on the +35 powerbit (left blue side). Make sure the status menu opens", 400, 100, -1, -1, 1, "Ariel", 14)
While 1
Sleep(100)
If _IsPressed("01") Then
$pos = MouseGetPos()
ExitLoop
EndIf
WEnd
SplashOff()

$modX = $pos[0]
$modY = $pos[1]
Sleep(1000)

SplashTextOn("Setup", "Click just left above Power in the status menu", 400, 100, -1, -1, 1, "Ariel", 14)
While 1
Sleep(100)
If _IsPressed("01") Then
$pos = MouseGetPos()
ExitLoop
EndIf
WEnd
SplashOff()

$pX = $pos[0]
$pY = $pos[1]
Sleep(1000)



SplashTextOn("Setup", "Click just leftabove the 35 in the status menu", 400, 100, -1, -1, 1, "Ariel", 14)
While 1
Sleep(100)
If _IsPressed("01") Then
$pos = MouseGetPos()
ExitLoop
EndIf
WEnd
SplashOff()

$35Cx1 = $pos[0]
$35Cy1 = $pos[1]
$35Cx2 = $pos[0] + 14
$35Cy2 = $pos[1] + 10

Sleep(300)

SplashTextOn("Setup", "Leftclick on the spot right of the +35 in inventory, so you'll touch the item you use for grinding", 400, 100, -1, -1, 1, "Ariel", 14)
While 1
Sleep(100)
If _IsPressed("01") Then
$pos = MouseGetPos()
ExitLoop
EndIf
WEnd
SplashOff()

$mod2X = $pos[0]
$mod2Y = $pos[1]
Sleep(300)

SplashTextOn("Setup", "Leftclick on the +35 Powerbit storage", 400, 100, -1, -1, 1, "Ariel", 14)
While 1
Sleep(100)
If _IsPressed("01") Then
$pos = MouseGetPos()
ExitLoop
EndIf
WEnd
SplashOff()

$storageX = $pos[0]
$storageY = $pos[1]
Sleep(300)

SplashTextOn("Setup", "Leftclick on the crate of items you use for grinding", 400, 100, -1, -1, 1, "Ariel", 14)
While 1
Sleep(100)
If _IsPressed("01") Then
$pos = MouseGetPos()
ExitLoop
EndIf
WEnd
SplashOff()

$shoeX = $pos[0]
$shoeY = $pos[1]
Sleep(300)

SplashTextOn("Setup", "Leftclick on the junktool", 400, 100, -1, -1, 1, "Ariel", 14)
While 1
Sleep(100)
If _IsPressed("01") Then
$pos = MouseGetPos()
ExitLoop
EndIf
WEnd
SplashOff()

$junkX = $pos[0]
$junkY = $pos[1]
Sleep(300)

SplashTextOn("Setup", "Leftclick on the RE tool", 400, 100, -1, -1, 1, "Ariel", 14)
While 1
Sleep(100)
If _IsPressed("01") Then
$pos = MouseGetPos()
ExitLoop
EndIf
WEnd
SplashOff()

$reX = $pos[0]
$reY = $pos[1]
Sleep(300)

SplashTextOn("Setup", "Leftclick on the unfinished powerbit (storage)", 400, 100, -1, -1, 1, "Ariel", 14)
While 1
Sleep(100)
If _IsPressed("01") Then
$pos = MouseGetPos()
ExitLoop
EndIf
WEnd
SplashOff()

$unfinishedX = $pos[0]
$unfinishedY = $pos[1]
Sleep(300)

MouseClick("left", $modX, $modY, 1, 3)
Sleep(1500)
$pre35check = PixelChecksum($pX, $pY, $pX + 10, $pY + 10)
$35check = PixelChecksum($35Cx1, $35Cy1, $35Cx2, $35Cy2)
$popcheck = PixelGetColor($popX, $popY)
$cratecheck = PixelChecksum($shoeX - 5, $shoeY - 5, $shoeX + 5, $shoeY + 5)
$shoecheck = PixelChecksum($mod2X, $mod2Y, $mod2X + 10, $mod2Y + 10)
$unfinishedcheck = PixelChecksum($unfinishedX - 10, $unfinishedY - 10, $unfinishedX + 10, $unfinishedY + 10)
Sleep(100)
MouseClickDrag("left", $modX, $modY, $storageX, $storageY, 3)
Sleep(1000)
$movecheck = PixelChecksum($modX - 5, $modY - 5, $modX + 5, $modY + 5)
Sleep(1000)
MouseClickDrag("left", $unfinishedX, $unfinishedY, $modX, $modY, 3)
Do
Sleep(100)
Until Not isempty()
Sleep(1000)
Do
MouseClick("left", $modX, $modY, 1, 3)
ToolTip("1", 0, 0)
Do
Sleep(100)
Until PixelChecksum($pX, $pY, $pX + 10, $pY + 10) == $pre35check
ToolTip("")
If check35() Then
Do
MouseClickDrag("left", $modX, $modY, $storageX, $storageY, 3)
Sleep(600)
Until isempty()
Do
If Not unfinishedcheck() Then
Exit 0
EndIf
MouseClickDrag("left", $unfinishedX, $unfinishedY, $modX, $modY, 3)
Sleep(500)
If (isempty()) Then
Sleep(500)
If (isempty()) Then
Sleep(500)
If (isempty()) Then
Sleep(500)
EndIf
EndIf
EndIf
Until Not isempty()
EndIf

If Not cratecheck() Then
Exit 0
EndIf
Do
MouseClickDrag("left", $modX, $modY, $reX, $reY, 3)
Sleep(1000)
Until isempty()
Do
MouseClick("right", $junkX, $junkY, 1, 3)
Sleep(1000)
Send("5")
MouseClick("left", $junkX, $junkY, 1, 3)
Sleep(500)
$xx = 0
Do
Sleep(500)
$xx = $xx + 1
Until Not isempty() Or $xx > 10
Until Not isempty()
Do
MouseClickDrag("left", $modX, $modY, $reX, $reY, 3)
Sleep(1000)
Until isempty()
Do
MouseClick("right", $reX, $reY, 1, 3)
Sleep(1000)
Send("6")
MouseClick("left", $reX, $reY, 1, 3)
Sleep(500)
Until Not isempty()
MouseClick("left", $shoeX, $shoeY, 2, 3)
Sleep(200)
Do
Sleep(500)
Until Not shoecheck()
Do
MouseClickDrag("left", $modX, $modY, $mod2X, $mod2Y, 3)
Sleep(1000)
Until popup()
Send("{enter}")
Do
Sleep(600)
Until Not popup()
Do
MouseClickDrag("left", $modX, $modY, $reX, $reY, 3)
Sleep(1000)
Until isempty()
Do
MouseClick("right", $reX, $reY, 1, 3)
Sleep(1000)
Send("5")
MouseClick("left", $reX, $reY, 1, 3)
Sleep(500)
Until Not isempty()
Until $i = 1

Func check35()
Return PixelChecksum($35Cx1, $35Cy1, $35Cx2, $35Cy2) == $35check
EndFunc ;==>check35

Func shoecheck()
Return PixelChecksum($mod2X, $mod2Y, $mod2X + 10, $mod2Y + 10) == $shoecheck
EndFunc ;==>shoecheck

Func isempty()
Return PixelChecksum($modX - 5, $modY - 5, $modX + 5, $modY + 5) == $movecheck
EndFunc ;==>isempty

Func cratecheck()
Return PixelChecksum($shoeX - 5, $shoeY - 5, $shoeX + 5, $shoeY + 5) == $cratecheck
EndFunc ;==>cratecheck

Func unfinishedcheck()
;Return PixelChecksum($unfinishedX - 5, $unfinishedY - 5, $unfinishedX + 5, $unfinishedY + 5) == $unfinishedcheck
Return True
EndFunc ;==>unfinishedcheck

;Pause Script
Func TogglePause()
$Paused = Not $Paused
While $Paused
Sleep(100)
ToolTip('Script Paused', 0, 0)
WEnd
ToolTip("")
EndFunc ;==>TogglePause

Func popup()
Return PixelGetColor($popX, $popY) <> $popcheck
EndFunc ;==>popup

;Terminate Script
Func Terminate()
Exit 0
EndFunc ;==>Terminate

8 comments:

Radi on September 9, 2009 at 2:01 AM said...

I get the error:

Line 10 (File "bla bla bla"):

#include

Error: Cannot parse #include

Thanks in the advance

puckhacker on September 9, 2009 at 7:53 AM said...

What version of Autoit are you using? the #include line doesn't compile for me.

puckhacker on September 9, 2009 at 7:54 AM said...

What version of Autoit are you using? the #include line doesnt compile for me. Says "cannot parse #include".

Radi on September 10, 2009 at 1:21 AM said...

Im using AutoIt3

puckhacker on September 15, 2009 at 7:11 AM said...

Flawed! It won't even compile. Can you check where you copy/pasted it from and fix it? I think there's supposed to be parameter(s) after the #include statements.

mmorpgguide on September 15, 2009 at 8:45 AM said...

Just did an update. I am more afraid it is the blog template that eats some of the code.

puckhacker on September 26, 2009 at 3:40 AM said...

Well, can you post a link to a .txt file or something? The script is useless if it wont even compile.

puckhacker on October 10, 2009 at 6:31 AM said...

Any chance this will ever be fixed?

Post a Comment

 
Star Wars Gaming © 2009