Sign in to follow this  
Followers 0
0L0

Help in revising a bot for PerfectWorld

9 posts in this topic

Hello everyone, I am currently trying to revise a bot for the online game Perfect World.

What I would like to do is add a few more skills to the first page and have an "option" to adjust the repeat delay in using each skill to a maximum of 1 hour. Currently the skills have a max delay of only 60 seconds in the bot.

Any help will be very appreciated.

This is the source code from the bot.

#include <GUIConstants.au3>

#include <string.au3>

#NoTrayIcon

Dim $KeyHP = False

Dim $KeyMP = False

Dim $KeySAOSA = False

Dim $KeyP = False

Dim $KeyHAS = False

Dim $KeySHASS = False

Dim $KeyS1 = False

Dim $KeyS2 = False

Dim $FName

Dim $HPPer, $MPPer, $HPButton, $MPButton, $BPickup, $xHP, $xMP, $ButtonS1, $ButtonS2, $Button

Dim $LastHP = 0

Dim $LastMP = 0

Dim $LastP = 0

Dim $LastS1 = 0

Dim $LastS2 = 0

Dim $NextHP = 0

Dim $NextMP = 0

Dim $NextP = 0

Dim $NextS1 = 0

Dim $NextS2 = 0

Dim $Time1 = 0

Dim $Time2 = 0

Dim $Now = 0

Dim $ListB1 = "1|2|3|4|5|6|F1|F2|F3|F4|F5|F6|F7|F8"

Dim $ListB2 = "10|20|30|40|50|60|70|80|90"

;------------------------------------------------Hotkey----------------------------------------------

HotKeySet("{F9}","AutoHP")

HotKeySet("{F10}","AutoMP")

HotKeySet("{F11}","AutoPickup")

HotKeySet("!1","Skill1")

HotKeySet("!2","Skill2")

HotKeySet("!s","StartOrStopAll")

HotKeySet("!c","ChangeName")

HotKeySet("!+h","HideAndShow")

HotKeySet("!h","SHASS")

HotKeySet("!q","Quit")

;------------------------------------------------Forn------------------------------------------------

$Form1 = GUICreate("Tool for PW", 186, 219, 2, 2)

$Tab1 = GUICtrlCreateTab(0, 0, 185, 199)

$TabSheet1 = GUICtrlCreateTabItem("Option")

$Label1 = GUICtrlCreateLabel("Auto MP", 8, 76, 45, 17)

$Label2 = GUICtrlCreateLabel("%", 172, 76, 12, 17)

$Label3 = GUICtrlCreateLabel("Pickup Item", 8, 100, 60, 17)

$Label5 = GUICtrlCreateLabel("Skill 1", 8, 124, 32, 17)

$Label7 = GUICtrlCreateLabel("Auto HP", 8, 52, 44, 17)

$Label8 = GUICtrlCreateLabel("%", 172, 52, 12, 17)

$BHPInput = GUICtrlCreateCombo("", 72, 48, 49, 25) ;Button HP input

GUICtrlSetData(-1,$ListB1,"F8")

$BMPInput = GUICtrlCreateCombo("", 72, 72, 49, 25) ;Button MP input

GUICtrlSetData(-1,$ListB1,"F7")

$PHPInput = GUICtrlCreateCombo("", 120, 48, 49, 25) ;Percent HP input

GUICtrlSetData(-1,$ListB2,"80")

$PMPInput = GUICtrlCreateCombo("", 120, 72, 49, 25) ;Percent MP input

GUICtrlSetData(-1,$ListB2,"30")

$BPInput = GUICtrlCreateCombo("", 72, 96, 97, 25) ;Button Pickup input

GUICtrlSetData(-1,$ListB1,"3")

$BS1Input = GUICtrlCreateCombo("", 72, 120, 49, 25) ;Button Skill 1 input

GUICtrlSetData(-1,$ListB1,"1")

$T1Input = GUICtrlCreateInput("2", 120, 120, 49, 22) ;Time Skill 1 input

$Label9 = GUICtrlCreateLabel("s", 172, 124, 9, 17)

$StartAll = GUICtrlCreateButton("Start All", 8, 168, 83, 25, 0) ;Button Start all

$Label4 = GUICtrlCreateLabel("Focus Name", 8, 30, 64, 17)

$FNInput = GUICtrlCreateInput("Element Client", 72, 26, 110, 21) ;Focus name input

$Label6 = GUICtrlCreateLabel("Skill 2", 8, 148, 32, 17)

$BS2Input = GUICtrlCreateCombo("2", 72, 144, 49, 25) ;Button Skill 2 input

GUICtrlSetData(-1,$ListB1,"2")

$T2Input = GUICtrlCreateInput("3", 120, 143, 49, 22) ;Time Skill 2 input

$Label10 = GUICtrlCreateLabel("s", 172, 148, 9, 17)

$StopAll = GUICtrlCreateButton("Stop All", 88, 168, 91, 25, 0) ;Button Stop all

$TabSheet2 = GUICtrlCreateTabItem("About")

$Label11 = GUICtrlCreateLabel("Copyright Water102", 4, 64, 98, 17)

$Label12 = GUICtrlCreateLabel("Tool for PW v 2.3", 4, 32, 153, 19)

GUICtrlSetFont(-1, 15, 800, 0, "Times New Roman")

$Label13 = GUICtrlCreateLabel("Email help: trevor102102@gmail.com", 4, 96, 179, 17)

$Label14 = GUICtrlCreateLabel("Yahoo : water_102102@yahoo.com", 4, 80, 175, 17)

$Pic1 = GUICtrlCreatePic("water-flame-fantasy03.jpg", 3, 112, 180, 84)

