Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 18:52

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

Advertisement



Waypoint Script

Discussion on Waypoint Script 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

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 .

Jetzt wollte ich euch mal fragen ob ihr kurz drüber gucken könnt und Fehler entdeckt! Danke schonmal.

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
			OpenAionMemory()
			$Run = True
			while $Run = True
			walkPoints()
			wend


		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  
Reply


Similar Threads Similar Threads
[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.
Waypoint
12/29/2008 - Guild Wars - 4 Replies
hab das Tool Waypointer runtergeladen und krieg da ja son echt schönen text mit : moveto(bblblbla) , hat einer die func von _moveto oder was muss ich machen um die daten zum "rumlaufen in Gw" zu nutzen? (mir ist schon klar das man damit gut die Spawnpunkte bestimmen kann und dann laufen könnte aber ich würde gerne mit dem "moveto" das Ganze regeln). würde mich über Antworten freuen



All times are GMT +1. The time now is 18:52.


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.