Sign in to follow this  
Followers 0
SPUDMAN

Help with Hex macro

2 posts in this topic

I have found a macro i have been trying to edit for a game I play but im an AutoIt noob and still hard for me to fix this up. Code is as follows:

#include <String.au3>

#include <Mem.au3>

#include <Array.au3>

Func _HexadecimalToDecimal($var)

$result = 0

$sum = 0

$power=0

Do

$currentDigit = StringRight(_MemRev($var),$power+1)

$currentDigit = StringLeft($currentDigit,1)

If $currentDigit = "A" Then

$currentDigit = 10

ElseIf $currentDigit = "B" Then

$currentDigit = 11

ElseIf $currentDigit = "C" Then

$currentDigit = 12

ElseIf $currentDigit = "D" Then

$currentDigit = 13

ElseIf $currentDigit = "E" Then

$currentDigit = 14

ElseIf $currentDigit = "F" Then

$currentDigit = 15

EndIf

$result=$currentDigit*16^$power

$power = $power + 1

$sum = $sum + $result

Until $currentDigit = "x"

Return $sum

EndFunc;==>_HexadecimalToDecimal

$Process = "Conquer.exe"

$Pid = ProcessExists($Process)

$h_open = _MemOpen($pid)

$ReadX = _MemRead($h_open,0x4FE53C,4)

$XCoord = _HexadecimalToDecimal($ReadX)

$ReadY = _MemRead($h_open,0x4FE540,4)

$YCoord = _HexadecimalToDecimal($ReadY)

_MemClose($h_open)

$MyCx=$XCoord

$MyCy=$YCoord

$WP=0

$WP1x=471

$WP1y=753

$WP2x=515

$WP2y=688

$WP3x=612

$WP3y=763

$WP4x=520

$WP4y=746

func gotoWP ()

$Process = "Conquer.exe"

$Pid = ProcessExists($Process)

$h_open = _MemOpen($pid)

$ReadX = _MemRead($h_open,0x4FE53C,4)

$XCoord = _HexadecimalToDecimal($ReadX)

$ReadY = _MemRead($h_open,0x4FE540,4)

$YCoord = _HexadecimalToDecimal($ReadY)

_MemClose($h_open)

$MyCx=$XCoord

$MyCy=$YCoord

IF $MyCx >= $WP1x AND $MyCx-20< $WP1x AND $MyCy >= $WP1y AND $MyCy-20 < $WP1y Then

$WP=1

Endif

IF $MyCx >= $WP2x AND $MyCx-20< $WP2x AND $MyCy >= $WP2y AND $MyCy-20 < $WP2y Then

$WP=2

Endif

IF $MyCx >= $WP3x AND $MyCx-20< $WP3x AND $MyCy >= $WP3y AND $MyCy-20 < $WP3y Then

$WP=3

Endif

IF $MyCx >= $WP4x AND $MyCx-20< $WP4x AND $MyCy >= $WP4y AND $MyCy-20 < $WP4y Then

$WP=0

Endif

Select

Case $WP=0

IF $MyCx >= $WP1x AND $MyCy >= $WP1y Then

Move1()

Endif

IF $MyCx <= $WP1x AND $MyCy <= $WP1y Then

Move4()

Endif

IF $MyCx <= $WP1x AND $MyCy >= $WP1y Then

Move2()

Endif

IF $MyCx >= $WP1x AND $MyCy <= $WP1y Then

Move3()

Endif

Case $WP=1

IF $MyCx >= $WP2x AND $MyCy >= $WP2y Then

Move1()

Endif

IF $MyCx <= $WP2x AND $MyCy <= $WP2y Then

Move4()

Endif

IF $MyCx <= $WP2x AND $MyCy >= $WP2y Then

Move2()

Endif

IF $MyCx >= $WP2x AND $MyCy <= $WP2y Then

Move3()

Endif

Case $WP=2

IF $MyCx >= $WP3x AND $MyCy >= $WP3y Then

Move1()

Endif

IF $MyCx <= $WP3x AND $MyCy <= $WP3y Then

Move4()

Endif

IF $MyCx <= $WP3x AND $MyCy >= $WP3y Then

Move2()

Endif

IF $MyCx >= $WP3x AND $MyCy <= $WP3y Then

Move3()

Endif

Case $WP=3

IF $MyCx >= $WP4x AND $MyCy >= $WP4y Then

Move1()

Endif

IF $MyCx <= $WP4x AND $MyCy <= $WP4y Then

Move4()

Endif

IF $MyCx <= $WP4x AND $MyCy >= $WP4y Then

Move2()

Endif

IF $MyCx >= $WP4x AND $MyCy <= $WP4y Then

Move3()

Endif

EndSelect

EndFunc

func Move1 ()

$xrand1=Random(341,682,1)

$yrand1=Random(20,256,1)

MouseMove($xrand1,$yrand1,0)

Send("{CTRLDOWN}")

MouseClick("Left")

Send("{CTRLUP}")

Sleep(300)

EndFunc

func Move4 ()

$xrand2=Random(314,682,1)

$yrand2=Random(512,640,1)

MouseMove($xrand2,$yrand2,0)

Send("{CTRLDOWN}")

MouseClick("Left")

Send("{CTRLUP}")

Sleep(300)

EndFunc

func Move2 ()

$xrand3=Random(512,1000,1)

$yrand3=Random(256,512)

MouseMove($xrand3,$yrand3,0)

Send("{CTRLDOWN}")

MouseClick("Left")

Send("{CTRLUP}")

Sleep(300)

EndFunc

func Move3 ()n

$xrand4=Random(20,314)

$yrand4=Random(384,640)

MouseMove($xrand4,$yrand4,0)

Send("{CTRLDOWN}")

MouseClick("Left")

Send("{CTRLUP}")

Sleep(300)

EndFunc

Also i found out that Mem.au3 doesnt exist in my AutoIt files. Could someone try and fix the code and post the Mem.au3 file for me.

If anyone can it would help a lot.

Share this post


Link to post
Share on other sites



To get the mem.au3 use the search facility.

Can you tell us what the problem is you want to solve?

Since you haven't got Mem.au3 you can't have run the script so why did you post it?


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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  
Followers 0