$Label15 = GUICtrlCreateLabel("14/7/2007", 120, 52, 51, 17)

GUICtrlCreateTabItem("")

$MenuItem1 = GUICtrlCreateMenu("&HotKeys")

$MenuItem2 = GUICtrlCreateMenuItem("Auto HP F9", $MenuItem1)

$MenuItem3 = GUICtrlCreateMenuItem("Auto MP F10", $MenuItem1)

$MenuItem4 = GUICtrlCreateMenuItem("Pickup Item F11", $MenuItem1)

$MenuItem5 = GUICtrlCreateMenuItem("Skill 1 Alt + 1", $MenuItem1)

$MenuItem6 = GUICtrlCreateMenuItem("Skill 2 Alt + 2", $MenuItem1)

$MenuItem7 = GUICtrlCreateMenuItem("Start or Stop all Alt + S", $MenuItem1)

$MenuItem8 = GUICtrlCreateMenuItem("Change name Alt + C", $MenuItem1)

$MenuItem9 = GUICtrlCreateMenuItem("Show or hide PW Shift + Alf + H", $MenuItem1)

$MenuItem10 = GUICtrlCreateMenuItem("Show or hide this tool Alt + H", $MenuItem1)

$MenuItem11 = GUICtrlCreateMenuItem("Quit Alt + Q", $MenuItem1)

GUISetState(@SW_SHOW)

$Form2 = GUICreate("Set Password", 120, 54, 395, 300,$WS_POPUP,)

GUISetBkColor(0xFFFFFF)

$InputPassword = GUICtrlCreateInput("", 0, 0, 120, 27, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))

$SetPassword = GUICtrlCreateButton("Set Password", 0, 27, 120, 27, 0)

GUISetState(@SW_HIDE)

$Form3 = GUICreate("Password", 120, 50, 395, 300,$WS_POPUP,)

GUISetBkColor(0xFFFFFF)

$InputYourPassword = GUICtrlCreateInput("", 0, 0, 120, 27, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))

$Show = GUICtrlCreateButton("Show", 0, 27, 120, 25, 0)

GUISetState(@SW_HIDE)

;------------------------------------------------Code------------------------------------------------

While 1

$nMsg = GUIGetMsg()

$FName = GUICtrlRead($FNInput)

$Now = @SEC

If WinActive($FName) Then

If $KeyHP = True or $KeyMP = True Then ;Auto HPMP

If PixelGetColor($xHP,120) = 0 or PixelGetColor($xHP,127) = 0 Then

if $LastHP >= 55 Then

$Now = $Now + 60

EndIf

$NextHP = $LastHP + 5

if $Now >= $NextHP Then

PressButton($HPButton)

$LastHP = @SEC

EndIf

EndIf

If PixelGetColor($xMP,135) = 0 or PixelGetColor($xHP,142) = 0 Then

if $LastMP >= 55 Then

$Now = $Now + 60

EndIf

$NextMP = $LastMP + 5

if $Now >= $NextMP Then

PressButton($MPButton)

$LastMP = @SEC

EndIf

EndIf

EndIf

If $KeyS2 = True or $KeyS1 = True Then ;Auto Skill

If $LastS2 >= (60 - $Time2) Then

$Now = $Now + 60

EndIf

$NextS2 = $LastS2 + $Time2

If $Now >= $NextS2 Then

PressButton($ButtonS2)

$LastS2 = @SEC

EndIf

If $LastS1 >= (60 - $Time1) Then

$Now = $Now + 60

EndIf

$NextS1 = $LastS1 + $Time1

If $Now >= $NextS1 Then

PressButton($ButtonS1)

$LastS1 = @SEC

EndIf

EndIf

EndIf

If $KeyP = True Then ;Auto PickupItem

if $LastP = 59 Then

$Now = $Now + 60

EndIf

$NextP = $LastP + 1

If $Now >= $NextP then

WinActive($FName)

PressButton($BPickup)

$LastP = @SEC

EndIf

EndIf

Switch $nMsg

Case $MenuItem2

AutoHP()

Case $MenuItem3

AutoMP()

Case $MenuItem4

AutoPickup()

Case $MenuItem5

Skill1()

Case $MenuItem6

Skill2()

Case $MenuItem7

StartOrStopAll()

Case $MenuItem8

ChangeName()

Case $MenuItem9

HideAndShow()

Case $SetPassword

$Password = _StringEncrypt(1,GUICtrlRead($InputPassword),'Wate r102',3)

IniWrite("Information.ini","Information", "Password", $Password)

GUISetState(@SW_HIDE,$Form2)

WriteText("Hide " & $FName & ".")

WinSetState($FName, "", @SW_HIDE)

Case $Show

$OldPassword = _StringEncrypt(0,IniRead("Information.ini","Inform ation", "Password", "Không có password."),'Water102',3)

$YourPassword=GUICtrlRead($InputYourPassword)

If $YourPassword = $OldPassword Then

GUISetState(@SW_HIDE,$Form3)

WinSetState($FName, "", @SW_SHOW)

Else

ToolTip('Your password false!!!',395 ,300,"(o_O)")

Sleep(1000)

ToolTip("")

GUISetState(@SW_SHOW,$Form3)

EndIf

Case $MenuItem10

SHASS()

Case $MenuItem11

quit()

Case $StartAll

$KeySAOSA = False

StartOrStopAll()

Case $StopAll

$KeySAOSA = True

StartOrStopAll()

Case $GUI_EVENT_CLOSE

quit()

EndSwitch

WEnd

;------------------------------------------------Function--------------------------------------------

Func read()

$HPButton = GUICtrlRead($BHPInput)

$MPButton = GUICtrlRead($BMPInput)

$HPPer = GUICtrlRead($PHPInput)

