Jump to content

Extremely newbie @ autoit


 Share

Recommended Posts

Very new at this language, actually my first time working with autoit. My situation is very simple. Im playing an mmorpg game and i used CE to get two hex addresses (labeled down below) that constantly change. I want my mouse to click somewhere if all the conditions are met. I got the mouse coords with a separate program.

CombatInProcessMem = 0x00FD99B8

AutoBattleNumber = 0x01A87C98

AutoBattleInCombat = 0x01A87C94

If CombatInProcessMem = 1 AND AutoBattleNumber NOT = 0 AND AutoBattleInCombat = 0 , then click 740, 227 once

All three conditions must be true. CombatInProcessMem has to be 1, AutoBattleNumber has to be any number other than 0, and AutoBattleInCombat must be 1, then i want the mouse to click at "740, 227". It sounds really simple, but i have no idea how to write it in autoit language. Maybe its so simple i shouldnt be using this program... are there any other programs that read memory values and macro at the same time but more simplier?

Also, how do i "hook" it to the application so it reads the memory values?

Edited by woodyfly
Link to comment
Share on other sites

If $CombatInProcessMem = 1 AND $AutoBattleNumber <> 0 AND $AutoBattleInCombat = 0 Then MouseClick('left', 740, 227, 1)

$CombatInProcessMem, $AutoBattleNumber and $AutoBattleInCombat will all be a variables that read the memory addresses you've specified earlier.

Read the help file for the _Mem* function to get a clue of how to implement it. To read other process's memory you need to use _WinAPI_ReadProcessMemory function, though I don't know where you got this addresses from because I can hardly believe that run-time allocations are fixed every time a program/game get launched.

Link to comment
Share on other sites

If $CombatInProcessMem = 1 AND $AutoBattleNumber <> 0 AND $AutoBattleInCombat = 0 Then MouseClick('left', 740, 227, 1)

$CombatInProcessMem, $AutoBattleNumber and $AutoBattleInCombat will all be a variables that read the memory addresses you've specified earlier.

Read the help file for the _Mem* function to get a clue of how to implement it. To read other process's memory you need to use _WinAPI_ReadProcessMemory function, though I don't know where you got this addresses from because I can hardly believe that run-time allocations are fixed every time a program/game get launched.

These addresses are fixed everytime, and they're always the same. Dont know why, dont ask me lol.
Link to comment
Share on other sites

Mind to share it with us?

I just have no idea what im doing, lol.

#include <NomadMemory.au3>

$pid = ProcessExists("Atlantica.exe")

$openmem = _MemoryOpen($pid) ; Open the memory

$CombatInProcessMem = 0x00FD99B8

$AutoBattleNumber = 0x01A87C98

$AutoBattleInCombat = 0x01A87C94

If $CombatInProcessMem = 1 AND $AutoBattleNumber <> 0 AND $AutoBattleInCombat = 0 Then MouseClick('left', 740, 227, 1)

End if

"Error parsing function call"

I just keep on getting errors after error, obviously i have no idea WTF IM DOING.

Link to comment
Share on other sites

  • Developers

Start with installing the full SciTE4AutoIt3 installer and running your script from within SciTE.

No EndIF is needed with a one line IF, and its written without a space between End and If.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Start with installing the full SciTE4AutoIt3 installer and running your script from within SciTE.

No EndIF is needed with a one line IF, and its written without a space between End and If.

Jos

I am using SciTE or w/e this is

I see, i removed the end if line and there's no errors. However, the program just runs and closes instantly. How do i keep it hovered in the background waiting ?

Edited by woodyfly
Link to comment
Share on other sites

Rofl, I don't know about function called _MemoryOpen yet.

You don't read memory of other process in this way for sure. I told you, use _WinAPI_ReadProcessMemory for this task, keep in mind that there are few restrictions about handling access rights of memory block, it can be ReadOnly, ReadWrite, WriteOnly, PageGuard, ExecuteOnly, NoAccess, etc... I see you need to learn more before you attempt to do things like that.

Edit: @woodyfly: Please read some examples about GUI functions and events, it's all in the help file (F1 within the SciTE editor)

Edited by Authenticity
Link to comment
Share on other sites

  • Developers

I am using SciTE or w/e this is

I see, i removed the end if line and there's no errors. However, the program just runs and closes instantly. How do i keep it hovered in the background waiting ?

It would help if you first try to understand something before posting a reply because w/e doesnt buy you much ....... Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Im trying to backtrack what the original scripter did, and i didnt find any _WinAPI_ReadProcessMemory anywhere in his scripts.. i dont think he used this.

Link to his script, i tried reading it and analyzing parts on how he got the memory read but i dont get it lol

http://rapidshare.com/files/191273712/Atta...W_v0.D.au3.html

Edited by woodyfly
Link to comment
Share on other sites

