Memory Read in autoit

01/01/2009 19:46 bobbyaube#1
Something is wrong when I use this macro. AutoIt alwais get a positive answer for every memory read, even if the answer is negative.
Code:
#include <NomadMemory.au3>
$paused1 = 1
While $paused1 = 1
	$pos2 = MouseGetPos()
	$sleep = 350
	$Mem_Answer1 = 0x0168DFBC
	$Mem_Answer2 = 0x0168E0F4
	$Mem_Answer3 = 0x0168E22C
	$Mem_Answer4 = 0x0168E364
	$Process1 = WinGetProcess("[Conquer2.0]")

	MouseClick ("left", $pos2[0], $pos2[1], 1, 1)
	sleep ($sleep)
	
		$Mem_Open = _MemoryOpen($Process1) 
	$Mem_Read1 = _MemoryRead($Mem_Answer1, $Mem_Open, "char[16]") 
	If $Mem_Read1 = "Of course." Then
	MsgBox (0, "ERROR", "Done")
	$paused1 = 0
Else

sleep($sleep)
	MouseClick ("left", 265, 177, 1, 5)
	Sleep($sleep)
	
			$Mem_Read1 = _MemoryRead($Mem_Answer1, $Mem_Open, "char[16]")
			sleep(5)
			$Mem_Read2 = _MemoryRead($Mem_Answer2, $Mem_Open, "char[16]")
			sleep(5)
			$Mem_Read3 = _MemoryRead($Mem_Answer3, $Mem_Open, "char[16]")
			sleep(5)
			$Mem_Read4 = _MemoryRead($Mem_Answer4, $Mem_Open, "char[16]")
			sleep(5)
			
		If $Mem_Read1 = "Level 40" Or $Mem_Read1 = "20" Or $Mem_Read1 = "Boxer" Then
				
			MouseClick ("left", 265, 177, 1, 10)
			
		ElseIf $Mem_Read2 = "Level 40" Or $Mem_Read2 = "20" Or $Mem_Read2 = "Boxer" Then
			
			MouseClick ("left", 530, 177, 1, 10)
			
		ElseIf $Mem_Read3 = "Level 40" Or $Mem_Read3 = "20" Then
			
			MouseClick ("left", 265, 199, 1, 10)
			
		ElseIf $Mem_Read4 = "Level 40" Or $Mem_Read4 = "20" Or $Mem_Read4 = "Boxer" Then
			
			MouseClick ("left", 530, 199, 1, 10)
			
		EndIf
		EndIf
		
sleep($sleep)
MouseClick ("left", 265, 177, 1, 10)
MouseMove ($pos2[0], $pos2[1], 10)
_MemoryClose($Mem_Open)
$paused1 = 0

WEnd
When i start this, the message boxe ''done'' alwais pop up, even if the general li dont say "Of course."
Is something wrong in the programation? I got the nomad memory in the include folder, I used the text adress found with cheat engine and i added "0x" before.
01/01/2009 20:53 IAmHawtness#2
That code wasn't meant to be used, it was meant to be an inspiration for your own code. You should check out the AutoIt help file, it's very helpful indeed.

Ps. Remember to run the script as administrator if you're using Windows Vista.
01/02/2009 00:34 Hiyoal#3
Lol, I had the same problem. I believe it has to do with the PID of the process. Try using the title: "[Conquer2.0" without the last "]" and also declare Opt("WinTitleMatchMode",2) at the top of your script.

Hiyoal