Overlord Posted August 26, 2006 Share Posted August 26, 2006 why won't this work? expandcollapse popup;################################## ; Variables ;################################## Global $currentlocation = 0 $currentx = StringLeft($currentlocation,4) ; current ppos for x $ybeta = stringtrimleft($currentlocation,5) $currenty = stringtrimright($ybeta,2) ; current ppos for y Global $wpx = 3324 ; start location x (center of screen) Global $wpy = 2853 ; start location y (center of screen) Global $moveX= 568 Global $movey= 384 ;################################## ; Script ;################################## ;################################## ;move to wp1 (3252,2854) ;################################## $wpx = $wpx1 $wpy = $wpy1 moving() ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ;>>>>>>>>>>FUNCTIONS>>>>>>>>>>>>>>> ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Func calculate_way() If $currentx > $wpx Then $moveX = 462 else $moveX = 562 If $currenty > $wpy Then $moveY = 334 else $moveY = 434 EndIf EndIf EndFunc Func Read_SACRED_memory() $currentlocation = _ReadString($Sacred, 0x00BD21D2, 700) Sleep(10) EndFunc Func moving() Do Read_SACRED_memory() calculate_way() MouseClick("left",$moveX,$moveY) ; as described in comments in moving.au3 sleep($clickingdelay) ; delay for in-game clicking Until $currentx = $wpx1 and $currenty = $wpy1 EndFunc this is what my code kinda looks like and he calculates his way, but only once. he doesn't recalculate his way again when he clicks again. He just keeps on walking and walking and clicking on the same spot. Link to comment Share on other sites More sharing options...
Overlord Posted August 27, 2006 Author Share Posted August 27, 2006 *bump* anybody please? Link to comment Share on other sites More sharing options...
Developers Jos Posted August 27, 2006 Developers Share Posted August 27, 2006 (edited) have no idea what you want to with this script but are you sure about this portion ? The second IF is only done when the first If is true . I think your way of Indenting is confusing Func calculate_way() If $currentx > $wpx Then $moveX = 462 Else $moveX = 562 If $currenty > $wpy Then $moveY = 334 Else $moveY = 434 EndIf EndIf EndFunc ;==>calculate_way Edited August 27, 2006 by JdeB SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Overlord Posted August 29, 2006 Author Share Posted August 29, 2006 what it needs to do is move my char to a desired location in the game. Since I can view what my location is ($currentlocation), I can let it move to that location. so, what you are saying could be the reason that he doesn't recalculate? what if I drop them both in seperate functions? Link to comment Share on other sites More sharing options...
Overlord Posted September 2, 2006 Author Share Posted September 2, 2006 k,I'm starting to go slightly mad here...code still aint working. if you have a clue...please tell me.what I want it to do:walk to a desired location on screen where I know the X and Y coords forrecalculate if he went beyond the location.What it does:calculates his position and start walking in the right directionwhat it doesn't do:recalculate his path and move in the needed directionexpandcollapse popup$currentx = StringLeft($currentlocation, 4) ; current ppos for x $ybeta = StringTrimLeft($currentlocation, 5) $currenty = StringTrimRight($ybeta, 2) ; current ppos for y $wpx1 = 3252 $wpy1 = 2854 $wpx2 = 3256 $wpy2 = 2864 ;################################## ;main script ;################################## $wpx = $wpx1 $wpy = $wpy1 moving() ;################################## ;main functions ;################################## Func Read_SACRED_memory() $currentlocation = _ReadString($Sacred, 0x00BD21D2, 700) ; ToolTip("Location: " & $currentlocation, 0, 0); Displays the currentlocation Sleep(10) EndFunc Func calculate_way2() If $currentx > $wpx Then $moveX = 482 ;LEFT If $currentx < $wpx Then $moveX = 542 ;RIGHT If $currentx = $wpx Then $moveX = 512 ;MIDDLE OF X If $currenty > $wpy Then $moveY = 354 ;UP If $currenty < $wpy Then $moveY = 414 ;DOWN If $currenty = $wpy Then $moveY = 384 ;MIDDLE OF Y EndFunc ;==>calculate_way2 Func moving() Do Read_SACRED_memory() calculate_way2() ToolTip("moveX: " & $moveX & " moveY: " & $moveY,0,0) ; If $currentx-$wpx Or $currenty-$wpy <=15 Then Send("{SHIFTDOWN}") ; difference between running/walking - for better accuracy MouseClick("left",$moveX,$moveY) ; as described in comments in moving.au3 ; Send("{SHIFTUP}") sleep($clickingdelay) ; delay for in-game clicking Until $currentx = $wpx1 and $currenty = $wpy1 EndFunc ;==>moving Link to comment Share on other sites More sharing options...
Overlord Posted September 3, 2006 Author Share Posted September 3, 2006 can somebody atleast verify that my functions are correct?I have no idea where the error is or why he doesn't recalculate!syntaxcheckbeta and syntaxcheckprod don't give me any errors.and function Do...Until is especially used to run until the expression is true.it can't be true that I need to split them up for x and y? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 3, 2006 Moderators Share Posted September 3, 2006 can somebody atleast verify that my functions are correct?I have no idea where the error is or why he doesn't recalculate!syntaxcheckbeta and syntaxcheckprod don't give me any errors.and function Do...Until is especially used to run until the expression is true.it can't be true that I need to split them up for x and y?I've looked at this thread MANY times, and it's hard to tell you anything with a script that "can't" be tested by myself. You're using memory reading and trying to act on those findings, but we don't know what the returns are... why not try removing the memory information, and put in absolute values for testing? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Overlord Posted September 4, 2006 Author Share Posted September 4, 2006 I've attached the scripts that I use for this bot and I think the problem could be elsewhere. If you take a look, you will see. I think there's a mix-up with the globals... botscript.zip Link to comment Share on other sites More sharing options...
Overlord Posted September 8, 2006 Author Share Posted September 8, 2006 anybody got any ideas so far? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now