$MPPer = GUICtrlRead($PMPInput)

$xHP = Int(1.39*$HPPer + 240)

$xMP = Int(1.39*$MPPer + 240)

$BPickup = GUICtrlRead($BPInput)

$ButtonS1 = GUICtrlRead($BS1Input)

$ButtonS2 = GUICtrlRead($BS2Input)

$Time1 = GUICtrlRead($T1Input)

$Time2 = GUICtrlRead($T2Input)

EndFunc

Func StartOrStopAll()

$KeySAOSA = Not $KeySAOSA

If $KeySAOSA = True Then

read()

$KeyHP = True

$KeyMP = True

$KeyP = True

$KeyS1 = True

$KeyS2 = True

WriteText("Start all.")

Else

$KeyHP = False

$KeyMP = False

$KeyP = False

$KeyS1 = False

$KeyS2 = False

WriteText("Stop all.")

EndIf

EndFunc

Func ChangeName()

WinSetTitle("Element Client", "", $FName)

EndFunc

Func HideAndShow()

$KeyHAS = not $KeyHAS

If $KeyHAS = True Then

GUISetState(@SW_SHOW,$Form2)

Else

GUISetState(@SW_SHOW,$Form3)

EndIf

EndFunc

Func SHASS()

$KeySHASS = not $KeySHASS

If $KeySHASS = True Then

WinSetState("Tool for PW", "", @SW_HIDE)

Else

WinSetState("Tool for PW", "", @SW_SHOW)

EndIf

EndFunc

Func WriteText($alert)

ToolTip($alert,362,371,"(:))")

Sleep(1000)

ToolTip("")

EndFunc

Func AutoHP()

$KeyHP = Not $KeyHP

If $KeyHP = True Then

$HPButton = GUICtrlRead($BHPInput)

$HPPer = GUICtrlRead($PHPInput)

$xHP = Int(1.39*$HPPer + 240)

WriteText("Auto HP Start.")

Else

WriteText("Auto HP Stop.")

EndIf

EndFunc

Func AutoMP()

$KeyMP = Not $KeyMP

If $KeyMP = True Then

$MPButton = GUICtrlRead($BMPInput)

$MPPer = GUICtrlRead($PMPInput)

$xMP = Int(1.39*$MPPer + 240)

WriteText("Auto MP Start.")

Else

WriteText("Auto MP Stop.")

EndIf

EndFunc

Func AutoPickup()

$KeyP = Not $KeyP

If $KeyP = True Then

$BPickup = GUICtrlRead($BPInput)

WriteText("Auto PickUp Start.")

Else

WriteText("Auto PickUp Stop.")

EndIf

EndFunc

Func Skill1()

$KeyS1 = Not $KeyS1

If $KeyS1 = True Then

$ButtonS1 = GUICtrlRead($BS1Input)

$Time1 = GUICtrlRead($T1Input)

WriteText("Auto Skill 1 Start.")

Else

WriteText("Auto Skill 1 Stop.")

EndIf

EndFunc

Func Skill2()

$KeyS2 = Not $KeyS2

If $KeyS2 = True Then

$ButtonS2 = GUICtrlRead($BS2Input)

$Time2 = GUICtrlRead($T2Input)

WriteText("Auto Skill 2 Start.")

Else

WriteText("Auto Skill 2 Stop.")

EndIf

EndFunc

Func PressButton($Button)

$Button = "{" & $Button & "}"

WinActive($FName)

Send($Button)

EndFunc

Func Quit()

WriteText("Bye bye!!")

Exit

EndFunc

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Nothing changed but variable declarations are cleaner :)

Sorry if i got your hopes up.

Youll also have to change your WiteText($alert) Function because the forums made it look like a smiley

#include <GUIConstants.au3>
#include <string.au3>
#NoTrayIcon
Dim $KeyHP, $KeyMP, $KeySAOSA, $KeyP, $KeyHAS, $KeySHASS, $KeyS1, $KeyS2 = False
Dim $FName
Dim $HPPer, $MPPer, $HPButton, $MPButton, $BPickup, $xHP, $xMP, $ButtonS1, $ButtonS2, $Button
Dim $LastHP, $LastMP, $LastP, $LastS1, $LastS2, $NextHP, $NextMP, $NextP, $NextS1, $NextS2, $Time1, $Time2, $Now =0
Dim $ListB1 = "1|2|3|4|5|6|F1|F2|F3|F4|F5|F6|F7|F8" 
Dim $ListB2 = "10|20|30|40|50|60|70|80|90"

;------------------------------------------------Hotkey----------------------------------------------
HotKeySet("{F9}","AutoHP")
HotKeySet("{F10}","AutoMP")
HotKeySet("{F11}","AutoPickup")
HotKeySet("!1","Skill1")
HotKeySet("!2","Skill2")
HotKeySet("!s","StartOrStopAll")
HotKeySet("!c","ChangeName")
HotKeySet("!+h","HideAndShow")
HotKeySet("!h","SHASS")
HotKeySet("!q","Quit")

