Move in GWCA

12/08/2009 19:09 NANAAA#1
Hallo
Ich befasse mich derzeit mit GWCA

mein Problem ist dass ich nen Move machen möchte und der Bot erst weitergeht wenn der Character am richtigen Ort ist.

also

Move(x,y)
warte bis Character +- 300 bei x,y ist
....

Hoffe versteht mich , habe bis jetzt nichts gefunden ausser die Distance berechnen doch das Verstehe ich nicht so recht
12/08/2009 19:19 buFFy!#2
^this

Code:
Func MoveTo($X, $Y)
	MoveToEx($X, $Y)
	Do
		Sleep(100)
	Until ((GetOwnXCoord() - $X) < 50) Or ((GetOwnXCoord() - $X) > 50) And ((GetOwnyCoord() - $Y) < 50) Or ((GetOwnyCoord() - $Y) < 50)
EndFunc   ;==>MoveTo
12/08/2009 19:32 SuneC#3
That MoveTo() is kinda scraped :P
Code:
Func MoveTo($x, $y, $random = 50)
	Local $iBlocked = 0

	$cbType = "float"

	MoveEx($x, $y, $random)
	CmdCB($CA_GETCOORDS, -2)
	Do
		Sleep(250)
		$oldCoords = $cbVar
		$cbType = "int"
		CmdCB($CA_GETDEAD)
		If $cbVar[0] = 1 Then Return
		$cbType = "float"
		CmdCB($CA_GETCOORDS, -2)
		If $oldCoords[0] = $cbVar[0] AND $oldCoords[1] = $cbVar[1] Then
			$iBlocked += 1
			MoveEx($x, $y, $random)
		EndIf
	Until ComputeDistance($cbVar[0], $cbVar[1], $x, $y) < 250 OR $iBlocked > 20
EndFunc

Func ComputeDistance($x1, $y1, $x2, $y2)
	Return Sqrt(($y2 - $y1)^2 + ($x2 - $x1)^2)
EndFunc
This is the one I always used :)
12/08/2009 19:48 in MIND#4
u might get errors with that func 'cause ur coords sometimes dont change when moving with gwca
12/08/2009 20:34 SuneC#5
Quote:
Originally Posted by in MIND View Post
u might get errors with that func 'cause ur coords sometimes dont change when moving with gwca
Which is due to the fact, that GWCA only sends the Move packet, which doesn't make the client aware that it's actually moving :D it will update during the move or when it reaches the location no matter what though.

If you are having issues with the $iBlocked variable, simply comment/delete it out.
12/10/2009 21:15 NANAAA#6
What can i make that the MoveTo(17178,-15874) wait until MoveTo(17844,-16224) ( Function) is finish ?

PHP Code:
Global $random0 "-50" Random Für Move 
Global $random1 "50"  Random Für Move

Func walk
()

MoveTo(17844,-16224)
MoveTo(17178,-15874)
MoveTo(15655,-15685)
MoveTo(15501,-15204)

Endfunc


Func MoveTo
($x$y)            ; Move(x,y
    
Cmd($CA_MOVE_FloatToInt($x+Random($random0,$random1)), _FloatToInt($y+Random($random0,$random1)))
    
    Do
        
    
Sleep(900)
    
$CBType "float"
    
CmdCB($CA_GetCoords,-2)
    
    
Until $CBVar[0] - $x  $random0 or  $CBVar[0] - $x  $random1 And $CBVar[1]  - $y $random0  or $CBVar[1]  - $y $random1 
EndFunc 
12/10/2009 21:20 SuneC#7
Get a proper MoveTo() function first :P I have no idea if your current one even works. The one I posted works the way you want it to though, so just use that.
12/10/2009 22:16 in MIND#8
u better also add the condition that moveto() ends if mapstate (ca_getmaploading) changes cuz the func sometimes doesnt end if u choose "wrong" coords behind a portal

just add this before the "do":
Code:
 $cbType = "int"
 $mState = CmdCB($CA_GETMAPLOADING)
 $mStateOld = $mState[0]
and this after "do" but before "until":
Code:
$cbType = "int"
$mState = CmdCB($CA_GETMAPLOADING)
and this in the same line as "until":
Code:
Or $mState[0] <> $mStateOld
if ur using sune's func it'd be like this:
Code:
Func MoveTo($x, $y, $random = 50)
	Local $iBlocked = 0
           
           $cbType = "int"
           $mState = CmdCB($CA_GETMAPLOADING)
           $mStateOld = $mState[0]

           $cbType = "float"
	MoveEx($x, $y, $random)
	CmdCB($CA_GETCOORDS, -2)

	Do
		Sleep(250)
		$oldCoords = $cbVar
		$cbType = "int"
		CmdCB($CA_GETDEAD)
		If $cbVar[0] = 1 Then Return
		$cbType = "float"
		CmdCB($CA_GETCOORDS, -2)
		If $oldCoords[0] = $cbVar[0] AND $oldCoords[1] = $cbVar[1] Then
			$iBlocked += 1
			MoveEx($x, $y, $random)
		EndIf
                      $cbType = "int"
	           $mState = CmdCB($CA_GETMAPLOADING)
	Until ComputeDistance($cbVar[0], $cbVar[1], $x, $y) < 250 OR $iBlocked > 20 Or $mState[0] <> $mStateOld
EndFunc

__________________________________________________ _________________________________

Quote:
Originally Posted by SuneC View Post
Which is due to the fact, that GWCA only sends the Move packet, which doesn't make the client aware that it's actually moving :D it will update during the move or when it reaches the location no matter what though.

If you are having issues with the $iBlocked variable, simply comment/delete it out.
i didnt mean to say anything against gwca
just wanted to tell that that case could happen
12/10/2009 23:34 SuneC#9
That's a nice addition to the MoveTo() function! Never thought of that, even though I've run into issues with zoning when moving through portals just like you mentioned.

Quote:
Originally Posted by in MIND View Post
i didnt mean to say anything against gwca
just wanted to tell that that case could happen
I'm sorry if you got the impression, but I wasn't making a rant at you. I admit it's a flaw in GWCA, but lazyness has kept me from updating to a better solution, even though it's not difficult at all, to find a function at a higher level to call instead of forging the packet!
12/11/2009 00:25 in MIND#10
feel free to add it to the constants or wherever u want