woodyfly Posted January 29, 2009 Posted January 29, 2009 (edited) 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 January 29, 2009 by woodyfly
Authenticity Posted January 29, 2009 Posted January 29, 2009 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.
woodyfly Posted January 29, 2009 Author Posted January 29, 2009 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.
woodyfly Posted January 29, 2009 Author Posted January 29, 2009 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 = 0x01A87C94If $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.
Developers Jos Posted January 29, 2009 Developers Posted January 29, 2009 (edited) 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 January 29, 2009 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.Â
woodyfly Posted January 29, 2009 Author Posted January 29, 2009 (edited) 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.JosI am using SciTE or w/e this isI 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 January 29, 2009 by woodyfly
Authenticity Posted January 29, 2009 Posted January 29, 2009 (edited) 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 January 29, 2009 by Authenticity
Developers Jos Posted January 29, 2009 Developers Posted January 29, 2009 (edited) I am using SciTE or w/e this isI 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 January 29, 2009 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.Â
woodyfly Posted January 29, 2009 Author Posted January 29, 2009 (edited) 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 lolhttp://rapidshare.com/files/191273712/Atta...W_v0.D.au3.html Edited January 29, 2009 by woodyfly
woodyfly Posted January 29, 2009 Author Posted January 29, 2009 (edited) 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 January 29, 2009 by woodyfly
cmattb Posted January 30, 2009 Posted January 30, 2009 I don't know much about memory reading, but you need to put your code in a loop or its just going to run once and stop. Read up on While/Wend loops in the help file
capo Posted January 30, 2009 Posted January 30, 2009 (edited) 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 January 30, 2009 by capo
woodyfly Posted January 30, 2009 Author Posted January 30, 2009 (edited) 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 January 30, 2009 by woodyfly
woodyfly Posted January 30, 2009 Author Posted January 30, 2009 (edited) 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 January 30, 2009 by woodyfly
woodyfly Posted January 30, 2009 Author Posted January 30, 2009 (edited) 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 thisIf $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 memoryWhile 1Sleep(5000)$CombatInProcessMem = _MemoryRead(0x00FD99B8,$openmem);read address in 4 bytes$AutoBattleNumber = _MemoryRead(0x01A07BC8,$openmem);4 byte$AutoBattleInCombat = _MemoryRead(0x01A07BC4,$openmem);4 byteIf $CombatInProcessMem = 1 AND $AutoBattleNumber <> 0 AND $AutoBattleInCombat = 0 ThenMouseClick('left', 988, 543, 1)Elseif $CombatInProcessMem = 1 AND $AutoBattleInCombat = 1 then Sleep (500)EndifWEndThe 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 0EndFuncWhy wont this work? lol Edited January 30, 2009 by woodyfly
azure Posted January 30, 2009 Posted January 30, 2009 HotKeySet("ESC","terminate") Func terminate() exit 0 EndFunc Why wont this work? lol Because it's: HotKeySet("{ESC}","terminate")
woodyfly Posted January 30, 2009 Author Posted January 30, 2009 Because it's: HotKeySet("{ESC}","terminate") I've tried that before, it still doesnt work
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now