Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 02:33

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Waypoint Script Problem

Discussion on Waypoint Script Problem within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: May 2009
Posts: 191
Received Thanks: 19
Waypoint Script Problem

Hey Leute,
habe ein Problem mit meinen Script:

Es soll Koordinaten (X,Y,Z) aufnehmen und in einer Datei speichern. Danach liest das Programm die Koordinaten wieder ein. Bis dahin funktioniert alles auch gut, aber dann tritt ein Problem auf:

Das Programm soll nun im Spiel die gespeicherten Koordinaten entlanglaufen. Das funktioniert jedoch nicht, denn mein Charakter dreht sich nur im Kreis.

Ich hoffe, dass ihr den Fehler findet und mir helfen könnt.

Hier das Script:
Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <nomadmemory.au3>
#RequireAdmin


Global $wpField[1000]
Global $i =0
Global $countMax=0
Global $Run = False
Global $openmem = 0
global $status
global $rot_down = "a down"
global $rot_up = "a up"
global $pi = 3.14159265358979323846264338327950

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 311, 122, 192, 124)
$WpsaveInput = GUICtrlCreateInput("", 16, 16, 97, 21)
$Button1 = GUICtrlCreateButton("Button1", 16, 40, 97, 25)
$Wpfileinput = GUICtrlCreateInput("", 176, 16, 89, 21)
$Button2 = GUICtrlCreateButton("Button2", 176, 40, 97, 25)
$Button3 = GUICtrlCreateButton("Button3", 104, 96, 73, 25)
$status = GUICtrlCreateLabel("", 8, 64, 244, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg

        case $Button1
            OpenAionMemory()
            AddWp()

        case $Button2
            readWP()

        case $Button3
            walkPoints()


        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd



Func OpenAionMemory()
    $pid = ProcessExists("AION.bin")
    If $pid == -1 Then
        Return
    EndIf
    $openmem = _MemoryOpen($pid)
    If @error Then
        Return
    EndIf
    $AionRun = True
EndFunc


Func MemReadDLLFloat($offset)
    $StaticOffset = Dec($offset)
    Global $pid
    Global $CUROffset[1]
    $CUROffset[0] = 0
    $baseADDR = _MemoryModuleGetBaseAddress($pid, "Game.dll")
    $finalADDR = "0x" & Hex($baseADDR + $StaticOffset)
    $MemTest = _MemoryRead($finaladdr,$openmem,"float")
    Return $MemTest
EndFunc





Func PlayerXPos()
    return MemReadDLLFloat("BF0A9C")
EndFunc

Func PlayerYPos()
    return MemReadDLLFloat("BF0AA0")
EndFunc

Func PlayerZPos()
    return MemReadDLLFloat("BF0AA4")
EndFunc

Func GetPlayerPos()
    Return MemReadDLLFloat("BECC6C")
EndFunc

Func addWP()

    $playerX = PlayerXPos()
    $playerY = PlayerYPos()
    $playerZ = PlayerZPos()

    $WPFile = "wp"

    $openFile = GuiCtrlRead($wpSaveInput)
    $wpSave = FileOpen($openFile, 1)

    FileWriteLine($wpSave ,Round($playerX,2))
    FileWriteLine($wpSave ,Round($playerY,2))
    FileWriteLine($wpSave ,Round($playerZ,2))
    FileClose($wpSave)
    _toolTip("WayPoint: "&Round($playerX,0)&" - "&Round($playerY,0)&" - "&Round($playerZ,0)&" added")
EndFunc

Func readWP()
    $countMax=0
    $count = 1
    $openFile = GuiCtrlRead($wpFileInput)
    $readWPfile = FileOpen($openFile, 0)

    While 1
        $x1 = FileReadLine($readWPfile,$count)

        if $x1 = "" Then
            $count = 1
            ExitLoop
        EndIf

        If @error = -1 Then    ExitLoop
        $count = $count +1
        $countMax = $countMax +1
        $x2 = FileReadLine($readWPfile,$count)
        $count = $count +1
        $countMax = $countMax +1
        $x3 = FileReadLine($readWPfile,$count)
        $count = $count +1
        $countMax = $countMax +1


    Wend
    FileClose($readWPfile)


    $openFile = GuiCtrlRead($wpFileInput)
    $readWPfile = FileOpen($openFile, 0)

    While 1

        $x1 = FileReadLine($readWPfile,$count)

        if $x1 = "" Then

            $count = 1
            ExitLoop
        EndIf

        If @error = -1 Then    ExitLoop

        $wpField[$count-1] = $x1

        $count = $count +1

        $x2 = FileReadLine($readWPfile,$count)
        $wpField[$count-1] = $x2

        $count = $count +1

        $x3 = FileReadLine($readWPfile,$count)
        $wpField[$count-1] = $x3

        $count = $count +1




    Wend
    _toolTip("Waypoints loaded ... "&$countMax/3&" found" )
    FileClose($readWPfile)

EndFunc

Func walkPoints()
    while $i < ($countMax-1)
        WinActivate("AION Client")
        WinWaitActive("AION Client")
        _toolTip("Move to waypoint "&($i/3)+1)
        $xCoord=$wpField[$i]
        $yCoord=$wpField[$i+1]
        $zCoord=$wpField[$i+2]
        $i=$i+3

        $Distance = calcDist($xCoord,$yCoord)
        while $Distance > 3
            alignRotaion($xCoord, $yCoord, true)
        WEnd

        If $Run = False Then
            Send("{w up}")
            ExitLoop

        EndIf
    WEnd
EndFunc

Func _toolTip($msg)
    GUICtrlSetData($status,$msg)
EndFunc

Func calcDist($xa,$ya)
    $distCalc = sqrt( ($xa-PlayerXPos())^2 + ($ya-PlayerYPos())^2 )
    if($distCalc > 15) Then
    EndIf
    return $distCalc
EndFunc

Func alignRotaion($x, $y, $move = false)
    $playerXcoord = PlayerXPos()
    $playerYcoord = PlayerYPos()

    $diffY = Round($y - $playerYcoord,2)
    $diffX = Round($x - $playerXcoord,2)
    $angle = getAngle($diffX, $diffY)
    $nowAng = getThreeSixty(GetPlayerPos(), true)
    _switchRotate($angle, $nowAng)
    While ($angle + 5) < $nowAng OR ($angle - 5) > $nowAng
        if $move Then
            Send("{w down}")
        EndIf
        Send("{"&$rot_down&"}")
        $nowAng = getThreeSixty(GetPlayerPos(), true)
    WEnd
    if $move Then
        if(($angle + 5) < $nowAng AND ($angle - 5) > $nowAng) Then
            Send("{w up}")
        EndIf
    EndIf
    Send("{"&$rot_up&"}")
EndFunc

Func getAngle($diffX, $diffY)
    $angle = ATan($diffY/$diffX)
    $angle = ($angle * 180.0 )/ $pi
    if $diffX > 0 and $diffY > 0 Then
        return getThreeSixty((180 -$angle),true)
    ElseIf $diffX > 0 and $diffY < 0 Then
        return getThreeSixty((-180 -$angle),true)
    ElseIf $diffX < 0 and $diffY < 0 Then
        return getThreeSixty((0 -$angle),true)
    ElseIf $diffX < 0 and $diffY > 0 Then
        return getThreeSixty((0 -$angle),true)
    EndIf
EndFunc

Func getThreeSixty($angle, $flag = false)
    If($flag) Then
        If($angle < 0) Then
            $angle = (360 - ($angle * -1))
        EndIf
    Else
        If($angle > 360)Then
            $angle = $angle - 360
        ElseIf($angle < 0)Then
            $angle = $angle + 360
        EndIf
    EndIf
    Return $angle
EndFunc

Func _switchRotate($target, $now)
    if($target < $now) Then
        If(($now - $target) > 180) Then
            $rot_down = "a down"
            $rot_up = "a up"
        Else
            $rot_down = "d down"
            $rot_up = "d up"
        EndIf
    Else
        If(($target - $now) > 180) Then
            $rot_down = "d down"
            $rot_up = "d up"
        Else
            $rot_down = "a down"
            $rot_up = "a up"
        EndIf
    EndIf
EndFunc
Skatefreaky is offline  
Old 07/25/2012, 09:24   #2
 
elite*gold: 0
Join Date: Jun 2012
Posts: 8
Received Thanks: 0
Dein Problem gleich in 2 Foren zu posten wird dir auch nicht weiterhelfen.

lg chess
Nanairo is offline  
Old 07/25/2012, 18:09   #3
 
elite*gold: 2
Join Date: Nov 2011
Posts: 318
Received Thanks: 273
Deine Antwort zu Posten wird ihm auch nicht helfen.
Ich habe mir dein Script nicht genauer angeschaut, jedoch habe ich in einem anderen Spiel dasselbe gemacht und er lief trotz mehreren Waypoints immer nur zu einer Stelle.
Das Lag vorallen daran das durch das Memorywrite direkt der Wert beschrieben wurde und er direkt zum nächsten Wert gesprungen ist. Habs mit einer If Abfrage überprüft.
Die Lösung lag daran das ich noch die Koordinaten des zu erreichenden Punktes eingelesen und abgeglichen habe.

Vllt. wäre es noch sinnvoll wenn du die Funktionen
OpenAionMemory()
AddWp()
genauer beschreiben könntest.
SingularPlex is offline  
Reply


Similar Threads Similar Threads
Waypoint Script
05/02/2012 - AutoIt - 0 Replies
Hallo Com, habe jetzt mal ein kleines Waypoint-Script erstellt. Das ganze funktioniert auch soweit, nur dass er in eine total andere Richtung als in die gespeicherte läuft :o. Jetzt wollte ich euch mal fragen ob ihr kurz drüber gucken könnt und Fehler entdeckt! Danke schonmal. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3>
[D2NT Release] Nice Waypoint Give Script
01/17/2011 - Diablo 2 Programming - 9 Replies
Tell me if you like the idea of this script. You can make other script for leeches to take those waypoints automatically. Its pretty much possible ;-) * WAYPOINT COMMANDS! * * Give Wps 1, Give Wps 2, Give Wps 3, Give Wps 4, Give Wps 5, will give other people the waypoints in an individual act * Give Wps All = gives every waypoint in the game except halls of pain * Give Wps Stop - stops script
[D2NT TheBluebird v1.1] Beta: Waypoint-Script
12/26/2010 - Diablo 2 Programming - 3 Replies
Hey! Ich bin jetzt erstmal für ein paar Tage in Österreich und wollte euch in der Zeit die Chance geben, ein neues Script zu testen: Das Waypoint-Script! Wie der Name schon sagt, gibt euch der Bot die einzelnen Wegpunkte eines jeden Aktes. Er macht ein TP, wartet, bis ihr durchgegangen seid und macht, sobald ihr wieder in der Town steht, das nächste TP usw. Voraussetzung:
waypoint leech script?
07/21/2010 - Diablo 2 - 7 Replies
moin ^^ erstmal sorry, ich glaube ich hatte sowas in der richtung hier schonmal gesehen - aber finds irgendwie nimmer ^^ gibts irgendwo ein waypoint leech script dass beide chars steuert? also einen zum wps geben und den anderen zum annehmen^^ danke schonmal im voraus ^^
Script - Waypoint Catcher
07/15/2010 - Diablo 2 - 13 Replies
Hallo, wollt mal fragen obs für den D2NT ein Waypoint Catcher Script gibt? Also der Bot soll praktisch alle Waypoints selber finden und annehmen. Wusste jetzt nicht genau ob ichs ins Sternlooper oder Bluebird oder sonst wo hin schreiben soll deshalb "schuldig im Sinne vll." umsonst neuen Thread gemacht zu haben. Bin für jede Hilfe dankbar.



All times are GMT +1. The time now is 02:33.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.