Hi SycOn,
Gleich mal am Anfang: 1-Klassige Arbeit! Vielen Dank Dir!
Doch 1 Frage kommt mit auf:
Die .tt6 ist, soviel ich verstanden hab, ein eigener Script. Sowie der Laufweg, der Farmteil und die GUI. Und all diese Scrips werden dann in einem weiterem zusammengeführt (#include usw.)???
Nun ja, wie man es sehen will, es gibt doch noch ein Problem (Hat diesmal aber nicht mit verstehen zu tun)
Und zwar zeigt mir der Dumper zwar die Positionen meiner Maus an, aber bei der 3. und 4. Stelle (wo die MoveTo-Zahlen rausgeschmissen werden sollten) steht mei mir immer x0,000 // y0,000.
Was muss ich machen?
Vorsicht
Die Funktionen GoSell() und GoPlace() habe ich mit Absicht nicht eingebaut, da ihr, wenn ihr alles verstanden habt, selbst dazu in der Lage seien solltet. Auch habe ich mit Absicht nicht die aktuelle Update.ini eingefügt!
Ich weiß dass meiste ist aus dem Beispiel-Bot "geklaut", aber kann mir jmd trotzdem sagen weshalb es nicht funktioniert. (Bin noch Anfänger, also bitte nicht soviele Fachbegriffe verwenden)
Mein Code:
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Start
Main()
EndSwitch
WEnd
Func Main()
While 1
If Guictrlread($Check_Sell) = 1 Then
If Guictrlread($Input_Sell) = $RundenS Then GoSell()
EndIf
If Guictrlread($Check_Place) = 1 Then
If Guictrlread($Input_Place) = $RundenP Then GoPlace()
EndIf
Goout()
Farm()
Wend
EndFunc
#Region Global Variables
; mems compatible to update.ini by __wadim
Const $memx = IniRead("update.ini","SECTION D","POSX","Not found") ; position x
Const $memy = IniRead("update.ini","SECTION D","POSY","Not found") ; position y
Const $memmap = IniRead("update.ini","SECTION D","CHECK_MAP","Not found") ; post=0, load =2, area=1
Const $memnpcidselect = IniRead("update.ini","SECTION D","NPC_ID_SELECT","Not found") ; id of selected object
Const $memnpcidnear = IniRead("update.ini","SECTION D","NPC_ID_NEAR","Not found") ; id of nearest object
Const $memcourse = IniRead("update.ini","SECTION 9-A","CAMCOURSEB","Not found") ; angle of compass/view direction
Const $memdeath = IniRead("update.ini","SECTION 9-A","DEATH","Not found") ; alive = 0 or death = 1
; globals for movement engine
Global $gotox = 0.0, $gotoy = 0.0 , $dist = 0.0, $olddist = 0.0, $angle = 0.0, $increment = 0, $callcnt = 0
Global $client = IniRead("tt6.ini","id","windowName","Guild Wars")
$PID = WinGetProcess($client)
Global $hprocess = _MemoryOpen($PID)
Global $hwnd = WinGetHandle($client)
Global $running = False, $stopCheck = False, $blockCheck = False
Const $pi = 4 * ATan(1)
Global $accelmul = 1.0 ;modify to accelerate or slow down control action
Global $isDead = False ;global status to check if got killed, set to False after recovery or new movement
Global $gotBlocked = False ;global status to check if got blocked, set to False after exception handling
Global $noLoot = False ;global status to temporarily disable looting e.g. in parallel adlib thread
;debug movement
Const $debug_pos = False ;set True to show current movement segment
Const $debug_mov = False ;set True to show left/right control action
;generate inventory access matrix adapt positions in the tt6.ini
Const $invMaxR = 8 ;max number of rows 0..8
Const $invMaxC = 4 ;max number of columns 0..4
Global $invPos[$invMaxC+1] [$invMaxR+1][2];matrix of positions [0]=x, [1]=y
$invPos[0][0][0] = Int(IniRead("tt6.ini","inventory offsets","invPosX00",0))
$invPos[0][0][1] = Int(IniRead("tt6.ini","inventory offsets","invPosY00",0))
$invPos[0][1][1] = Int(IniRead("tt6.ini","inventory offsets","invPosYR1",0))
$invPos[0][2][1] = Int(IniRead("tt6.ini","inventory offsets","invPosYR2",0))
$invPos[0][3][1] = Int(IniRead("tt6.ini","inventory offsets","invPosYR3",0))
$invPos[0][4][1] = Int(IniRead("tt6.ini","inventory offsets","invPosYR4",0))
$invPos[0][5][1] = Int(IniRead("tt6.ini","inventory offsets","invPosYR5",0))
$invPos[0][6][1] = Int(IniRead("tt6.ini","inventory offsets","invPosYR6",0))
$invPos[0][7][1] = Int(IniRead("tt6.ini","inventory offsets","invPosYR7",0))
$invPos[0][8][1] = Int(IniRead("tt6.ini","inventory offsets","invPosYR8",0))
$invPosXdelta = Int(IniRead("tt6.ini","inventory offsets","invPosXdelta",0))
For $ri=1 To 8
$invPos[0][$ri][0] = $invPos[0][0][0] ;x offset of 0 element constant in every row
Next
For $ri=0 To 8
For $ci=1 To 4
$invPos[$ci][$ri][0] = $invPos[0][$ri][0] + $invPosXdelta *$ci ; x offset increases by number of column
$invPos[$ci][$ri][1] = $invPos[0][$ri][1] ; y offset equal to 0 position in every row
Next
Next
;blacklist for CollectLoot
;position 0 contains number of valid entries
Const $CLBlackMax = 50
Global $CLBlackList[$CLBlackMax +1]
$CLBlackList[0] = 0
#EndRegion
#Region Movement Engine
; stop movement
Func StopMoveTo()
if Not $gotBlocked Then
KeySend($ARmovkey)
EndIf
$increment = 0
$callcnt = 0
$running = False
$stopCheck = False
$blockCheck = False
EndFunc
; end movement but keep running e.g. to exit
Func KeepMoveTo()
$increment = 0
$callcnt = 0
$running = False
$stopCheck = False
$blockCheck = False
EndFunc
; disables check if we stopped runnning unintended (eg by cast or knock down)
; note: must be used to protect casts as we try to start running again immediately in auto mode
Func DisableStopCheck()
if $stopCheck Then
$stopCheck = False
EndIf
EndFunc
; enables check again
Func EnableStopCheck()
if ($blockCheck = False) And ($stopCheck = False) Then
$stopCheck = True
EndIf
EndFunc
; calculate rotation angle
Func GetCourse($val)
$i=0
$valL = Abs($val)
While $course_table[$i] < $valL
$i +=1
if $i = 100 Then ;error
ConsoleWrite(StringFormat("GetCourse: bad call: %.4f",$valL))
Exit
EndIf
WEnd
return Int($i * 10 * $accelmul)
EndFunc
; initialise new destination
Func InitDest($dx, $dy, $dcheck = False)
;no movement if we are dead or got blocked
If $isDead Or $gotBlocked Then
Return
EndIf
; set global destination
$gotox = $dx
$gotoy = $dy
if $debug_pos Then
ConsoleWrite(StringFormat("InitDest: %d %d\n",$gotox, $gotoy))
EndIf
; set stop level for angles in relation to distance
if $dist > 2000 Then
$stoplvl = 1.8
Elseif $dist > 1200 Then
$stoplvl = 1.5
Elseif $dist > 700 Then
$stoplvl = 1.2
Elseif $dist > 400 Then
$stoplvl = 0.8
Elseif $dist > 200 Then
$stoplvl = 0.6
Else
$stoplvl = 0.2
EndIf
; calc angle
$angle = ACos(($gotox - $posx)/$dist)
if $gotoy < $posy Then
$angle = -$angle
EndIf
; rotate view to destination
$cnt =0
Do
; transition via q2<->q3 by pseudo course angle
$curcou = _memoryread($memcourse,$hprocess,'float')
if (($angle > $pi/2) And ($curcou < $angle - $pi)) Then
$curcou = 2*$pi + $curcou
EndIf
if (($angle < -$pi/2) And ($curcou > $pi+$angle)) Then
$curcou = -2*$pi + $curcou
EndIf
; big delta -> stop running
if Abs($angle - $curcou) > $stoplvl Then
if $running = True Then
KeySend($ARmovkey)
$running = False
EndIf
EndIf
$accel = GetCourse(Abs($angle - $curcou))
; rotate
if $angle < $curcou Then
KeySend($TRmovkey, "down")
Sleep($accel)
KeySend($TRmovkey, "up")
if $debug_mov = True Then
ConsoleWrite(StringFormat("InitDest: %s %d %.4f %.0f\n",$TRmovkey ,$accel, $angle, $dist))
EndIf
Else
KeySend($TLmovkey, "down")
Sleep($accel)
KeySend($TLmovkey, "up")
if $debug_mov = True Then
ConsoleWrite(StringFormat("InitDest: %s %d %.4f %.0f\n",$TLmovkey ,$accel, $angle, $dist))
EndIf
EndIf
Sleep(100)
$cnt +=1
; check for death
if $dcheck And _memoryread($memdeath,$hprocess) = 1 Then
$isDead = True
Return
EndIf
; sometimes GW does not accept rotation keys, so just start movement and proceed with fingers crossed
Until (Abs($angle - $curcou) <0.1) Or ($cnt > 10)
EndFunc
; cyclic function for movement to destination (must be called every 10ms)
Func MoveToCore($okdist, $dcheck = False)
;no movement if we are dead or got blocked
If $isDead Or $gotBlocked Then
Return True
EndIf
; get data
$posx = _memoryread($memx,$hprocess,'float')
$posy = _memoryread($memy,$hprocess,'float')
$curcou = _memoryread($memcourse,$hprocess,'float')
; try to catch problem in case we missed target
if $olddist < $dist -100.0 Then
InitDest($gotox, $gotoy, $dcheck)
EndIf
; store distance every 500ms, initial value is set in InitDest(), check for special situations
If Mod($callcnt, 50) = 0 Then
; set death flag and exit
if $dcheck And _memoryread($memdeath,$hprocess) = 1 Then
$isDead = True
Return True
EndIf
; restart running in case we got stopped
if $stopCheck And (Abs($olddist - $dist) < 20.0) Then
$running = False
EndIf
; set blocked flag and exit
if $blockCheck And (Abs($olddist - $dist) < 20.0) Then
$gotBlocked = True
Return True
EndIf
$olddist = $dist
EndIf
;increment call counter
$callcnt +=1
; check running
if $running = False Then
$running = True
KeySend($ARmovkey)
EndIf
; calc angle
$angle = ACos(($gotox - $posx)/$dist)
if $gotoy < $posy Then
$angle = -$angle
EndIf
; correct angle on the fly
If (Abs($angle - $curcou) >0.1) And ($increment = 0) Then
; transition via q2<->q3 by pseudo course angle
$curcou = _memoryread($memcourse,$hprocess,'float')
if (($angle > $pi/2) And ($curcou < $angle - $pi)) Then
$curcou = 2*$pi + $curcou
EndIf
if (($angle < -$pi/2) And ($curcou > $pi+$angle)) Then
$curcou = -2*$pi + $curcou
EndIf
$increment = GetCourse(Abs($angle - $curcou))
; rotate
if $angle < $curcou Then
KeySend($TRmovkey, "down")
$increment -=10
if $debug_mov = True Then
ConsoleWrite(StringFormat("MoveToCore: %s %d %.4f %.0f\n",$TRmovkey ,$increment, $angle, $dist))
EndIf
Else
KeySend($TLmovkey, "down")
$increment -=10
if $debug_mov = True Then
ConsoleWrite(StringFormat("MoveToCore: %s %d %.4f %.0f\n",$TLmovkey ,$increment, $angle, $dist))
EndIf
EndIf
ElseIf ($increment > 0) Then
$increment -=10
if $increment <= 0 Then
KeySend($TRmovkey, "up")
KeySend($TLmovkey, "up")
EndIf
EndIf
; reached position
If $dist < $okdist Then
$increment = 0
KeySend($TRmovkey, "up")
KeySend($TLmovkey, "up")
if $debug_pos Then
ConsoleWrite(StringFormat("MoveToCore: %d %d\n",$gotox, $gotoy))
EndIf
return True
EndIf
Return False
EndFunc
; movement function
; $mode = 0 : do one iteration and return, used in very special situations only
; $mode = 1 : init destination and move there
; $mode = 2 : autorun mode, if a stop is detected it will be tried to run again automatically
; $mode = 3 : block mode, if a block is detected we set flag and exit
; $random adds some variation to movement positions
; $dcheck enables deathcheck
; $okdist specifies the distance to the destination which will be accepted as position reached
Func MoveTo($mode, $x, $y, $random = False, $dcheck = False, $okdist = 130.0)
$xl = $x
$yl = $y
if $random Then
$xl = $x + Int(Random(-100,100))
$yl = $y + Int(Random(-100,100))
EndIf
if $mode = 0 Then
$stopCheck = False
$blockCheck = False
Return MoveToCore($okdist, $dcheck)
ElseIf $mode = 1 Then
$stopCheck = False
$blockCheck = False
InitDest($xl, $yl, $dcheck)
While Not MoveToCore($okdist, $dcheck)
Sleep(10)
WEnd
ElseIf $mode = 2 Then
$stopCheck = True
$blockCheck = False
InitDest($xl, $yl, $dcheck)
While Not MoveToCore($okdist, $dcheck)
Sleep(10)
WEnd
ElseIf $mode = 3 Then
$stopCheck = False
$blockCheck = True
InitDest($xl, $yl, $dcheck)
While Not MoveToCore($okdist, $dcheck)
Sleep(10)
WEnd
Else ;error
ConsoleWrite(StringFormat("MoveTo: bad mode: %d",$mode))
Exit
EndIf
EndFunc
#EndRegion
#Region Collection of Functions
; check if position is in area
Func CheckArea($xval, $yval)
$ret = False
$pX = _memoryread($memx,$hprocess,'float')
$pY = _memoryread($memy,$hprocess,'float')
if ($pX < $xval + 250) And ($pX > $xval - 250) And ($pY < $yval + 250) And ($pY > $yval - 250) Then
$ret = True
EndIf
Return $ret
EndFunc
; random sleep function with -+5% variation
Func RndSleep($val)
$sle = Random($val * 0.95, $val *1.05, 1)
Sleep($sle)
EndFunc
;check if we got killed
Func CheckDeath()
if _memoryread($memdeath,$hprocess) = 1 Then
$isDead = true
return true
EndIf
EndFunc
; check area for not collectable items like chests/signs etc.
Func BuildCLBlackList()
$CLBlackList[0] = 0
KeySend($INtgtkey)
Sleep(200)
$cnt = 0
$id = _memoryread($memnpcidselect,$hprocess)
While ( $id > 0 And $cnt < $CLBlackMax)
for $i=1 to $cnt
If $CLBlacklist[$i] = $id Then ExitLoop 2
Next
$cnt +=1
$CLBlackList[$cnt] = $id
KeySend($IXtgtkey)
Sleep(200)
$id = _memoryread($memnpcidselect,$hprocess)
WEnd
$CLBlackList[0] = $cnt
EndFunc
; collect loot
; $max limits number of items to pick up
; $checkblack enables usage of blacklist generated by a call to BuildCLBlackList()
; $retrytime specifies the time in ms to do another attempt to collect the item,
; useful if items may be spread all over the place after a farm run
; $retrycount specifies how many retry attempts should be done until item gets blacklisted
; (e.g. blocked by an foe)
Func CollectLoot($max, $checkblack = False, $retrytime = 200, $retrycount = 0)
$cnt =0
If $checkblack Then
$max += $CLBlackList[0]
Else
; clear old blacklist
$CLBlackList[0] =0
EndIf
;select first item
KeySend($INtgtkey)
RndSleep(200)
$id = _memoryread($memnpcidselect,$hprocess)
While ( $id > 0) And ($cnt < $max)
;check for death
If (_memoryread($memdeath,$hprocess) = 1) Then ExitLoop
;check if item has been blacklisted
If $checkblack Then
For $i = 1 To $CLBlackList[0]
If $CLBlackList[$i] = $id Then
KeySend($IXtgtkey)
RndSleep(200)
$id = _memoryread($memnpcidselect,$hprocess)
$cnt +=1
ContinueLoop 2
EndIf
Next
EndIf
;check if looting has been disabled
$CLtimer = TimerInit()
While $noLoot
$CLtime = TimerDiff($CLtimer)
Sleep(500)
If $CLtime > 30000 Then ;noLoot timeout
ConsoleWrite("CollectLoot: noLoot timeout exceeded")
Exit
EndIf
WEnd
;collect item
$rcnt = 0
KeySend($DIactkey)
RndSleep(200)
$CLtimer = TimerInit()
While ($id = _memoryread($memnpcidselect,$hprocess))
Sleep(100)
;wait if we have to run a longer distance
$CLtime = TimerDiff($CLtimer)
if $CLtime > $retrytime Then
;dont do a retry just wait retrytime
if $retrycount = 0 Then ExitLoop
;try again
KeySend($DIactkey)
$rcnt +=1
;max retries reached, check if still not collected and blacklist item
if $rcnt = $retrycount Then
RndSleep(200)
If ($id = _memoryread($memnpcidselect,$hprocess)) Then
$checkblack = True
$enter = True
for $i=1 to $CLBlackList[0]
If $CLBlacklist[$i] = $id Then
$enter = False
EndIf
Next
if $enter Then
$CLBlackList[0] +=1
$CLBlackList[$CLBlackList[0]] = $id
EndIf
EndIf
ExitLoop
EndIf
$CLtimer = TimerInit()
EndIf
;check for death
If (_memoryread($memdeath,$hprocess) = 1) Then ExitLoop 2
WEnd
; wait until dead and got rezzed
Func WaitRezz()
While _memoryread($memdeath,$hprocess) <> 1
Sleep(2000)
WEnd
While _memoryread($memdeath,$hprocess) <> 0
Sleep(2000)
WEnd
RndSleep(3000)
EndFunc
; transfer to different area / portal
; $toID specifies area we want to travel to
; $timeout is the time in sec after we exit with an error
Func TransferArea($toID, $timeout = 20)
; wait until transfer has started
$cnt = 0
While Not ((_memoryread($memmap,$hprocess)) = 2)
Sleep(200)
$cnt +=1
if $cnt > 5*$timeout Then
ConsoleWrite("TransferArea: transfer timeout exceeded")
Exit
EndIf
WEnd
;wait until new area has been reached
$cnt = 0
While (_memoryread($memmap,$hprocess)) <> $toID
Sleep(200)
$cnt +=1
if $cnt > 5*$timeout Then
ConsoleWrite(StringFormat("TransferArea: area ID: %d timeout exceeded", $toID))
Exit
EndIf
WEnd
RndSleep(4000)
;wait until course has been stabilized
$cnt = 0
While _memoryread($memcourse,$hprocess,'float') > 2*$pi
Sleep(200)
$cnt +=1
if $cnt > 5*$timeout Then
ConsoleWrite("TransferArea: course timeout exceeded")
Exit
EndIf
WEnd
EndFunc
; transfer to GH, may be used from/to GH
Func TransferGH()
KeySend($OGpnlkey)
RndSleep(500)
ControlClick($client, "", "", "left", 1, $GHclickX, $GHclickY)
$cnt = 0
While Not ((_memoryread($memmap,$hprocess)) = 2)
Sleep(200)
$cnt +=1
if Mod($cnt, 10) = 0 Then
ControlClick($client, "", "", "left", 1, $GHclickX, $GHclickY)
EndIf
if Mod($cnt, 15) = 0 Then
KeySend($OGpnlkey)
EndIf
WEnd
While (_memoryread($memmap,$hprocess)) <> 0
Sleep(100)
WEnd
RndSleep(4000)
KeySend($OGpnlkey)
RndSleep(500)
EndFunc
; ident all items from start row to end row (0..8) using ident kit at row/col (0..4)
Func IdentItems($StartRow, $EndRow, $IdentCol, $IdentRow)
KeySend($TBinvkey)
RndSleep(500)
if $EndRow > $invMaxR Then
$end = $invMaxR
Else
$end = $EndRow
EndIf
For $row = $StartRow To $end
For $col = 0 To $invMaxC
MouseSend("left", "dclick", $invPos[$IdentCol][$IdentRow][0], $invPos[$IdentCol][$IdentRow][1])
RndSleep(250)
MouseSend("left", "click", $invPos[$col][$row][0], $invPos[$col][$row][1])
RndSleep(250)
Next
Next
RndSleep(500)
KeySend($TBinvkey)
EndFunc
;Sell items at trader
func SellatTrader($countclicks)
KeySend($ANtgtkey)
RndSleep(500)
KeySend($DIactkey)
RndSleep(2000)
MouseSend("left", "click", $STclickX, $STclickY)
RndSleep(200)
for $i = 1 to $countclicks
MouseSend("left", "click", $SBclickX, $SBclickY)
RndSleep(200)
Next
EndFunc
#EndRegion
#Region Helper Functions
; create long int (32 bit) from 2 short int (16 bit)
Func MakeLong($LoWord, $HiWord)
Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF))
EndFunc
; send mouse events to non active window
; button = left, right, none
; event = down, up, click, dclick, move
Func MouseSend($btn, $evt, $xpos, $ypos)
$user32 = DllOpen("user32.dll")
if $user32 = -1 Then
ConsoleWrite("MouseSend: cannot open user32.dll")
Exit
EndIf
;define missing constans
$MK_LBUTTON = 0x0001
$WM_LBUTTONDOWN = 0x0201
;$WM_LBUTTONUP = 0x0202 -> defined in WindowsConstants.au3
$WM_LBUTTONDBLCLK = 0x0203
$MK_RBUTTON = 0x0002
$WM_RBUTTONDOWN = 0x0204
$WM_RBUTTONUP = 0x0205
$WM_RBUTTONDBLCLK = 0x0206
;$WM_MOUSEMOVE = 0x0200 -> defined in WindowsConstants.au3
;map button to event
If $btn = "left" Then
$button = $MK_LBUTTON
$btdown = $WM_LBUTTONDOWN
$btup = $WM_LBUTTONUP
$btdbl = $WM_LBUTTONDBLCLK
ElseIf $btn = "right" Then
$button = $MK_RBUTTON
$btdown = $WM_RBUTTONDOWN
$btup = $WM_RBUTTONUP
$btdbl = $WM_RBUTTONDBLCLK
ElseIf $btn = "none" Then
If Not ($evt = "move") Then
ConsoleWrite(StringFormat("MouseSend: bad call: %s , %s",$btn, $evt))
Exit
EndIf
Else ;error
ConsoleWrite(StringFormat("MouseSend: bad button: %s",$btn))
Exit
EndIf
; send single keyboard event to non active window
; event = pressed, down, up
; kdown = key down delay
; note: supports only lower case keys + NUMx, Fx, some special keys and @
Func KeySend($inkey, $evt ="pressed", $kdown = 50)
$user32 = DllOpen("user32.dll")
if $user32 = -1 Then
ConsoleWrite("KeySend: cannot open user32.dll")
Exit
EndIf
#Region MY FUNCTIONS
Func loadout()
While _memoryread($memmap, $hprocess) <> 1
Sleep(500)
WEnd
Sleep(10000)
EndFunc
func loadin()
While _memoryread($memmap,$hprocess) <> 0
Sleep(500)
WEnd
sleep(10000)
EndFunc
;deathcheck
Func death()
If _memoryread($memdeath, $hprocess) = 1 Then
resign()
EndIf
EndFunc
#EndRegion MY FUNCTIONS
Meine NomadMemory:
Quote:
#include-once
#region _Memory
;================================================= =================================
; AutoIt Version: 3.1.127 (beta)
; Language: English
; Platform: All Windows
; Author: Nomad
; Requirements: These functions will only work with beta.
;================================================= =================================
; Credits: wOuter - These functions are based on his original _Mem() functions.
; But they are easier to comprehend and more reliable. These
; functions are in no way a direct copy of his functions. His
; functions only provided a foundation from which these evolved.
;================================================= =================================
;
; Functions:
;
;================================================= =================================
; Function: _MemoryOpen($iv_Pid[, $iv_DesiredAccess[, $iv_InheritHandle]])
; Description: Opens a process and enables all possible access rights to the
; process. The Process ID of the process is used to specify which
; process to open. You must call this function before calling
; _MemoryClose(), _MemoryRead(), or _MemoryWrite().
; Parameter(s): $iv_Pid - The Process ID of the program you want to open.
; $iv_DesiredAccess - (optional) Set to 0x1F0FFF by default, which
; enables all possible access rights to the
; process specified by the Process ID.
; $iv_InheritHandle - (optional) If this value is TRUE, all processes
; created by this process will inherit the access
; handle. Set to 1 (TRUE) by default. Set to 0
; if you want it FALSE.
; Requirement(s): None.
; Return Value(s): On Success - Returns an array containing the Dll handle and an
; open handle to the specified process.
; On Failure - Returns 0
; @Error - 0 = No error.
; 1 = Invalid $iv_Pid.
; 2 = Failed to open Kernel32.dll.
; 3 = Failed to open the specified process.
; Author(s): Nomad
; Note(s):
;================================================= =================================
Func _MemoryOpen($iv_Pid, $iv_DesiredAccess = 0x1F0FFF, $iv_InheritHandle = 1)
If Not ProcessExists($iv_Pid) Then
SetError(1)
Return 0
EndIf
If @Error Then
DllClose($ah_Handle[0])
SetError(3)
Return 0
EndIf
$ah_Handle[1] = $av_OpenProcess[0]
Return $ah_Handle
EndFunc
;================================================= =================================
; Function: _MemoryRead($iv_Address, $ah_Handle[, $sv_Type])
; Description: Reads the value located in the memory address specified.
; Parameter(s): $iv_Address - The memory address you want to read from. It must
; be in hex format (0x00000000).
; $ah_Handle - An array containing the Dll handle and the handle
; of the open process as returned by _MemoryOpen().
; $sv_Type - (optional) The "Type" of value you intend to read.
; This is set to 'dword'(32bit(4byte) signed integer)
; by default. See the help file for DllStructCreate
; for all types. An example: If you want to read a
; word that is 15 characters in length, you would use
; 'char[16]' since a 'char' is 8 bits (1 byte) in size.
; Return Value(s): On Success - Returns the value located at the specified address.
; On Failure - Returns 0
; @Error - 0 = No error.
; 1 = Invalid $ah_Handle.
; 2 = $sv_Type was not a string.
; 3 = $sv_Type is an unknown data type.
; 4 = Failed to allocate the memory needed for the DllStructure.
; 5 = Error allocating memory for $sv_Type.
; 6 = Failed to read from the specified process.
; Author(s): Nomad
; Note(s): Values returned are in Decimal format, unless specified as a
; 'char' type, then they are returned in ASCII format. Also note
; that size ('char[size]') for all 'char' types should be 1
; greater than the actual size.
;================================================= =================================
Func _MemoryRead($iv_Address, $ah_Handle, $sv_Type = 'dword')
If Not IsArray($ah_Handle) Then
SetError(1)
Return 0
EndIf
Local $v_Buffer = DllStructCreate($sv_Type)
If @Error Then
SetError(@Error + 1)
Return 0
EndIf
If Not @Error Then
Local $v_Value = DllStructGetData($v_Buffer, 1)
Return $v_Value
Else
SetError(6)
Return 0
EndIf
EndFunc
;================================================= =================================
; Function: _MemoryWrite($iv_Address, $ah_Handle, $v_Data[, $sv_Type])
; Description: Writes data to the specified memory address.
; Parameter(s): $iv_Address - The memory address which you want to write to.
; It must be in hex format (0x00000000).
; $ah_Handle - An array containing the Dll handle and the handle
; of the open process as returned by _MemoryOpen().
; $v_Data - The data to be written.
; $sv_Type - (optional) The "Type" of value you intend to write.
; This is set to 'dword'(32bit(4byte) signed integer)
; by default. See the help file for DllStructCreate
; for all types. An example: If you want to write a
; word that is 15 characters in length, you would use
; 'char[16]' since a 'char' is 8 bits (1 byte) in size.
; Return Value(s): On Success - Returns 1
; On Failure - Returns 0
; @Error - 0 = No error.
; 1 = Invalid $ah_Handle.
; 2 = $sv_Type was not a string.
; 3 = $sv_Type is an unknown data type.
; 4 = Failed to allocate the memory needed for the DllStructure.
; 5 = Error allocating memory for $sv_Type.
; 6 = $v_Data is not in the proper format to be used with the
; "Type" selected for $sv_Type, or it is out of range.
; 7 = Failed to write to the specified process.
; Author(s): Nomad
; Note(s): Values sent must be in Decimal format, unless specified as a
; 'char' type, then they must be in ASCII format. Also note
; that size ('char[size]') for all 'char' types should be 1
; greater than the actual size.
;================================================= =================================
Func _MemoryWrite($iv_Address, $ah_Handle, $v_Data, $sv_Type = 'dword')
If Not IsArray($ah_Handle) Then
SetError(1)
Return 0
EndIf
Local $v_Buffer = DllStructCreate($sv_Type)
If @Error Then
SetError(@Error + 1)
Return 0
Else
DllStructSetData($v_Buffer, 1, $v_Data)
If @Error Then
SetError(6)
Return 0
EndIf
EndIf
If Not @Error Then
Return 1
Else
SetError(7)
Return 0
EndIf
EndFunc
;================================================= =================================
; Function: _MemoryClose($ah_Handle)
; Description: Closes the process handle opened by using _MemoryOpen().
; Parameter(s): $ah_Handle - An array containing the Dll handle and the handle
; of the open process as returned by _MemoryOpen().
; Return Value(s): On Success - Returns 1
; On Failure - Returns 0
; @Error - 0 = No error.
; 1 = Invalid $ah_Handle.
; 2 = Unable to close the process handle.
; Author(s): Nomad
; Note(s):
;================================================= =================================
Func _MemoryClose($ah_Handle)
If Not IsArray($ah_Handle) Then
SetError(1)
Return 0
EndIf
DllCall($ah_Handle[0], 'int', 'CloseHandle', 'int', $ah_Handle[1])
If Not @Error Then
DllClose($ah_Handle[0])
Return 1
Else
DllClose($ah_Handle[0])
SetError(2)
Return 0
EndIf
EndFunc
;================================================= =================================
; Function: SetPrivilege( $privilege, $bEnable )
; Description: Enables (or disables) the $privilege on the current process
; (Probably) requires administrator privileges to run
;
; Author(s): Larry (from autoitscript.com's Forum)
; Notes(s):
;
;================================================= =================================
Func SetPrivilege( $privilege, $bEnable )
Const $TOKEN_ADJUST_PRIVILEGES = 0x0020
Const $TOKEN_QUERY = 0x0008
Const $SE_PRIVILEGE_ENABLED = 0x0002
Local $hToken, $SP_auxret, $SP_ret, $hCurrProcess, $nTokens, $nTokenIndex, $priv
$nTokens = 1
$LUID = DLLStructCreate("dword;int")
If IsArray($privilege) Then $nTokens = UBound($privilege)
$TOKEN_PRIVILEGES = DLLStructCreate("dword;dword[" & (3 * $nTokens) & "]")
$NEWTOKEN_PRIVILEGES = DLLStructCreate("dword;dword[" & (3 * $nTokens) & "]")
$hCurrProcess = DLLCall("kernel32.dll","hwnd","GetCurrentProcess")
$SP_auxret = DLLCall("advapi32.dll","int","OpenProcessToken","h wnd",$hCurrProcess[0], _
"int",BitOR($TOKEN_ADJUST_PRIVILEGES,$TOKEN_QUERY) ,"int_ptr",0)
If $SP_auxret[0] Then
$hToken = $SP_auxret[3]
DLLStructSetData($TOKEN_PRIVILEGES,1,1)
$nTokenIndex = 1
While $nTokenIndex <= $nTokens
If IsArray($privilege) Then
$priv = $privilege[$nTokenIndex-1]
Else
$priv = $privilege
EndIf
$ret = DLLCall("advapi32.dll","int","LookupPrivilegeValue ","str","","str",$priv, _
"ptr",DLLStructGetPtr($LUID))
If $ret[0] Then
If $bEnable Then
DLLStructSetData($TOKEN_PRIVILEGES,2,$SE_PRIVILEGE _ENABLED,(3 * $nTokenIndex))
Else
DLLStructSetData($TOKEN_PRIVILEGES,2,0,(3 * $nTokenIndex))
EndIf
DLLStructSetData($TOKEN_PRIVILEGES,2,DllStructGetD ata($LUID,1),(3 * ($nTokenIndex-1)) + 1)
DLLStructSetData($TOKEN_PRIVILEGES,2,DllStructGetD ata($LUID,2),(3 * ($nTokenIndex-1)) + 2)
DLLStructSetData($LUID,1,0)
DLLStructSetData($LUID,2,0)
EndIf
$nTokenIndex += 1
WEnd
$ret = DLLCall("advapi32.dll","int","AdjustTokenPrivilege s","hwnd",$hToken,"int",0, _
"ptr",DllStructGetPtr($TOKEN_PRIVILEGES),"int",Dll StructGetSize($NEWTOKEN_PRIVILEGES), _
"ptr",DllStructGetPtr($NEWTOKEN_PRIVILEGES),"int_p tr",0)
$f = DLLCall("kernel32.dll","int","GetLastError")
EndIf
$NEWTOKEN_PRIVILEGES=0
$TOKEN_PRIVILEGES=0
$LUID=0
If $SP_auxret[0] = 0 Then Return 0
$SP_auxret = DLLCall("kernel32.dll","int","CloseHandle","hwnd", $hToken)
If Not $ret[0] And Not $SP_auxret[0] Then Return 0
return $ret[0]
EndFunc ;==>SetPrivilege
1. Ja ich kenn Spoiler, hab aber KA wie des geht XD
2. Problem: Ich drücke bei meiner GUI auf Start, aber es passiert nicht, obwohl ich auf einem richtigem Punkt steh....
Allo nochmal alle zusammen^^
Ich hab unten den Bot (wie er bissher aussieht) hinzugegeben. Keine Angst es is nich der von oben. Könnte sich den mal jmd ansehen.
Immer wenn ich ihn starten will kommt die Meldung:
Quote:
Line 32 (File "C:\Users\***\Desktop\AutoIt\au3\Elite-Paragon-Folianten-Bot.au3"):
Durch Includes können andere Scripts in deinen Bot mit eingebunden werden. Dies geschieht mit dem Befehl "#include". Das wohl wichtigste Script für euer Bot, die tt6.au3, sollte also mit eingebunden werden:
Hi erstmal,
ich habe heute das Tutorial ausprobiert und find es klasse Das einzige Problem ist, wenn ich den Bot starte läuft er nicht los...
Der Bot (Sanctum Cay Bot 1.0.rar) müsste doch eigendlich laufen oder muss man daran noch was ändern?
Achja: Bei den Mems bin ich mir nicht sicher ob meine aktuell sind.
Edit: Hab Guild Wars Mem Autoupdater 1.0 ausprobiert, er funktioniert bei mir aber nicht...
Das habe ich gemacht:
1.Guild Wars gestartet
2. zum Tempel gereist
3. am ausgang neben die brücke gestellt (wie auf dem Bild)
4. Gold eingestellt
5. Script gestartet
6. Error (irgendwas das das Gold falsch ist)
kann ich dir leider nicht beantworten, da ich den updater noch nicht benutzt habe. zur not findest su hier auch die aktuellen adressen.
alternativ könntest du dir auch ein wenig wissen und können mit ce aneignen um selber nach den werten zu suchen, denn wenn hier mal im forum keiner so nett ist und dir die mems vor die füsse wirft stehst du da mit deinen nicht funktionierenden bots!
[Guide] Coding for CoEmu/Cofuture 05/12/2011 - CO2 PServer Guides & Releases - 36 Replies CONTENTS OF THREAD:
- Creating Ingame Commands and Database Functions
saving/loading/updating databases using SQL
- Coding more advanced Npcs for use on your server
- Timers and processes
(By Yashi)
- Data types in C# and what they can hold
Beginner Guide in Macro/Bot Coding [just a preview] 12/04/2008 - GW Bots - 18 Replies Hallo allezusammen.
Ich schreibe jetzt schon seit einiger Zeit an einem Guide, welcher euch einen kleinen Einblick in das Thema "Macro/Bot coding" bringen soll. Er ist noch nicht fertig weil ich den dazugehörigen Bot noch nicht fertiggestellt habe (@gispy: Den, den ich dir geschickt habe). Also wird bis zum fertigen release noch ein bisschen Zeit vergehen.
Aber, ich denke mir mal, vielleicht können ein paar Leute schon etwas damit anfangen.
Um die Fragen zu beantworten, die mir...