;------------------------------------------------Forn------------------------------------------------
$Form1 = GUICreate("Tool for PW", 186, 219, 2, 2)
$Tab1 = GUICtrlCreateTab(0, 0, 185, 199)
$TabSheet1 = GUICtrlCreateTabItem("Option")
$Label1 = GUICtrlCreateLabel("Auto MP", 8, 76, 45, 17)
$Label2 = GUICtrlCreateLabel("%", 172, 76, 12, 17)
$Label3 = GUICtrlCreateLabel("Pickup Item", 8, 100, 60, 17)
$Label5 = GUICtrlCreateLabel("Skill 1", 8, 124, 32, 17)
$Label7 = GUICtrlCreateLabel("Auto HP", 8, 52, 44, 17)
$Label8 = GUICtrlCreateLabel("%", 172, 52, 12, 17)
$BHPInput = GUICtrlCreateCombo("", 72, 48, 49, 25) ;Button HP input
GUICtrlSetData(-1,$ListB1,"F8")
$BMPInput = GUICtrlCreateCombo("", 72, 72, 49, 25) ;Button MP input
GUICtrlSetData(-1,$ListB1,"F7")
$PHPInput = GUICtrlCreateCombo("", 120, 48, 49, 25) ;Percent HP input
GUICtrlSetData(-1,$ListB2,"80")
$PMPInput = GUICtrlCreateCombo("", 120, 72, 49, 25) ;Percent MP input
GUICtrlSetData(-1,$ListB2,"30")
$BPInput = GUICtrlCreateCombo("", 72, 96, 97, 25) ;Button Pickup input
GUICtrlSetData(-1,$ListB1,"3")
$BS1Input = GUICtrlCreateCombo("", 72, 120, 49, 25) ;Button Skill 1 input
GUICtrlSetData(-1,$ListB1,"1")
$T1Input = GUICtrlCreateInput("2", 120, 120, 49, 22) ;Time Skill 1 input
$Label9 = GUICtrlCreateLabel("s", 172, 124, 9, 17)
$StartAll = GUICtrlCreateButton("Start All", 8, 168, 83, 25, 0) ;Button Start all
$Label4 = GUICtrlCreateLabel("Focus Name", 8, 30, 64, 17)
$FNInput = GUICtrlCreateInput("Element Client", 72, 26, 110, 21) ;Focus name input
$Label6 = GUICtrlCreateLabel("Skill 2", 8, 148, 32, 17)
$BS2Input = GUICtrlCreateCombo("2", 72, 144, 49, 25) ;Button Skill 2 input
GUICtrlSetData(-1,$ListB1,"2")
$T2Input = GUICtrlCreateInput("3", 120, 143, 49, 22) ;Time Skill 2 input
$Label10 = GUICtrlCreateLabel("s", 172, 148, 9, 17)
$StopAll = GUICtrlCreateButton("Stop All", 88, 168, 91, 25, 0) ;Button Stop all
$TabSheet2 = GUICtrlCreateTabItem("About")
$Label11 = GUICtrlCreateLabel("Copyright Water102", 4, 64, 98, 17)
$Label12 = GUICtrlCreateLabel("Tool for PW v 2.3", 4, 32, 153, 19)
GUICtrlSetFont(-1, 15, 800, 0, "Times New Roman")
$Label13 = GUICtrlCreateLabel("Email help: trevor102102@gmail.com", 4, 96, 179, 17)
$Label14 = GUICtrlCreateLabel("Yahoo : water_102102@yahoo.com", 4, 80, 175, 17)
$Pic1 = GUICtrlCreatePic("water-flame-fantasy03.jpg", 3, 112, 180, 84)
$Label15 = GUICtrlCreateLabel("14/7/2007", 120, 52, 51, 17)
GUICtrlCreateTabItem("")
$MenuItem1 = GUICtrlCreateMenu("&HotKeys")
$MenuItem2 = GUICtrlCreateMenuItem("Auto HP F9", $MenuItem1)
$MenuItem3 = GUICtrlCreateMenuItem("Auto MP F10", $MenuItem1)
$MenuItem4 = GUICtrlCreateMenuItem("Pickup Item F11", $MenuItem1)
$MenuItem5 = GUICtrlCreateMenuItem("Skill 1 Alt + 1", $MenuItem1)
$MenuItem6 = GUICtrlCreateMenuItem("Skill 2 Alt + 2", $MenuItem1)
$MenuItem7 = GUICtrlCreateMenuItem("Start or Stop all Alt + S", $MenuItem1)
$MenuItem8 = GUICtrlCreateMenuItem("Change name Alt + C", $MenuItem1)
$MenuItem9 = GUICtrlCreateMenuItem("Show or hide PW Shift + Alf + H", $MenuItem1)
$MenuItem10 = GUICtrlCreateMenuItem("Show or hide this tool Alt + H", $MenuItem1)
$MenuItem11 = GUICtrlCreateMenuItem("Quit Alt + Q", $MenuItem1)
GUISetState(@SW_SHOW)

$Form2 = GUICreate("Set Password", 120, 54, 395, 300,$WS_POPUP,)
GUISetBkColor(0xFFFFFF)
$InputPassword = GUICtrlCreateInput("", 0, 0, 120, 27, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
$SetPassword = GUICtrlCreateButton("Set Password", 0, 27, 120, 27, 0)
GUISetState(@SW_HIDE)

$Form3 = GUICreate("Password", 120, 50, 395, 300,$WS_POPUP,)
GUISetBkColor(0xFFFFFF)
$InputYourPassword = GUICtrlCreateInput("", 0, 0, 120, 27, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
$Show = GUICtrlCreateButton("Show", 0, 27, 120, 25, 0)
GUISetState(@SW_HIDE)
;------------------------------------------------Code------------------------------------------------

While 1
$nMsg = GUIGetMsg()
$FName = GUICtrlRead($FNInput)
$Now = @SEC
If WinActive($FName) Then 
If $KeyHP = True or $KeyMP = True Then ;Auto HPMP
If PixelGetColor($xHP,120) = 0 or PixelGetColor($xHP,127) = 0 Then
if $LastHP >= 55 Then
$Now = $Now + 60
EndIf
$NextHP = $LastHP + 5
if $Now >= $NextHP Then
PressButton($HPButton)
$LastHP = @SEC
EndIf
EndIf
If PixelGetColor($xMP,135) = 0 or PixelGetColor($xHP,142) = 0 Then 
if $LastMP >= 55 Then
$Now = $Now + 60
EndIf 
$NextMP = $LastMP + 5
if $Now >= $NextMP Then
PressButton($MPButton)
$LastMP = @SEC
EndIf
EndIf
EndIf 
If $KeyS2 = True or $KeyS1 = True Then ;Auto Skill
If $LastS2 >= (60 - $Time2) Then
$Now = $Now + 60
EndIf 
$NextS2 = $LastS2 + $Time2
If $Now >= $NextS2 Then
PressButton($ButtonS2)
$LastS2 = @SEC
EndIf 
If $LastS1 >= (60 - $Time1) Then
$Now = $Now + 60
EndIf 
$NextS1 = $LastS1 + $Time1
If $Now >= $NextS1 Then
PressButton($ButtonS1)
$LastS1 = @SEC
EndIf 
EndIf 
EndIf 

If $KeyP = True Then ;Auto PickupItem
if $LastP = 59 Then
$Now = $Now + 60
EndIf 
$NextP = $LastP + 1
If $Now >= $NextP then
WinActive($FName)
PressButton($BPickup)
$LastP = @SEC
EndIf 
EndIf

Switch $nMsg
Case $MenuItem2
AutoHP()
Case $MenuItem3
AutoMP()
Case $MenuItem4
AutoPickup()
Case $MenuItem5
Skill1()
Case $MenuItem6
Skill2()
Case $MenuItem7
StartOrStopAll()
Case $MenuItem8
ChangeName()
Case $MenuItem9 
HideAndShow()
Case $SetPassword
$Password = _StringEncrypt(1,GUICtrlRead($InputPassword),'Wate r102',3)
IniWrite("Information.ini","Information", "Password", $Password)
GUISetState(@SW_HIDE,$Form2)
WriteText("Hide " & $FName & ".")
WinSetState($FName, "", @SW_HIDE)
Case $Show
$OldPassword = _StringEncrypt(0,IniRead("Information.ini","Inform ation", "Password", "Không có password."),'Water102',3) 
$YourPassword=GUICtrlRead($InputYourPassword) 
If $YourPassword = $OldPassword Then
GUISetState(@SW_HIDE,$Form3)
WinSetState($FName, "", @SW_SHOW)
Else
ToolTip('Your password false!!!',395 ,300,"(o_O)") 
Sleep(1000) 
ToolTip("") 
GUISetState(@SW_SHOW,$Form3)
EndIf 
Case $MenuItem10 
SHASS()
Case $MenuItem11
quit()
Case $StartAll
$KeySAOSA = False
StartOrStopAll()
Case $StopAll
$KeySAOSA = True
StartOrStopAll()
Case $GUI_EVENT_CLOSE
quit()
EndSwitch
WEnd

;------------------------------------------------Function--------------------------------------------
Func read()
$HPButton = GUICtrlRead($BHPInput)
$MPButton = GUICtrlRead($BMPInput)
$HPPer = GUICtrlRead($PHPInput)
$MPPer = GUICtrlRead($PMPInput)
$xHP = Int(1.39*$HPPer + 240)
$xMP = Int(1.39*$MPPer + 240)
$BPickup = GUICtrlRead($BPInput)
$ButtonS1 = GUICtrlRead($BS1Input)
$ButtonS2 = GUICtrlRead($BS2Input)
$Time1 = GUICtrlRead($T1Input)
$Time2 = GUICtrlRead($T2Input)

EndFunc 

Func StartOrStopAll()
$KeySAOSA = Not $KeySAOSA
If $KeySAOSA = True Then
read()
$KeyHP = True
$KeyMP = True
$KeyP = True
$KeyS1 = True
$KeyS2 = True
WriteText("Start all.") 
Else 
$KeyHP = False
$KeyMP = False
$KeyP = False
$KeyS1 = False
$KeyS2 = False
WriteText("Stop all.") 
EndIf 
EndFunc

Func ChangeName()
WinSetTitle("Element Client", "", $FName)
EndFunc

Func HideAndShow()
$KeyHAS = not $KeyHAS
If $KeyHAS = True Then
GUISetState(@SW_SHOW,$Form2)
Else
GUISetState(@SW_SHOW,$Form3)
EndIf
EndFunc

Func SHASS()
$KeySHASS = not $KeySHASS
If $KeySHASS = True Then
WinSetState("Tool for PW", "", @SW_HIDE)
Else
WinSetState("Tool for PW", "", @SW_SHOW)
EndIf
EndFunc

Func WriteText($alert) 
ToolTip($alert,362,371,"()") 
Sleep(1000) 
ToolTip("") 
EndFunc 

Func AutoHP() 
$KeyHP = Not $KeyHP 
If $KeyHP = True Then
$HPButton = GUICtrlRead($BHPInput)
$HPPer = GUICtrlRead($PHPInput)
$xHP = Int(1.39*$HPPer + 240)
WriteText("Auto HP Start.") 
Else 
WriteText("Auto HP Stop.") 
EndIf
EndFunc 

Func AutoMP() 
$KeyMP = Not $KeyMP 
If $KeyMP = True Then
$MPButton = GUICtrlRead($BMPInput)
$MPPer = GUICtrlRead($PMPInput)
$xMP = Int(1.39*$MPPer + 240)
WriteText("Auto MP Start.") 
Else 
WriteText("Auto MP Stop.") 
EndIf 
EndFunc 

Func AutoPickup() 
$KeyP = Not $KeyP 
If $KeyP = True Then
$BPickup = GUICtrlRead($BPInput)
WriteText("Auto PickUp Start.") 
Else 
WriteText("Auto PickUp Stop.") 
EndIf 
EndFunc 

Func Skill1()
$KeyS1 = Not $KeyS1 
If $KeyS1 = True Then
$ButtonS1 = GUICtrlRead($BS1Input)
$Time1 = GUICtrlRead($T1Input)
WriteText("Auto Skill 1 Start.") 
Else 
WriteText("Auto Skill 1 Stop.") 
EndIf 
EndFunc 

Func Skill2()
$KeyS2 = Not $KeyS2
If $KeyS2 = True Then
$ButtonS2 = GUICtrlRead($BS2Input)
$Time2 = GUICtrlRead($T2Input)
WriteText("Auto Skill 2 Start.") 
Else 
WriteText("Auto Skill 2 Stop.") 
EndIf 
EndFunc 

Func PressButton($Button)
$Button = "{" & $Button & "}"
WinActive($FName)
Send($Button)
EndFunc

Func Quit()
WriteText("Bye bye!!") 
Exit
EndFunc
Edited by Mast3rpyr0

Share this post


Link to post
Share on other sites

Thank you for streamlining, and yes I saw the little :)

Again if anyone can help I would appreciate it. I've tried putting 3 more skills onto another form but still have the problem of making the delays from @SEC to @MIN or the actual use of both.

Thank you again.

Share this post


Link to post
Share on other sites

Here is the updated source. I still do not know how to configure the @SEC to @MIN arguments to allow a skill delay of over 60 seconds without conflicting with the @SEC commands. Even if one of the Skill boxes can be converted to a @MIN without conflicting with the current @SEC's.

Thank you all for reading. Again any help will be much appreciated.

[autoit]#include <GUIConstants.au3>

#include <string.au3>

#NoTrayIcon

Dim $KeyHP, $KeyMP, $KeySAOSA, $KeyP, $KeyHAS, $KeySHASS, $KeyS1, $KeyS2, $KeyS3, $KeyS4, $KeyS5 = False

Dim $FName

Dim $HPPer, $MPPer, $HPButton, $MPButton, $BPickup, $xHP, $xMP, $ButtonS1, $ButtonS2, $ButtonS3, $ButtonS4, $ButtonS5, $Button

Dim $LastHP, $LastMP, $LastP, $LastS1, $LastS2, $LastS3, $LastS4, $LastS5, $NextHP, $NextMP, $NextP, $NextS1, $NextS2, $NextS3, $NextS4, $NextS5, $Time1, $Time2, $Time3, $Time4, $Time5, $Now = 0

Dim $ListB1 = "1|2|3|4|5|6|F1|F2|F3|F4|F5|F6|F7|F8"

Dim $ListB2 = "10|20|30|40|50|60|70|80|90"

;------------------------------------------------Hotkey----------------------------------------------

HotKeySet("{F9}", "AutoHP")

HotKeySet("{F10}", "AutoMP")

HotKeySet("{F11}", "AutoPickup")

HotKeySet("!1", "Skill1")

HotKeySet("!2", "Skill2")

HotKeySet("!3", "Skill3")

HotKeySet("!4", "Skill4")

HotKeySet("!5", "Skill5")

HotKeySet("!s", "StartOrStopAll")

HotKeySet("!c", "ChangeName")

HotKeySet("!+h", "HideAndShow")

HotKeySet("!h", "SHASS")

HotKeySet("!q", "Quit")

;------------------------------------------------Form------------------------------------------------

$Form1 = GUICreate("Tool for PW", 200, 320, 2, 2)

$Tab1 = GUICtrlCreateTab(0, 0, 199, 300)

$TabSheet1 = GUICtrlCreateTabItem("Option")

$Label1 = GUICtrlCreateLabel("Focus Name", 8, 30, 64, 17)

$FNInput = GUICtrlCreateInput("Element Client", 72, 26, 110, 21) ;Focus name input

$Label2 = GUICtrlCreateLabel("Auto HP", 8, 52, 44, 17)

$BHPInput = GUICtrlCreateCombo("", 72, 48, 49, 25) ;Button HP input

GUICtrlSetData(-1, $ListB1, "F8")

$Label3 = GUICtrlCreateLabel("%", 172, 52, 12, 17)

$PHPInput = GUICtrlCreateCombo("", 120, 48, 49, 25) ;Percent HP input

GUICtrlSetData(-1, $ListB2, "80")

$Label4 = GUICtrlCreateLabel("Auto MP", 8, 76, 45, 17)

$BMPInput = GUICtrlCreateCombo("", 72, 72, 49, 25) ;Button MP input

GUICtrlSetData(-1, $ListB1, "F7")

$Label5 = GUICtrlCreateLabel("%", 172, 76, 12, 17)

$PMPInput = GUICtrlCreateCombo("", 120, 72, 49, 25) ;Percent MP input

GUICtrlSetData(-1, $ListB2, "30")

$Label6 = GUICtrlCreateLabel("Pickup Item", 8, 100, 60, 17)

$Label7 = GUICtrlCreateLabel("Skill 1", 8, 124, 32, 17)

$BPInput = GUICtrlCreateCombo("", 72, 96, 97, 25) ;Button Pickup input

GUICtrlSetData(-1, $ListB1, "F3")

$BS1Input = GUICtrlCreateCombo("", 72, 120, 49, 25) ;Button Skill 1 input

GUICtrlSetData(-1, $ListB1, "F1")

$T1Input = GUICtrlCreateInput("2", 120, 120, 49, 22) ;Time Skill 1 input

$Label8 = GUICtrlCreateLabel("s", 172, 124, 9, 17)

$Label9 = GUICtrlCreateLabel("Skill 2", 8, 148, 32, 17)

$BS2Input = GUICtrlCreateCombo("2", 72, 144, 49, 25) ;Button Skill 2 input

GUICtrlSetData(-1, $ListB1, "F2")

$T2Input = GUICtrlCreateInput("3", 120, 144, 49, 22) ;Time Skill 2 input

$Label10 = GUICtrlCreateLabel("s", 172, 148, 9, 17)

$Label11 = GUICtrlCreateLabel("Skill 3", 8, 168, 32, 17)

$BS3Input = GUICtrlCreateCombo("", 72, 168, 49, 25) ;Button Skill 3 input

GUICtrlSetData(-1, $ListB1, "F4")

$T3Input = GUICtrlCreateInput("4", 120, 168, 49, 22) ;Time Skill 3 input

$Label12 = GUICtrlCreateLabel("s", 172, 168, 9, 17)

$Label13 = GUICtrlCreateLabel("Skill 4", 8, 192, 32, 17)

$BS4Input = GUICtrlCreateCombo("", 72, 192, 49, 25) ;Button Skill 4 input

GUICtrlSetData(-1, $ListB1, "F5")

$T4Input = GUICtrlCreateInput("5", 120, 192, 49, 22) ;Time Skill 4 input

$Label14 = GUICtrlCreateLabel("s", 172, 192, 9, 17)

$Label15 = GUICtrlCreateLabel("Skill 5", 8, 216, 32, 17)

$BS5Input = GUICtrlCreateCombo("", 72, 216, 49, 25) ;Button Skill 5 input

GUICtrlSetData(-1, $ListB1, "F6")

$T5Input = GUICtrlCreateInput("6", 120, 216, 49, 22) ;Time Skill 5 input

$Label16 = GUICtrlCreateLabel("s", 172, 216, 9, 17)

$StartAll = GUICtrlCreateButton("Start All", 8, 240, 83, 25, 0) ;Button Start all

$StopAll = GUICtrlCreateButton("Stop All", 88, 240, 91, 25, 0) ;Button Stop all

$TabSheet2 = GUICtrlCreateTabItem("About")

$Label17 = GUICtrlCreateLabel("Script edited by 0L0", 4, 64, 98, 17)

$Label18 = GUICtrlCreateLabel("Tool for PW v 2.3a", 4, 32, 153, 19)

GUICtrlSetFont(-1, 12, 800, 0, "Times New Roman")

$Label19 = GUICtrlCreateLabel("Email help: ", 4, 96, 179, 17)

$Label20 = GUICtrlCreateLabel("Yahoo : ", 4, 80, 175, 17)

$Pic1 = GUICtrlCreatePic("water-flame-fantasy03.jpg", 3, 112, 180, 84)

$Label21 = GUICtrlCreateLabel("22/8/2007", 120, 52, 51, 17)

GUICtrlCreateTabItem("")

$MenuItem1 = GUICtrlCreateMenu("&HotKeys")

$MenuItem2 = GUICtrlCreateMenuItem("Auto HP F9", $MenuItem1)

$MenuItem3 = GUICtrlCreateMenuItem("Auto MP F10", $MenuItem1)

$MenuItem4 = GUICtrlCreateMenuItem("Pickup Item F11", $MenuItem1)

$MenuItem5 = GUICtrlCreateMenuItem("Skill 1 Alt + 1", $MenuItem1)

$MenuItem6 = GUICtrlCreateMenuItem("Skill 2 Alt + 2", $MenuItem1)

$MenuItem7 = GUICtrlCreateMenuItem("Skill 3 Alt + 3", $MenuItem1)

$MenuItem8 = GUICtrlCreateMenuItem("Skill 4 Alt + 4", $MenuItem1)

$MenuItem9 = GUICtrlCreateMenuItem("Skill 5 Alt + 5", $MenuItem1)

$MenuItem10 = GUICtrlCreateMenuItem("Start or Stop all Alt + S", $MenuItem1)

$MenuItem11 = GUICtrlCreateMenuItem("Change name Alt + C", $MenuItem1)

$MenuItem12 = GUICtrlCreateMenuItem("Show or hide PW Shift + Alf + H", $MenuItem1)

$MenuItem13 = GUICtrlCreateMenuItem("Show or hide this tool Alt + H", $MenuItem1)

$MenuItem14 = GUICtrlCreateMenuItem("Quit Alt + Q", $MenuItem1)

GUISetState(@SW_SHOW)

$Form2 = GUICreate("Set Password", 120, 54, 395, 300, $WS_POPUP,)

GUISetBkColor(0xFFFFFF)

$InputPassword = GUICtrlCreateInput("", 0, 0, 120, 27, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))

