Page 32 of 32 FirstFirst ... 22303132
Results 311 to 318 of 318

Thread: OK to ASK FOR HELP HERE!

  1. #311
    Member reduf's Avatar
    Join Date
    Aug 2013
    Location
    university basement
    Posts
    79
    @phat32, the only bad thing I see in your code is the typo in the comment. It should be "coords" instead of "cords".

  2. #312
    Ralle1976's Avatar
    Join Date
    Jul 2012
    Location
    Ohmden
    Posts
    399

    ^^_^^

    Quote Originally Posted by phat34 View Post
    If it's incorrect then post the corrections, don't be a jackass!


    ;~ The function is totally superfluous.
    ;~ So if you use them that way, you're just saying that you have no idea what you're doing.
    ;~ I do not say the MoveTo in GWA2 optimally.... it is certainly not
    ;~ so call again and again the same func with the same coords is Sense free
    ;~ There are better variants regarding block.
    ;~ What ever check the logic of your func self pls
    ;~ in german we say "doppelt gemoppelt" to some like this => "action was redundant" and holds a bad with the agent struct wich effected in the Distance check as well
    ;~ when you run into a wall or psition you cant move to you create a infinty loop and so on

    Code:
    Func Blocked()  
       $Me = GetAgentByID(-2);<- that makes no sense 
       Do
          Sleep(200)
          MoveTo(-5488, 12655) ; 
          If GetMapLoading() == 2 Then Disconnected() ; moved to loop - in case of disconnect while approach cords
    	  ;$Me = GetAgentByID(-2); <-- 
       Until ComputeDistance(-5488, 12655, DllStructGetData($ME, "X"),  DllStructGetData($ME, "Y")) < 80
    EndFunc
    
    
    ;Standart MoveTo Func from GWA2
    ;~ Description: Move to a location and wait until you reach it.
    Func MoveTo($aX, $aY, $aRandom = 50)
    	Local $lBlocked = 0
    	Local $lMe
    	Local $lMapLoading = GetMapLoading(), $lMapLoadingOld
    	Local $lDestX = $aX + Random(-$aRandom, $aRandom)
    	Local $lDestY = $aY + Random(-$aRandom, $aRandom)
    
    	Move($lDestX, $lDestY, 0)
    
    	Do
    		Sleep(100)
    		$lMe = GetAgentByID(-2)
    
    		If DllStructGetData($lMe, 'HP') <= 0 Then ExitLoop
    
    		$lMapLoadingOld = $lMapLoading
    		$lMapLoading = GetMapLoading()
    		If $lMapLoading <> $lMapLoadingOld Then ExitLoop
    
    		If DllStructGetData($lMe, 'MoveX') == 0 And DllStructGetData($lMe, 'MoveY') == 0 Then
    			$lBlocked += 1
    			$lDestX = $aX + Random(-$aRandom, $aRandom)
    			$lDestY = $aY + Random(-$aRandom, $aRandom)
    			Move($lDestX, $lDestY, 0)
    		EndIf
    	Until ComputeDistance(DllStructGetData($lMe, 'X'), DllStructGetData($lMe, 'Y'), $lDestX, $lDestY) < 25 Or $lBlocked > 14
    EndFunc   ;==>MoveTo

    @ Reduf .... you had tomatoes on your eyes ; D
    Last edited by Ralle1976; 01-13-2018 at 11:15 PM.

  3. #313
    Avid Learner phat34's Avatar
    Join Date
    Dec 2014
    Location
    California
    Posts
    422
    Quote Originally Posted by Ralle1976 View Post

    ;~ The function is totally superfluous.
    ;~ So if you use them that way, you're just saying that you have no idea what you're doing.
    ;~ I do not say the MoveTo in GWA2 optimally.... it is certainly not
    ;~ so call again and again the same func with the same coords is Sense free
    ;~ There are better variants regarding block.
    ;~ What ever check the logic of your func self pls
    ;~ in german we say "doppelt gemoppelt" to some like this => "action was redundant" and holds a bad with the agent struct wich effected in the Distance check as well
    ;~ when you run into a wall or psition you cant move to you create a infinty loop and so on

    Code:
    Func Blocked()  
       $Me = GetAgentByID(-2);<- that makes no sense 
       Do
          Sleep(200)
          MoveTo(-5488, 12655) ; 
          If GetMapLoading() == 2 Then Disconnected() ; moved to loop - in case of disconnect while approach cords
    	  ;$Me = GetAgentByID(-2); <-- 
       Until ComputeDistance(-5488, 12655, DllStructGetData($ME, "X"),  DllStructGetData($ME, "Y")) < 80
    EndFunc
    
    
    ;Standart MoveTo Func from GWA2
    ;~ Description: Move to a location and wait until you reach it.
    Func MoveTo($aX, $aY, $aRandom = 50)
    	Local $lBlocked = 0
    	Local $lMe
    	Local $lMapLoading = GetMapLoading(), $lMapLoadingOld
    	Local $lDestX = $aX + Random(-$aRandom, $aRandom)
    	Local $lDestY = $aY + Random(-$aRandom, $aRandom)
    
    	Move($lDestX, $lDestY, 0)
    
    	Do
    		Sleep(100)
    		$lMe = GetAgentByID(-2)
    
    		If DllStructGetData($lMe, 'HP') <= 0 Then ExitLoop
    
    		$lMapLoadingOld = $lMapLoading
    		$lMapLoading = GetMapLoading()
    		If $lMapLoading <> $lMapLoadingOld Then ExitLoop
    
    		If DllStructGetData($lMe, 'MoveX') == 0 And DllStructGetData($lMe, 'MoveY') == 0 Then
    			$lBlocked += 1
    			$lDestX = $aX + Random(-$aRandom, $aRandom)
    			$lDestY = $aY + Random(-$aRandom, $aRandom)
    			Move($lDestX, $lDestY, 0)
    		EndIf
    	Until ComputeDistance(DllStructGetData($lMe, 'X'), DllStructGetData($lMe, 'Y'), $lDestX, $lDestY) < 25 Or $lBlocked > 14
    EndFunc   ;==>MoveTo

    @ Reduf .... you had tomatoes on your eyes ; D
    yet, 99 out of 100 times that code would suffice for the kids situation at hand...

    2) all I did is copy and paste the kids function and move the "DllStructGetData($ME, "X"), DllStructGetData($ME, "Y"))" into the loop as 4d-1 suggested in his message to give him an example.....

    .... you were coming after me like your out for blood it seems... I know your a great coder. PM me if you have a ranger modded version of the raptor farm bot you wrote, my son is looking for one.

  4. #314
    Senior Member
    Join Date
    Aug 2011
    Posts
    230
    Phat, all the point is you better not try to help if your answer is shit af.
    You say you know the code is bad, but you wrote it anyway.

    To follow 4d1 advice, you should have wrote what Ralles wrote, even your correction was wrong.

    !!! This method doesn't work, it's just to illustrate !!!

    Code:
    Func Blocked()  
       Do
          Sleep(200)
          MoveTo(-5488, 12655) ; 
          If GetMapLoading() == 2 Then Disconnected() ; moved to loop - in case of disconnect while approach cords
          $Me = GetAgentByID(-2); <-- get the data inside the loop
       Until ComputeDistance(-5488, 12655, DllStructGetData($ME, "X"),  DllStructGetData($ME, "Y")) < 80
    EndFunc
    So next time, please to not try to help with one month late.

  5. #315
    Ralle1976's Avatar
    Join Date
    Jul 2012
    Location
    Ohmden
    Posts
    399

    ^111^

    Quote Originally Posted by phat34 View Post
    yet, 99 out of 100 times that code would suffice for the kids situation at hand...

    2) all I did is copy and paste the kids function and move the "DllStructGetData($ME, "X"), DllStructGetData($ME, "Y"))" into the loop as 4d-1 suggested in his message to give him an example.....

    .... you were coming after me like your out for blood it seems... I know your a great coder. PM me if you have a ranger modded version of the raptor farm bot you wrote, my son is looking for one.

    Code:
    ;~ Okay forget that this func is post from RiflemanX sorry on that 
    Func Blocked()  
    	 If GetMapLoading() == 2 Then Disconnected()
    		$Me = GetAgentByID(-2)
    		$COORDS_X = DllStructGetData($ME, "X")
    		$COORDS_Y = DllStructGetData($ME, "Y")
    		
    	    Do
    		  Sleep(200)
    		  MoveTo(-5488, 12655)		
    	    Until ComputeDistance(-5488, 12655, $COORDS_X, $COORDS_Y) < 80
    EndFunc
    
    ;~ And 4d1 said "youll need to be calling the $Me COORDS_X COORDS_Y shit in the loop because gwa2 is lame like that, have to constantly be refreshing your data "
    
    ;~ Comment me about this
    ;~ diffrent in gwa2 to other api wich is written in Autoit is that hey take everytime the hole struct of Agent 
    ;~ for example in gwapi you just read the x and y coords at the time you realy need and want check 
    ;~ and to check you need the coords at the time you want check all other makes no sense 
    ;~ but i am sure he not realy break his head over if the func self if it makes sense or not
    ;~ he just pointig out the wrong use of the Structurdata 
    
    
    ;~ So it looks like this ->
    Func Blocked()  
    	    Do
    			MoveTo(-5488, 12655)	
    			$Me = GetAgentByID(-2)  
    	    Until ComputeDistance(-5488, 12655, DllStructGetData($ME, "X"), DllStructGetData($ME, "Y")) < 80
    EndFunc
    ;~ but is still bullshit ........... 
    
    
    
    ;~ RiflemanX Awnser -> "Right on, thanks 4D1. I will experiment with it and see how it runs. Also, thanks Ralle for providing the more complex and effective solution."
    
    ;~ and this means -> 
    ;~ new post to this question is unless because he get all informations and corrections from me via skype ;) 
    
    "you were coming after me like your out for blood it seems... " -> https://www.youtube.com/watch?v=8Q6TSrZfhTw

    Last edited by Ralle1976; 01-14-2018 at 02:31 PM.

  6. #316
    Avid Learner phat34's Avatar
    Join Date
    Dec 2014
    Location
    California
    Posts
    422
    Quote Originally Posted by Danylia View Post
    Phat, all the point is you better not try to help if your answer is shit af.
    You say you know the code is bad, but you wrote it anyway.

    To follow 4d1 advice, you should have wrote what Ralles wrote, even your correction was wrong.

    !!! This method doesn't work, it's just to illustrate !!!

    Code:
    Func Blocked()  
       Do
          Sleep(200)
          MoveTo(-5488, 12655) ; 
          If GetMapLoading() == 2 Then Disconnected() ; moved to loop - in case of disconnect while approach cords
          $Me = GetAgentByID(-2); <-- get the data inside the loop
       Until ComputeDistance(-5488, 12655, DllStructGetData($ME, "X"),  DllStructGetData($ME, "Y")) < 80
    EndFunc
    So next time, please to not try to help with one month late.
    didn't write that code just showed the kid what 4d-1 was saying... no I didn't test it and yes.. most gwa2 code is shit af... lol

    but please don't come after me for my blood... lol

    and you are forgiven Ralle... if you get me that ranger raptor bot for my kid....

  7. #317
    Member reduf's Avatar
    Join Date
    Aug 2013
    Location
    university basement
    Posts
    79
    yo phat34, look Ralle signature, and replace "The guy in the talk" by "phat34".

  8. #318
    Avid Learner phat34's Avatar
    Join Date
    Dec 2014
    Location
    California
    Posts
    422
    lol... I knew that was about me the whole time. At least I am creative and motivating. ...and an avid learner as well...
    Last edited by phat34; Today at 02:22 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •