[Question][Java] Setting terms for a walk function menu

Shout-Out

User Tag List

Results 1 to 14 of 14
  1. #1
    kmJeepers's Avatar Member
    Reputation
    1
    Join Date
    Jun 2009
    Posts
    14
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Question][Java] Setting terms for a walk function

    Hi everyone!

    Well, I managed to build a programm in java that can read offsets properly out of wow... So i tried to code a walkTo() function...
    Out of other guids on this board, i managed to do all the math their is to do to calculate the angles to the destination waypoint. I have got 2 variables,
    "l" and "r", that show how much the player has to turn to the right or to the left to face the destination Waypoint.
    Now, i used the java robot class to send keyactions to the wow window... the player should turn as long as "l" is smaller than "r" to turn left,
    and to turn as long as "l" is bigger than "r" to turn right.
    Well, at all this works, but it is too imprecise. If the player only has to turn a very small amount of degrees to the destination, the programm turns too much (or too long)...
    if i set the delay between the keypress and the keyrelease too short, the player doesn't turn at all, and if i set is too long, it is to imprecise as described before... well i tried using several threads to do the check parallel to turning, but it doesn't work for some reason...
    Any suggestions on this?

    greets kmJeepers (i hope you dont mind my bad english)



    for better understanding my source code(This is an Alterac bot, too ...dont mind that^^):

    http://www.mediafire.com/file/ezkljlkctgz/JBot.zip
    VirusTotal: http://************/ygjrute

    [Question][Java] Setting terms for a walk function
  2. #2
    dna001's Avatar Member
    Reputation
    1
    Join Date
    Sep 2009
    Posts
    4
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, turning like this will ever be less precise than other way (like memory writing, SetFacing or using the CTM function ...) but maybe can you start by posting your turning code, there is maybe something wrong with it.

    Sorry but I'm too lazy to download this bot, find the right class...

  3. #3
    kmJeepers's Avatar Member
    Reputation
    1
    Join Date
    Jun 2009
    Posts
    14
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    okay here's my code ;D

    The goto function:
    Code:
    public void goTo(double x2,double y2)
    {
    if (calcangleL(x2,y2) < calcangleR(x2,y2))
    	{
    		while(calcangleL(x2,y2)<calcangleR(x2,y2))
    		{
    			robot2.keyPress(KeyEvent.VK_A);
    			robot2.delay(25);
    			robot2.keyRelease(KeyEvent.VK_A);
    		}
    
    	}
    	
    		
    	
    	
    if (calcangleL(x2,y2) > calcangleR(x2,y2))
    	{
    		
    		
    		while(calcangleL(x2,y2)>calcangleR(x2,y2))
    		{
    			
    			robot2.keyPress(KeyEvent.VK_D);
    			robot2.delay(25);
    			robot2.keyRelease(KeyEvent.VK_D);
    		}
    	}
    }
    The calcangleL function:
    Code:
     	public static float calcangleL(double x2,double y2) throws NativeException, IllegalAccessException
     	{
    
     		float x=Get_FLOAT.getData(pBasePointer + 0x798);
     		float y=Get_FLOAT.getData(pBasePointer + 0x79C);
     		float l;
     		 
     		float f = (float)Math.atan2(y2 - y, x2 - x);
     		
     		if(f<0)
     		 {
     			 f=(float) (f+Math.PI * 2);
     		 }
     		if (Get_FLOAT.getData(pBasePointer + 0x7E0) > f)
     		{
     		  
     		   l = (float) (((2 * Math.PI) - G  Get_FLOAT.getDatapBasePointer + 0x7E0)) + f);
     		
     		}
     		else
     		{
     		  l = f - Get_FLOAT.getData(pBasePointer + 0x7E0);
     		}
     		return l;
     	}
    The calcangleR function:
    Code:
    public static float calcangleR(double x2,double y2)
    {
     		float x=Get_FLOAT.getData(pBasePointer + 0x798);
     		float y=Get_FLOAT.getData(pBasePointer + 0x79C);
     		float f = (float)Math.atan2(y2 - y, x2 - x);
     		if(f<0)
    		 {
    			 f=(float) (f+Math.PI * 2);
    		 }
     		
     		float r;
     		
     		if (Get_FLOAT.getData(pBasePointer + 0x7E0) > f)
     		{
     		  r = Get_FLOAT.getData(pBasePointer + 0x7E0) - f;
     		}
     		else
     		{
     		  r = (float) (Get_FLOAT.getData(pBasePointer + 0x7E0) + ((2 * Math.PI) - f));
     		}
     		
     		return r;
     	}
    hoping that helps ;D
    Last edited by kmJeepers; 10-11-2009 at 02:27 PM.

  4. #4
    dna001's Avatar Member
    Reputation
    1
    Join Date
    Sep 2009
    Posts
    4
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well I think your code isn't really good.

    I never try this way to turn so I don't really know, but maybe thoses links will help you :



    Movement Shynd’s WoW Modification Journal

    With the example :

    http://go2.wordpress.com/?id=725X134...TestWalkTo.rar

    Cheers, hoping this will help !

    EDIT: Maybe your sending to faster keyevents to the client, you can try to wait a little moment after sending a key !
    Last edited by dna001; 10-11-2009 at 03:28 PM.

  5. #5
    Ellesar1's Avatar Member
    Reputation
    20
    Join Date
    Feb 2009
    Posts
    78
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    since the turning speed is constant, you could calculate how long you have to press the key. if you want to turn just a little bit (like 1 ms) to the left, since it bugs with short delay, just go 25 ms to the right and 26 ms to the left

  6. #6
    mnbvc's Avatar Banned
    Reputation
    120
    Join Date
    Jul 2009
    Posts
    273
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    2 things:
    turn only as long as the difference from your actual angle to your target angle is >0.2r
    turn only if you are >5 yards away from your target

    your movement wont be so precise, but i experienced that this is no problem, and this will result in a quite smooth movement
    Last edited by mnbvc; 10-11-2009 at 04:32 PM.

  7. #7
    kmJeepers's Avatar Member
    Reputation
    1
    Join Date
    Jun 2009
    Posts
    14
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @dna001: exactly that is my code XD I used the page as a guideline ;P
    @Ellesar1: sounds interesting, will check that out...
    @mnbvc: nice ty ;D

    are there some peolpe who have very different methods in mind?
    Last edited by kmJeepers; 10-12-2009 at 10:28 AM.

  8. #8
    kmJeepers's Avatar Member
    Reputation
    1
    Join Date
    Jun 2009
    Posts
    14
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @Ellesar1:
    I just checked, and however the turning speed isn't constant oO
    if i turn for 1000ms two times, i get different values for the difference oO

  9. #9
    EmilyStrange's Avatar Active Member
    Reputation
    34
    Join Date
    Jul 2009
    Posts
    125
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Welcome to the machine!

    Welcome to programming on a non-deterministic, multi-threaded operating system in a networked environment.

    P.S. "Sleep" is merely a suggestion, not an absolute. Especially under Java.

  10. #10
    Ellesar1's Avatar Member
    Reputation
    20
    Join Date
    Feb 2009
    Posts
    78
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    then you won't ever have perfect accuracy with this method.

    if you want a perfect solution, you will have to call SetFacing() of WoW

  11. #11
    Xarg0's Avatar Member
    Reputation
    61
    Join Date
    Jan 2008
    Posts
    389
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sending mouseinput to turn is better and faster than using the arrow keys, you'll just have to calculate how far you need to move your cursor.
    You'll have to find out how many px you need to move your mouse to reach a certain angle.
    Once you know how many px to move you'll send a right mouse button down message to wow, then change the cursor coordinates by the px you calculated and send a right mouse button up message.
    But be careful, if you're spinning around too fast you'll get disconnected.
    I hacked 127.0.0.1

  12. #12
    ~OddBall~'s Avatar Contributor
    Reputation
    207
    Join Date
    Jan 2008
    Posts
    1,156
    Thanks G/R
    4/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what IDE did you use to make this?
    https://www.mmowned.com/forums/world-of-warcraft/guides/278302-selecting-bot-you.html - SELECTING THE BOT FOR YOU

    PHWOOOOAAAAAR - Parog was here. <3 <----Wtf's a Parog?

  13. #13
    Ellesar1's Avatar Member
    Reputation
    20
    Join Date
    Feb 2009
    Posts
    78
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    just be aware of the mouse acceleration. if you move it fast you'll move farther than if you move it slowly over the same distance.

  14. #14
    kmJeepers's Avatar Member
    Reputation
    1
    Join Date
    Jun 2009
    Posts
    14
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @~OddBall~: Eclipse.

    well i'm actually trying to implement the mouse method, but this is is kind of tricky...
    the angle the player moves is relatet to the speed the mouse moves ...
    but i'll try that out and post my result ;D

Similar Threads

  1. Question: Mount Display IDs for 2.1.3 Patch
    By ectrianpwnz in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 01-19-2008, 11:49 PM
  2. [Question]DK spell pack for Pally?
    By Hock in forum WoW ME Questions and Requests
    Replies: 0
    Last Post: 10-15-2007, 04:26 AM
  3. [Question] The program closes for some weird reason.
    By MuppetShow in forum WoW ME Questions and Requests
    Replies: 0
    Last Post: 10-14-2007, 08:29 PM
  4. [Question] The Dummie guide for model editing.
    By XXXturkeyXXX in forum WoW ME Questions and Requests
    Replies: 2
    Last Post: 10-04-2007, 05:35 PM
  5. Question about release crack for Glider and other nice stuff
    By RedDevil in forum World of Warcraft General
    Replies: 39
    Last Post: 12-13-2006, 12:40 AM
All times are GMT -5. The time now is 10:08 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search