$SetPassword = GUICtrlCreateButton("Set Password", 0, 27, 120, 27, 0)

GUISetState(@SW_HIDE)

$Form3 = GUICreate("Password", 120, 50, 395, 300, $WS_POPUP,)

GUISetBkColor(0xFFFFFF)

$InputYourPassword = GUICtrlCreateInput("", 0, 0, 120, 27, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))

$Show = GUICtrlCreateButton("Show", 0, 27, 120, 25, 0)

GUISetState(@SW_HIDE)

;------------------------------------------------Code------------------------------------------------

While 1

$nMsg = GUIGetMsg()

$FName = GUICtrlRead($FNInput)

$Now = @SEC

If WinActive($FName) Then

If $KeyHP = True Or $KeyMP = True Then ;Auto HPMP

If PixelGetColor($xHP, 120) = 0 Or PixelGetColor($xHP, 127) = 0 Then

If $LastHP >= 55 Then

$Now = $Now + 60

EndIf

$NextHP = $LastHP + 5

If $Now >= $NextHP Then

PressButton($HPButton)

$LastHP = @SEC

EndIf

EndIf

If PixelGetColor($xMP, 135) = 0 Or PixelGetColor($xHP, 142) = 0 Then

If $LastMP >= 55 Then

$Now = $Now + 60

