Waypoints -> Do you just use while loops on x,y,z values? menu

User Tag List

Results 1 to 7 of 7
  1. #1
    zewt's Avatar Member
    Reputation
    13
    Join Date
    Nov 2008
    Posts
    127
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Waypoints -> Do you just use while loops on x,y,z values?

    Question to the bot programmers here.

    I am programming a SWTOR bot and i have it reading x y and z values.

    Now... my question... for running waypoints do you just run while loops?

    ie:

    HTML Code:
    while $xVal > -87
        send("{w down}");
    wend
    If not.. what are some other ways of running the waypoints?

    Can you give some examples?

    Appreciate it!

    Waypoints -> Do you just use while loops on x,y,z values?
  2. #2
    dook123's Avatar Active Member
    Reputation
    21
    Join Date
    Oct 2008
    Posts
    115
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by zewt View Post
    Question to the bot programmers here.

    I am programming a SWTOR bot and i have it reading x y and z values.

    Now... my question... for running waypoints do you just run while loops?

    ie:

    HTML Code:
    while $xVal > -87
        send("{w down}");
    wend
    If not.. what are some other ways of running the waypoints?

    Can you give some examples?

    Appreciate it!
    That is one way to do it but its not very accurate. I have not done it but you should also be able to write to memory or use the CTM system. Of course that would take more work. The way you are trying to do it would probably not work very well either, it needs to be something like

    Code:
    while(!Near($X, $Y, $Z))
    {
      MoveCloser();
    }
    Where Near would produce a result based on being "close" to the designated coordinates. MoveCloser would do some movement, but it wouldn't necessarily be "W" key every time.
    ------------------------------
    If not me than who?

  3. #3
    zewt's Avatar Member
    Reputation
    13
    Join Date
    Nov 2008
    Posts
    127
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by dook123 View Post
    That is one way to do it but its not very accurate. I have not done it but you should also be able to write to memory or use the CTM system. Of course that would take more work. The way you are trying to do it would probably not work very well either, it needs to be something like

    Code:
    while(!Near($X, $Y, $Z))
    {
      MoveCloser();
    }
    Where Near would produce a result based on being "close" to the designated coordinates. MoveCloser would do some movement, but it wouldn't necessarily be "W" key every time.

    Thanks... but this raises a new question.

    If the x coordinates value is lets say 1005... and i write 1008 to the address my character will actually *RUN in game* to 1008? ... I would think all it would know to do is teleport me there.

    Your second solution seems more reasonable but will require me to code a custom function for detecting which way to run to get on the waypoint path. aka.. run left. oh wait im further now, turn back right and run to value... run right.. oh wait im further from the waypoint now, turn left and run to waypoint.

  4. #4
    Nomoko's Avatar Member
    Reputation
    7
    Join Date
    Dec 2011
    Posts
    60
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Creating a navigation System based on just the coords and angles, needs a bit of basic math. You cant just write the position to it and the character runs there(ofc with a CTM function that would be possible, if you find it).

  5. #5
    zewt's Avatar Member
    Reputation
    13
    Join Date
    Nov 2008
    Posts
    127
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Nomoko View Post
    Creating a navigation System based on just the coords and angles, needs a bit of basic math. You cant just write the position to it and the character runs there(ofc with a CTM function that would be possible, if you find it).

    Thanks Nomoko.

    So your saying with some basic math i can build a function to find waypoints and run paths. I agree with this.

    Im guessing CTM means Character Move? And your talking about hooking that function in the game?

  6. #6
    Nomoko's Avatar Member
    Reputation
    7
    Join Date
    Dec 2011
    Posts
    60
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah it is not that hard. CTM is click to move and yes

  7. #7
    tearf's Avatar Private
    Reputation
    5
    Join Date
    Jan 2012
    Posts
    8
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Before I cancelled my subscription (went on a vacation and now I'm debating whether I want to restart it or not...) I approached this problem by asking two different questions. Do I need to turn? Do I need to move closer?

    My target going into this was either a mob if I had a hostile target and if there wasn't one then the next waypoint.

    Do I need to turn was answered by this function, which was passed the angle (degrees) to the target, the angle (degrees) I was currently facing, and how far away the target actually was (meters). If I was more than 3 meters away and was within +/- 15 degrees of ideal I figured that was good enough and didn't need to turn, and if I was within 3 meters then the tolerance jumped to +/- 90 degrees so basically if I'm that close I'd turn only if the target is actually behind me.
    Code:
        Function NeedToTurn(ByVal decTargetR As Decimal, ByVal sngPlayerAngle As Single, ByVal sngDistanceToTarget As Single) As Boolean
            Return _
                (Math.Abs(decTargetR - sngPlayerAngle) > 90 And sngDistanceToTarget > 0 And sngDistanceToTarget <= 3) Or _
                    (Math.Abs(decTargetR - sngPlayerAngle) > 15 And sngDistanceToTarget > 0 And sngDistanceToTarget > 3)
        End Function
    This is the code that uses the function and actually does the turning. When this is called we could be already holding W down if we need to move closer:
    Code:
                If NeedToTurn(decAngleToTarget, sngPlayerAngle, sngDistanceToTarget) Then
                    Dim t As Decimal = (decAngleToTarget - sngPlayerAngle)
                    WriteLog("Facing " & sngPlayerAngle & " need " & decAngleToTarget & " : t = " & t)
                    Dim intTurn As Integer = 0
                    If (t > 0 And t < 180) Then
                        intTurn = Keys.A
                    Else
                        intTurn = Keys.D
                    End If
                        WriteLog("Turning...")
                        If Math.Abs(decAngleToTarget - sngPlayerAngle) > 100 Then
                            WriteLog("He's behind you!! Stop running!")
                            ReleaseKey(Keys.W)
                        End If
    
                        HoldKey(intTurn)
                        Do While NeedToTurn(decAngleToTarget, sngPlayerAngle, sngDistanceToTarget) 
                            System.Threading.Thread.Sleep(100)
                            Application.DoEvents()
                            ReadProcessMemoryFloat(readHandle, intMemBasePlayer + &H114, sngPlayerAngle, 4, Nothing) 
                            WriteLog("Facing " & sngPlayerAngle & " need " & decAngleToTarget)
                        Loop
                        ReleaseKey(intTurn)
                    End If
                End If
    For moving closer, it was a simple comparison of how far we are from the target versus how far we want to be. If we want to be closer then start holding down W and if we're close enough then release it. There's also a simple check to make sure we're actually moving if we think we are.

    Code:
                If sngDistanceToTarget > FightingRange And Not hshKeysHeld.ContainsKey(CInt(Keys.W)) Then
                    WriteLog("Start walking - distance " & sngDistanceToTarget & "m")
                    HoldKey(Keys.W)
                ElseIf sngDistanceToTarget <= FightingRange And hshKeysHeld.ContainsKey(CInt(Keys.W)) Then
                    ReleaseKey(Keys.W)
                ElseIf hshKeysHeld.ContainsKey(CInt(Keys.W)) And decLastRunX = fltPlayerX And decLastRunY = fltPlayerY Then
                    ReleaseKey(Keys.W)
                Else
                    decLastRunX = fltPlayerX
                    decLastRunY = fltPlayerY
                End If
    One other piece was my calculation for getting the angle to the target. It works, but it's messy. I'm sure somebody who isn't as rusty with trigonometry as I am could make it work in much fewer steps :-)
    Code:
        Function CalculateAngleToTarget(ByVal fltPlayerX As Single, ByVal fltPlayerY As Single, ByVal fltTargetX As Single, ByVal fltTargetY As Single) As Decimal
            Dim decTargetR As Decimal
            decTargetR = Math.Atan2(fltTargetY - fltPlayerY, fltTargetX - fltPlayerX)
            If decTargetR < 0 Then decTargetR = decTargetR + (Math.PI * 2)
            decTargetR = (decTargetR * 180) / Math.PI
            decTargetR = decTargetR + 90
            If decTargetR > 360 Then decTargetR = decTargetR - 360
            If decTargetR > 180 Then decTargetR = 180 - (decTargetR - 180) Else decTargetR = -1 * decTargetR
            Return decTargetR
        End Function

Similar Threads

  1. Keep a trophy case of those you scammed using MSN
    By Elephant in forum WoW Scam Prevention
    Replies: 9
    Last Post: 10-03-2007, 04:34 AM
  2. Who of you just got banned?
    By Drako in forum World of Warcraft General
    Replies: 1
    Last Post: 05-06-2007, 08:21 PM
  3. You Just Got Mmowned!
    By Bloodpoisen in forum World of Warcraft General
    Replies: 9
    Last Post: 03-30-2007, 03:37 PM
  4. Music that you listen to while playing wow
    By Suds in forum World of Warcraft General
    Replies: 45
    Last Post: 02-19-2007, 04:36 PM
All times are GMT -5. The time now is 03:36 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search