This seems to be an easy ass one or two step script and i have no idea how to do it LOL. Maybe i shoulda payed more attention on my vb class, woulda learned something helpful

Well, if anyone can write me the script it'd be great, i can learn better backtracking. If not, then peace! Im going to sleep

Edited by woodyfly
Link to comment
Share on other sites

like:

#include <NomadMemory.au3>
$pid = ProcessExists("Atlantica.exe")
$openmem = _MemoryOpen($pid); Open the memory

While 1
Sleep(50)
$CombatInProcessMem = _MemoryRead(0x00FD99B8,$openmem);read address in 4 bytes
$AutoBattleNumber = _MemoryRead(0x01A87C98,$openmem);4 byte
$AutoBattleInCombat = _MemoryRead(0x01A87C94,$openmem);4 byte

If $CombatInProcessMem = 1 AND $AutoBattleNumber <> 0 AND $AutoBattleInCombat = 0 Then
MouseClick('left', 740, 227, 1)
Endif
WEnd
Edited by capo
Link to comment
Share on other sites

like:

#include <NomadMemory.au3>
$pid = ProcessExists("Atlantica.exe")
$openmem = _MemoryOpen($pid); Open the memory

While 1
Sleep(50)
$CombatInProcessMem = _MemoryRead(0x00FD99B8,$openmem);read address in 4 bytes
$AutoBattleNumber = _MemoryRead(0x01A87C98,$openmem);4 byte
$AutoBattleInCombat = _MemoryRead(0x01A87C94,$openmem);4 byte

If $CombatInProcessMem = 1 AND $AutoBattleNumber <> 0 AND $AutoBattleInCombat = 0 Then
MouseClick('left', 740, 227, 1)
Endif
WEnd
Thanks thats a start. I seem to understand MUCH better by backtracking it. It seems to work, however the clicks seem to be endless. . As long as those conditions were met true, the mouse tried clicking there all day! I couldnt even stop the script, had to restart.

I think what the script probably does right now is it searches to see if those if conditions are true, and when they met , the mouse clicks. Then it searches it again and clicks again , and repeats at an insane speed. What kind of logic could we use to solve this?

On a side note, I tried adding a ESC hotkey to end the script but it doesnt work:

HotKeySet("{ESC}", "Terminate")

Func Terminate()

Exit 0

EndFunc

Edited by woodyfly
Link to comment
Share on other sites

I think i found the missing logic. The first part is right, it clicks "here" whenever the if statement is true, however, when should it stop? I thought about the second part of the logic...

I need something like this

If $CombatInProcessMem = 1 AND $AutoBattleInCombat = 1 then

After the then, i need something that tells the first part of if statement to either "stop checking, stop clicking or in other words, DO NOTHING, do not click". How do i write this? Do i need functions?

Edited by woodyfly
Link to comment
Share on other sites

I think i found the missing logic. The first part is right, it clicks "here" whenever the if statement is true, however, when should it stop? I thought about the second part of the logic...

I need something like this

If $CombatInProcessMem = 1 AND $AutoBattleInCombat = 1 then

After the then, i need something that tells the first part of if statement to either "stop checking, stop clicking or in other words, DO NOTHING, do not click". How do i write this? Do i need functions?

Wow, i figured it out got the script to work perfectly! It was actually quite simple, but having almost ZERO knowledge on autoit it kinda tough. "Elseif" was what i exactly needed" Had to tweak here and there but this simply script its actually working perfectly!! Im surprised at myself lol. Like i said, backtracking helps me a figure out alot, than straight up learning. Thanks capo for the first part of the code, helped me learn alot. Heres my final code

#include <NomadMemory.au3>

$pid = ProcessExists("Atlantica.exe")

$openmem = _MemoryOpen($pid); Open the memory

While 1

Sleep(5000)

$CombatInProcessMem = _MemoryRead(0x00FD99B8,$openmem);read address in 4 bytes

$AutoBattleNumber = _MemoryRead(0x01A07BC8,$openmem);4 byte

$AutoBattleInCombat = _MemoryRead(0x01A07BC4,$openmem);4 byte

If $CombatInProcessMem = 1 AND $AutoBattleNumber <> 0 AND $AutoBattleInCombat = 0 Then

MouseClick('left', 988, 543, 1)

Elseif $CombatInProcessMem = 1 AND $AutoBattleInCombat = 1 then

Sleep (500)

Endif

WEnd

The most important part was the Elseif, or else it just kept on clicking the icon ingame. When the icon activated , i made it Sleep 500 and as long as it was on, it kept on sleeping/idling which is exactly what i wanted. I still havent figured out why the exit code isnt working though, but it isnt that important in this script:

HotKeySet("ESC","terminate")

Func terminate()

exit 0

EndFunc

Why wont this work? lol

Edited by woodyfly
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...