EndIf

$NextMP = $LastMP + 5

If $Now >= $NextMP Then

PressButton($MPButton)

$LastMP = @SEC

EndIf

EndIf

EndIf

If $KeyS2 = True Or $KeyS1 = True Or $KeyS3 = True Or $KeyS4 = True Or $KeyS5 = True Then ;Auto Skill

If $LastS1 >= (60 - $Time1) Then

$Now = $Now + 60

EndIf

$NextS1 = $LastS1 + $Time1

If $Now >= $NextS1 Then

If $LastS2 >= (60 - $Time2) Then

$Now = $Now + 60

EndIf

$NextS2 = $LastS2 + $Time2

If $Now >= $NextS2 Then

PressButton($ButtonS2)

$LastS2 = @SEC

EndIf

If $LastS3 >= (60 - $Time3) Then

$Now = $Now + 60

EndIf

$NextS3 = $LastS3 + $Time3

If $Now >= $NextS3 Then

PressButton($ButtonS3)

$LastS3 = @SEC

EndIf

If $LastS4 >= (60 - $Time4) Then

$Now = $Now + 60

EndIf

$NextS4 = $LastS4 + $Time4

If $Now >= $NextS4 Then

PressButton($ButtonS4)

$LastS4 = @SEC

EndIf

If $LastS5 >= (60 - $Time5) Then

