[AutoIt] Some functions menu

User Tag List

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

    [AutoIt] Some functions

    Started messing around with memory reading in autoit figured I could at least post some of my results. All the memory locs I pretty much found here. Only inculdes you really need are Math.au3 and NomadMemory.au3. The incombat function is kinda a work in progress bitwise operations in autoit seemed screwy when I was testing it.

    Code:
    ;**********************************************************************
    ;** Baically tells if you are in combat or not, yes the way it's calculated is gimp...
    ;** Didn't have a real choice since doing a BitAND between 0x00080000 and
    ;** byte[4] of the real flags yeilded me with 0 combat or not...go go Autoit
    ;**********************************************************************
    Func _inCombat($handle)
    	$Obj = _WoWPlayerBase($handle)
    	$lvl1Pointer = _MemoryRead($Obj + 0x8,$handle,'ptr')
    	$Flags = _MemoryRead($lvl1Pointer + 0x3A * 4,$handle,'int')
    	If $Flags > 8 AND $Flags <> 33554440 Then
    		return 1
    	EndIf
    	return 0
    EndFunc
    
    ;**********************************************************************
    ;** Basically this will return an array with the name of the zone and subzone
    ;** [0] - Real Zone	[1] - Sub Zone
    ;**********************************************************************
    Func _WoWZoneInfo($handle)
    	Dim $zone[2]
    	$ptrRZ = _MemoryRead(0x010A68B4,$handle,'ptr')  	;(p) pointer to real zone
    	$ptrSZ = _MemoryRead(0x010A68B8,$handle,'ptr')		;(p) pointer to sub zone
    	$zone[0] = _MemoryRead($ptrRZ,$handle,'char[32]')
    	$zone[1] = _MemoryRead($ptrSZ,$wow,'char[32]')
    	return $zone
    EndFunc
    
    ;**********************************************************************
    ;**  Returns the faction id of target or yourself based on loc given.
    ;**********************************************************************
    Func _WoWFactionID($loc,$handle)
    	If $loc = "me" Then
    		$Obj = _WoWPlayerBase($handle)
    	ElseIf $loc = "target" Then
    		$Obj = _WoWTargetObj($handle)	
    	EndIf
    	$lvl1Pointer = _MemoryRead($Obj + 0x8,$handle,'ptr')
    	$fID = _MemoryRead($lvl1Pointer + 0x36 * 4,$handle,'int')
    	return $fID
    EndFunc
    
    ;**********************************************************************
    ;**  Will test if a given factionid from previous function is horde.
    ;**********************************************************************
    Func _isHorde($fID)
    	If $fID = 1 OR $fID = 3 OR $fID = 4 OR $fID = 115 OR $fID = 1629 Then
    		return 0
    	ElseIf $fID = 2 OR $fID = 5 OR $fID = 6 OR $fID = 116 OR $fID = 1610 Then
    		return 1
    	EndIf
    EndFunc
    
    ;**********************************************************************
    ;**  Basically will return some target info in the form of an array
    ;** [0] - X			[4] - Rot Ptr
    ;** [1] - Y			[5] - Current HP
    ;** [2] - Z
    ;** [3] - Rotation
    ;**********************************************************************
    Func _WoWTargetInfo($handle)
    	$tObj = _WoWTargetObj($handle)
    	$ptrXLoc = $tObj + 0x7D0
    	$ptrYLoc = $tObj + 0x7D4
    	$ptrZLoc = $tObj + 0x7D8
    	$ptrRotLoc = $tObj + 0x7DC
    	$ptrHealth = $tObj + 0xFF4
    	Dim $tInf[6]
    	$tInf[0] = _MemoryRead($ptrXLoc,$handle,'float')
    	$tInf[1] = _MemoryRead($ptrYLoc,$handle,'float')
    	$tInf[2] = _MemoryRead($ptrZLoc,$handle,'float')
    	$tInf[3] = _MemoryRead($ptrRotLoc,$handle,'float')
    	$tInf[4] = $ptrRotLoc
    	$tInf[5] = _MemoryRead($ptrHealth,$handle,'int')
    	return $tInf
    EndFunc
    
    ;**********************************************************************
    ;** Basically this will return the target object given the wow handle
    ;**********************************************************************
    Func _WoWTargetObj($handle)
    	$targetGUID = _MemoryRead(0x10A68E0,$handle,'ptr')		;(p)
    	$s_curMgrlvl1Pointer = _MemoryRead(0x011CB310,$wow,'ptr')	;(p)
    	$s_curMgr = _MemoryRead($s_curMgrlvl1Pointer + 0x28A4,$wow,'ptr')	;(p)
    	$curObj = _MemoryRead($s_curMgr + 0xAC,$handle,'ptr')
    	While 1
    		$cGUID = _MemoryRead($curObj + 0x30,$handle,'ptr')
    		If $cGUID = $targetGUID Then
    			return $curObj
    		EndIf
    		$nextObj = _MemoryRead($curObj + 0x3C,$handle,'ptr')
    		if $nextObj = $curObj then
    			return 0
    		else
    			$curObj = $nextObj
    		endif
    	Wend
    EndFunc
    
    ;**********************************************************************
    ;** Sets rotation to a given x/y
    ;**********************************************************************
    Func _WoWSetRot($cordx,$cordy,$handle)
    	$pInfo = _WoWPlayerInfo($handle)
    	$curX = $pInfo[0]
    	$curY = $pInfo[1]
    	$rotNeed = _WoWRotNeeded($cordx,$cordy,$handle)
    	_MemoryWrite($pInfo[4],$handle,$rotNeed,'float')
    EndFunc
    
    ;**********************************************************************
    ;** calculates rotation needed to x/y
    ;**********************************************************************
    Func _WoWRotNeeded($cordx,$cordy,$handle)
    	$pInfo = _WoWPlayerInfo($handle)
    	$curX = $pInfo[0]
    	$curY = $pInfo[1]
    	$rotNeed = _ATAN22($cordy - $cury,$cordx - $curX)
    	If $rotNeed < 0 Then
    		$rotNeed = $rotNeed + ($pi * 2)
    	EndIf
    	return $rotNeed
    EndFunc
    
    ;**********************************************************************
    ;** Moves char to x/y loc b line like
    ;**********************************************************************
    Func _WoWGoTo($cordx,$cordy,$handle,$rotWithin = .05,$distWithin = 2)
    	$i = 0
    	$sChk = 0
    	$lastDist = 10000000
    	Do
    		$pInfo = _WoWPlayerInfo($handle)
    		$curRot = $pInfo[3]
    		$curX = $pInfo[0]
    		$curY = $pInfo[1]
    		$mChk = $curRot - _WoWRotNeeded($cordx,$cordy,$handle)
    		If $mChk < 0 Then
    			$mChk = 0 - $mChk
    		EndIf
    		$dist = _Max(($curX + $curY),($cordx + $cordy)) - _Min(($curX + $curY),($cordx + $cordy))
    		If $mChk > $rotWithin OR $dist > 3 OR $lastDist > $dist Then
    			_WoWSetRot($cordx,$cordy,$handle)
    		EndIf
    		If $i = 1 AND $lastDist = $dist Then
    			$sChk = $sChk + 1
    		EndIf
    		$lastDist = $dist
    		$i = 1
    		Send("{w down}")
    	Until $dist < $distWithin OR $pInfo[5] = 0 OR $sChk > 25 
    	Send("{w up}")
    EndFunc
    
    ;**********************************************************************
    ;** Returns the playerbase
    ;**********************************************************************
    Func _WoWPlayerBase($handle)
    	$lvl1Pointer = _MemoryRead(0x0127F13C,$handle,'ptr')	;(p)
    	$lvl2Pointer = _MemoryRead($lvl1Pointer + 0x30,$handle,'ptr')
    	$pBase = _MemoryRead($lvl2Pointer + 0x28,$handle,'ptr')
    	return $pBase
    EndFunc
    
    ;**********************************************************************
    ;** Returns array with some player info in it
    ;** [0] - X			[4] - Rot Ptr
    ;** [1] - Y			[5] - Current HP
    ;** [2] - Z
    ;** [3] - Rotation
    ;**********************************************************************
    Func _WoWPlayerInfo($handle)
    	$PlayerBase = _WoWPlayerBase($handle)
    	$ptrXLoc = $PlayerBase + 0x7D0
    	$ptrYLoc = $PlayerBase + 0x7D4
    	$ptrZLoc = $PlayerBase + 0x7D8
    	$ptrRotLoc = $PlayerBase + 0x7DC
    	$ptrHealth = $PlayerBase + 0xFF4
    	Dim $pInf[7]
    	$pInf[0] = _MemoryRead($ptrXLoc,$handle,'float')
    	$pInf[1] = _MemoryRead($ptrYLoc,$handle,'float')
    	$pInf[2] = _MemoryRead($ptrZLoc,$handle,'float')
    	$pInf[3] = _MemoryRead($ptrRotLoc,$handle,'float')
    	$pInf[4] = $ptrRotLoc
    	$pInf[5] = _MemoryRead($ptrHealth,$handle,'int')
    	return $pInf
    EndFunc
    
    ;**********************************************************************
    ;**  Checks if target or player has a certain buff or debuff based on SpellID.
    ;**********************************************************************
    Func _haveBuff($loc,$bID,$handle)
    	$buffs = _buffIDs($loc,$handle)
    	$i = 0
    	Do
    		If $buffs[$i] = $bID Then
    			return 1
    		EndIf
    		$i = $i + 1
    	Until $i > 79
    	return 0
    EndFunc
    
    ;**********************************************************************
    ;**  Returns an array of all the buffs/debuffs for a given target or player.
    ;**********************************************************************
    Func _buffIDs($loc,$handle)
    	If $loc = "me" Then
    		$Obj = _WoWPlayerBase($handle)
    	ElseIf $loc = "target" Then
    		$Obj = _WoWTargetObj($handle)
    	EndIf
    	$bStart = 0xE34
    	Dim $buffs[80]
    	$bNum = 0
    	Do
    		$buffs[$bNum] = _MemoryRead($Obj + $bStart + ($bNum * 4),$handle,'int')
    		$bNum = $bNum + 1
    	Until $bNum > 79
    	return $buffs
    EndFunc
    
    ;**********************************************************************
    ;**  Checks if you have a certain questID.
    ;**********************************************************************
    Func _haveQuest($qID,$handle)
    	$curQuests = _questIDs($handle)
    	$qCnt = 0
    	While $qCnt < 25
    		If $curQuests[$qCnt] = $qID Then
    			return 1
    		EndIf
    		$qCnt = $qCnt + 1
    	WEnd
    	return 0
    EndFunc
    
    ;**********************************************************************
    ;**  Returns an array of all the questIDs the player has.
    ;**********************************************************************
    Func _questIDs($handle)
    	$PlayerBase = _WoWPlayerBase($handle)
    	$lvl1Pointer = _MemoryRead($PlayerBase + 0x8,$handle,'ptr')
    	$qStart = 0x9E
    	Dim $qID[25]
    	$qNum = 0
    	Do
    		$qID[$qNum] = _MemoryRead($lvl1Pointer + ($qStart + (0x04 * ($qNum))) * 4,$handle,'int')
    		$qNum = $qNum + 1
    	Until $qNum > 24
    	return $qID
    EndFunc
    
    ;**********************************************************************
    ;** Found this somewhere online thought it was better than default atan
    ;**********************************************************************
    Func _ATAN22(Const $NY, Const $NX)
        Const $NPI = 3.14159265358979
        Local $NRESULT
        If IsNumber($NY) = 0 Then
            SetError(1)
            Return 0
        ElseIf IsNumber($NX) = 0 Then
            SetError(1)
            Return 0
        EndIf
        If $NX = 0 Then
            If $NY > 0 Then
                $NRESULT = $NPI / 2
            ElseIf $NY < 0 Then
                $NRESULT = 3 * $NPI / 2
            Else
                SetError(2)
                Return 0
            EndIf
        ElseIf $NX < 0 Then
            $NRESULT = ATan($NY / $NX) + $NPI
        Else
            $NRESULT = ATan($NY / $NX)
        EndIf
        While $NRESULT < 0
            $NRESULT += 2 * $NPI
        WEnd
        Return $NRESULT
    EndFunc

    [AutoIt] Some functions
  2. #2
    Rec Alpam's Avatar Contributor CoreCoins Purchaser
    Reputation
    125
    Join Date
    Mar 2007
    Posts
    304
    Thanks G/R
    3/1
    Trade Feedback
    2 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Good post; KUTGW

    +Rep
    Last edited by Rec Alpam; 03-12-2009 at 11:53 AM.

  3. #3
    Pixion's Avatar Member
    Reputation
    59
    Join Date
    Jan 2008
    Posts
    289
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I won't use them but great post.

  4. #4
    Monstr's Avatar Contributor
    Reputation
    80
    Join Date
    Jan 2009
    Posts
    143
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thx will give u +rep

  5. #5
    Dalord Urgod's Avatar Member
    Reputation
    1
    Join Date
    Feb 2009
    Posts
    18
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    whats wrong with this code?

    I’m trying to learn something new so please be gentle lol
    I am an armature programmer (I don’t do this for a living or have any formal training)
    This code was the result of searching this site and trying to understand C,C++,C#… and convert it to what I have been learning/using .(Autoit) I do not know how to hack WoW.exe but all I’m concerned with for now is in build the logic that will make a fish bot work.
    I have the bot working using Pixel search and am now working on making it read directly from mem.
    I know there are some great fish bots freely available here but I enjoy coding my own stuff and seeing it actually work
    Thanks

    [
    Code:
    Func _Bobber()
    	$s_curMgrlvl1Pointer = _MemoryRead(0x011CB310, $wow, 'ptr') ;3.0.9
    	$s_curMgr = _MemoryRead($s_curMgrlvl1Pointer + 0x28A4, $wow, 'ptr') ;3.0.9
    	$curObj = _MemoryRead($s_curMgr + 0xAC, $wow, 'ptr');0xAC
    	$BobberState = _MemoryRead($curObj + 0x14, $wow, 'int');3.0.9
    	If $BobberState = 5 Then
    		$dwDescriptor = _MemoryRead($curObj + 0x8, $PlayerBase, 'ptr')
    		If _MemoryRead($dwDescriptor + (0x6 * 4), $wow, 'ptr') = $PLAYERNAME Then
    			GUICtrlSetData($Bobberstats, "Bobber found")
    		EndIf
    	Else
    		GUICtrlSetData($Bobberstats, "Bobber Not found")
    	EndIf
    EndFunc   ;==>_Bobber

  6. #6
    lanman92's Avatar Active Member
    Reputation
    50
    Join Date
    Mar 2007
    Posts
    1,033
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You have to parse through all of the objects until you find the one that is yours. There is a pointer in each instance of the C_Object class to the next object in the ObjManager. Go through each object until you find the one that you own, and check it's type. Then check animation state on a loop, at 216(decimal)...i think. Then call interact if you're doing it that way, I'm guessing you're using mouse clicks though as you're using autoit... No offense to Unknowned :P

  7. #7
    Dalord Urgod's Avatar Member
    Reputation
    1
    Join Date
    Feb 2009
    Posts
    18
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thanks

    Thank You for the reply

Similar Threads

  1. How to get some function with tracking?
    By csoldjb in forum WoW Memory Editing
    Replies: 0
    Last Post: 06-20-2015, 11:31 AM
  2. 3.0.2 some function/pointer addresses
    By g3gg0 in forum WoW Memory Editing
    Replies: 6
    Last Post: 11-04-2008, 12:23 AM
  3. Some Useful AutoIT Scripts
    By barnyonfire1 in forum World of Warcraft Bots and Programs
    Replies: 21
    Last Post: 11-22-2006, 01:25 AM
All times are GMT -5. The time now is 06:52 PM. 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