zutto Posted April 3, 2009 Share Posted April 3, 2009 (edited) yep i am having problems with this, it should change the negative numbers to positive, but for some reason, it keeps them negative i cant see any problems by myself so i decided to ask from here, since these are actually helpfull forums i got this same code to work on c++ but not on autoit :/ [ofcourse, not exactly same, converted to c++ from autoit] anyone got tips where i am going wrong? EDIT: X, Y is destination if you wonder what they are. Do $Xss = _MEMORYREAD($PTRPLAYERX, $HPROCESS, "float") $Yss = _MEMORYREAD($PTRPLAYERY, $HPROCESS, "float") Send("{w down}") $x = abs($x) $y = abs($y) $xss1 = $xss $yss1 = $yss $dx = $x - $xss $dy = $y - $yss $dx = StringLeft($dx, 4) $dy = StringLeft($dy, 4) $distance = sqrt($dx^2 + $dy^2) Until $dx < 4 & $dy < 4 send("{W UP}") Pythogorean theorem, ftw!.. if anyone noticed Edited April 3, 2009 by zutto Link to comment Share on other sites More sharing options...
DaRam Posted April 3, 2009 Share Posted April 3, 2009 I have no idea where $x and $y are being assigned, but I have added Msgbox code to Monitor the variables, run it and see... Do $Xss = _MEMORYREAD($PTRPLAYERX, $HPROCESS, "float") $Yss = _MEMORYREAD($PTRPLAYERY, $HPROCESS, "float") Send("{w down}") Msgbox(0, "X and Y Values", "$x=" & $x & @CRLF & "$y=" & $y) $x = abs($x) $y = abs($y) Msgbox(0, "X and Y Values", "$x=" & $x & @CRLF & "$y=" & $y) $xss1 = $xss $yss1 = $yss $dx = $x - $xss $dy = $y - $yss $dx = StringLeft($dx, 4) $dy = StringLeft($dy, 4) $distance = sqrt($dx^2 + $dy^2) Until $dx < 4 & $dy < 4 send("{W UP}") Link to comment Share on other sites More sharing options...
zutto Posted April 3, 2009 Author Share Posted April 3, 2009 (edited) I have no idea where $x and $y are being assigned, but I have added Msgbox code to Monitor the variables, run it and see... Do $Xss = _MEMORYREAD($PTRPLAYERX, $HPROCESS, "float") $Yss = _MEMORYREAD($PTRPLAYERY, $HPROCESS, "float") Send("{w down}") Msgbox(0, "X and Y Values", "$x=" & $x & @CRLF & "$y=" & $y) $x = abs($x) $y = abs($y) Msgbox(0, "X and Y Values", "$x=" & $x & @CRLF & "$y=" & $y) $xss1 = $xss $yss1 = $yss $dx = $x - $xss $dy = $y - $yss $dx = StringLeft($dx, 4) $dy = StringLeft($dy, 4) $distance = sqrt($dx^2 + $dy^2) Until $dx < 4 & $dy < 4 send("{W UP}") $x & $y is assigned on the function.. i call the function with $x & y.. but i try with MSGboxes edit: abs fails :/ Edited April 3, 2009 by zutto Link to comment Share on other sites More sharing options...
DaRam Posted April 3, 2009 Share Posted April 3, 2009 Abs() of nothing will result in nothing. You need to assign something to $x and $y before attempting an Abs on them.$x & $y is assigned on the function..i call the function with $x & y.. but i try with MSGboxesedit: abs fails :/ Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 3, 2009 Share Posted April 3, 2009 $x & $y is assigned on the function..i call the function with $x & y.. but i try with MSGboxesedit: abs fails :/Fails with what input? What did the MsgBox() show? You can't expect help with a supposedly failing function without explaining what inputs it received. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
zutto Posted April 3, 2009 Author Share Posted April 3, 2009 Fails with what input? What did the MsgBox() show? You can't expect help with a supposedly failing function without explaining what inputs it received. it gave me the numbers as they we're.. as negative ;/but yeah, i'll use other way if $number > 0 then $number * -1should do the job Link to comment Share on other sites More sharing options...
BlackScorpion Posted April 3, 2009 Share Posted April 3, 2009 you abs($x) you read ($xss) raw from memory and subtract it from $x its your $x - $xss (if $xss is > $s you will get a negative in $x) This is obviously waypoint bot code, and you are moving towards the waypoint, what game you writing a bot for? Link to comment Share on other sites More sharing options...
zutto Posted April 3, 2009 Author Share Posted April 3, 2009 you abs($x)you read ($xss) raw from memory and subtract it from $xits your $x - $xss (if $xss is > $s you will get a negative in $x)This is obviously waypoint bot code, and you are moving towards the waypoint, what game you writing a bot for? good good, someone found out its for bot.. pythogorean theorem is kinda obvious tho..trying to find out where it fails..this is for wow.. :| Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 3, 2009 Share Posted April 3, 2009 it gave me the numbers as they we're.. as negative ;/but yeah, i'll use other way if $number > 0 then $number * -1should do the jobAbs() works fine, but yours would have to be: if $number < 0 then $number * -1 Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
zutto Posted April 3, 2009 Author Share Posted April 3, 2009 Abs() works fine, but yours would have to be: if $number < 0 then $number * -1 yeah < but got everything to work now, my pathing system is succesful now ty to everyone. Link to comment Share on other sites More sharing options...
Nahuel Posted April 3, 2009 Share Posted April 3, 2009 $dx = $x - $xss $dy = $y - $yss $dx = StringLeft($dx, 4) $dy = StringLeft($dy, 4 That leads me to believe that you are working with both numbers and strings... Perhaps that's where your problem is. 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