$Now = $Now + 60

EndIf

$NextS5 = $LastS5 + $Time5

If $Now >= $NextS5 Then

PressButton($ButtonS5)

$LastS5 = @SEC

PressButton($ButtonS1)

$LastS1 = @SEC

EndIf

EndIf

EndIf

EndIf

If $KeyP = True Then ;Auto PickupItem

If $LastP = 59 Then

$Now = $Now + 60

EndIf

$NextP = $LastP + 1

If $Now >= $NextP Then

WinActive($FName)

PressButton($BPickup)

$LastP = @SEC

EndIf

EndIf

Switch $nMsg

Case $MenuItem2

AutoHP()

Case $MenuItem3

AutoMP()

Case $MenuItem4

AutoPickup()

Case $MenuItem5

Skill1()

Case $MenuItem6

Skill2()

Case $MenuItem7

Skill3()

Case $MenuItem8

Skill4()

Case $MenuItem9

Skill5()

Case $MenuItem10

StartOrStopAll()

Case $MenuItem11

ChangeName()

Case $MenuItem12

HideAndShow()

Case $SetPassword

$Password = _StringEncrypt(1, GUICtrlRead($InputPassword), 'Wate r102', 3)

IniWrite("Information.ini", "Information", "Password", $Password)

GUISetState(@SW_HIDE, $Form2)

WriteText("Hide " & $FName & ".")

WinSetState($FName, "", @SW_HIDE)

Case $Show

$OldPassword = _StringEncrypt(0, IniRead("Information.ini", "Inform ation", "Password", "Kh

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

ive tried your script... and it has a delay problems... im still trying to figure it out but im only a newbie on autoit scripts.

i bet alot of people in this forum can help but the sad thing is they dont have the game thats why they cant try....

anyway the game is new... if the game will reach their pc's then they can eventually help us with this problem...

i dunno bout the pixel search on the hp bar if its working fine or if its the delay that has the problem...

its really hard to use autoit in this game because the game is so complicated.... we even have to click the monster in order to lock it down onlike other games that you can just use tab on searching for monster... maybe pixel search will be the remedy for this.

Q: is there a code in order for your mouse to click any moving object inside the game...?

i found this... you may want to try adding this..

$Pixel = PixelSearch ( 0, 0, @DesktopWidth, @DesktopWidth, 0xFFE07E)

If @ERROR Then

;Do something

Else

MouseClick ( "left" , $Pixel[0], $Pixel[1])

EndIf

if not mouse click you may want to try zen recovery...

this is just an idea... i dunno if it can help..

Edited by tubartzzz

Share this post


Link to post
Share on other sites

im really having a hard time in making this thingy to function better.... like what ive said to you olo noobs are even better than me in making scripts..... how sad.... lets w8 for perfect world international we cant tell what will happen...^^

Share this post


Link to post
Share on other sites

The code is fine except some minor compiling errror.

But it does only passively kill monster. Currently, I am running a perfect world bot 24hours / day , and it lvls my char really fast, the only problem is that I need that pc to do other things. Also, your code needs to check pixel to see if the mob you are attacking is dead.

$var = PixelSearch(XofMobSelectionBar,YofMobSelectionBar, XofMobSelectionBar, YofMobSelectionBar, 0, 10) ; 0 is the pure black colour

If Not @error Then

While PixelSearch(XofMobSelectionBar,YofMobSelectionBar, XofMobSelectionBar, YofMobSelectionBar, 0, 10) <>@error

attack(key1, key2, key3)

Wend

For PickItemsCounter = 1 To $PickUpItemsNumber

Send($PickItemKey)

Next

EndIf

Share this post


Link to post
Share on other sites

I currently have a working afk bot bot for pwi it is not my original code however it is modified to fit my needs. as i am not the original author you can look it up on these forums under "Element Client" then you can customize it to fit your needs. if you need further help its all laid out in the forums and i can tell you it works quiet well as ive lvled multiple toons past 50 without detection.

Share this post


Link to post
Share on other sites

Did you get the help you needed if not and you chose not to follow my lead which is fine as i have used this bot as well. look into changing the @sec @min into Timers. @sec commands i belive refer to system time and as such fire at well 60 seconds or less but timers can get long and confusing if your not carefull.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0