Jump to content
Sign in to follow this  
Rorka

Do... Until...

Recommended Posts

Rorka

I want my code to do send("{left down}{Left up}") untill the Current Rotation is close or exact to the user input...

Here is my code

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <NomadMemory.au3>


$Playerbase = 0x010BD5F4
$Off1=0x34
$Off2=0x24
$Playerrotation = 0x7A8


SETPRIVILEGE("SeDebugPrivilege", 1)
Dim $ProPID = WinGetProcess("World of Warcraft")
$wowprocess = _MemoryOpen($ProPID)



#Region ### START Koda GUI section ### Form=
$MainGUI = GUICreate("Move rot", 235, 129)
$plrrot = GUICtrlCreateLabel("Current rotation:", 8, 8, 200, 17)
$Group1 = GUICtrlCreateGroup("Move rotation to:", 8, 32, 217, 49)
$moveto = GUICtrlCreateInput("3", 16, 48, 201, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$pointerbut = GUICtrlCreateButton("Get Rotation", 8, 88, 75, 25, 0)
$move = GUICtrlCreateButton("Move", 152, 88, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $move
            _move()
EndSwitch
    _getpointers()
WEnd


Func _move()
$readinput = GUICtrlRead($moveto)
            
Do
Send("{Left down}{Left up}")
Until GUICtrlRead($plrrot) = < $readinput-1 > $readinput
EndFunc

Func _Getpointers()
    Global $LVL1POINTER = _MemoryRead($Playerbase, $wowprocess, "ptr")
    Global $LVL2POINTER = _MemoryRead(($LVL1POINTER + $Off1), $wowprocess, "ptr")
    Global $PlayerMEM = _MemoryRead(($LVL2POINTER+ $Off2), $wowprocess, "ptr")
    Global $Rotationread = $PlayerMEM + $Playerrotation
    
If GUICtrlRead($plrrot) = "Current Rotation: " & _MEMORYREAD($Rotationread, $wowprocess, "float") Then
    Sleep(10)
Else
    Update()
EndIf

EndFunc


Func Update()
GUICtrlSetData($plrrot, "Current Rotation: " & _MEMORYREAD($Rotationread, $wowprocess, "float"))
EndFunc

It errors, but im not sure why...

Share this post


Link to post
Share on other sites
monoceres

This line:

Until GUICtrlRead($plrrot) = < $readinput-1 > $readinput

Should be something like:

Until GUICtrlRead($plrrot) = < $readinput-1 And GUICtrlRead($plrrot) > $readinput

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
Rorka

Thanks, but it still errors...

C:\Users\Ashley\Desktop\move rot.au3(49,30) : ERROR: syntax error
Until GUICtrlRead($plrrot) = <
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

Share this post


Link to post
Share on other sites
monoceres

Thanks, but it still errors...

C:\Users\Ashley\Desktop\move rot.au3(49,30) : ERROR: syntax error
 Until GUICtrlRead($plrrot) = <
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
Oops, yeah '=<' should be '<='

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
Rorka

Oops, yeah '=<' should be '<='

Okay, fixed that... but now it never stops... and the Hotkey doesnt work

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <NomadMemory.au3>


HotKeySet("{f5}", "_exit")

;settings -----------------
$Playerbase = 0x010BD5F4
$Off1=0x34
$Off2=0x24
$Playerrotation = 0x7A8


SETPRIVILEGE("SeDebugPrivilege", 1)
Dim $ProPID = WinGetProcess("World of Warcraft")
$wowprocess = _MemoryOpen($ProPID)


#Region ### START Koda GUI section ### Form=
$MainGUI = GUICreate("Move rot", 235, 129)
WinSetTrans($MainGUI, 0, 170)
$plrrot = GUICtrlCreateLabel("Current rotation:", 8, 8, 200, 17)
$Group1 = GUICtrlCreateGroup("Move rotation to:", 8, 32, 217, 49)
$moveto = GUICtrlCreateInput("3", 16, 48, 201, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$pointerbut = GUICtrlCreateButton("Get Rotation", 8, 88, 75, 25, 0)
$move = GUICtrlCreateButton("Move", 152, 88, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
WinSetOnTop("Move rot", "", 1)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $move
            WinActivate("World of Warcraft")
            Sleep(2000)
            _move()
EndSwitch
    _getpointers()
WEnd


Func _move()
$readinput = GUICtrlRead($moveto)
            
Do
Send("{Left down}{Left up}")
sleep(Random(3,20))
_getpointers()
Until GUICtrlRead($plrrot) <= $readinput-0.4 And GUICtrlRead($plrrot) >= $readinput+0.4
;Until GUICtrlRead($plrrot) = $readinput
EndFunc

Func _Getpointers()
    Global $LVL1POINTER = _MemoryRead($Playerbase, $wowprocess, "ptr")
    Global $LVL2POINTER = _MemoryRead(($LVL1POINTER + $Off1), $wowprocess, "ptr")
    Global $PlayerMEM = _MemoryRead(($LVL2POINTER+ $Off2), $wowprocess, "ptr")
    Global $Rotationread = $PlayerMEM + $Playerrotation
    
If GUICtrlRead($plrrot) = "Current Rotation: " & _MEMORYREAD($Rotationread, $wowprocess, "float") Then
    Sleep(10)
Else
    Update()
EndIf

EndFunc


Func Update()
GUICtrlSetData($plrrot, "Current Rotation: " & _MEMORYREAD($Rotationread, $wowprocess, "float"))
EndFunc

Func _exit()
Exit
EndFunc

EDIT: Changed code

Edited by Rorka

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.