IF Colordetection

02/01/2010 20:44 Xereon#16
zB
Code:
While 1
02/01/2010 21:08 Alucard#17
Code:
#include <GUIConstantsEx.au3> 
GUICreate("AutoIT", 335, 100) 
GUISetState(@SW_SHOW) 

If WinExists("XXX") Then
	WinActivate("XXX")
	WinWaitActive("XXX")
EndIf

While 1
	fight()
WEnd
Func fight()  
	If PixelGetColor (560, 70) = 0xFFFFFF Then             
		Send("1")             
	Else
		Do
		$zahl = 0
		$zahl = $zahl + 1
		Sleep (1000)
		Send("3")
		Sleep (1000)
		Send("2")
		until $zahl = 1
	EndIf 
EndFunc
so kommt kein fehler mehr, aber er hört trotzdem nach einmal "3" und "2" nicht auf, sondern macht immer weiter mit den beiden zahlen ... zum mäuse melken, ich versteh es einfach nicht. bis zur 4ten klasse stand auf meinem zeugniss immer "kann sehr gut logisch denken" ... aber als höhere mathematik kam war das alles plötzlich weg ... ich steig da einfach nicht mehr durch :(
02/01/2010 21:11 .nAno#18
xD sry , hab vermutet das du nen anderes Anwendungsegebiet meintest
das Run lässt sich natürlich durch jede beliebige Funktion ersetzen :P
02/01/2010 22:04 AutoItDude#19
Quote:
Originally Posted by Alucard View Post
when i get u the adress, can u write me the code i need? i am new to autoit as u can see :)

4bit

061C3188

0 is standing
1 is sitting
first of all, it is very likely this not the address you were looking for. it will change when you close and restart your game - if im right, you need to find a pointer and offset for the correct address. only then you can execute memory functions. if you don't know how to find a pointer you can learn it from CE tutorial.

This is how you use it:
Code:
#include <_NomadMemory.au3>
#include <Misc.au3>

Global $PID=ProcessExists("target.exe")		; find PID
Global $PROC=_MemoryOpen($PID)			; open process for memory functions
Global $POINTER_ADDRESS=0x00000000		; define pointer address
Global $MEM_BASEADDR=0				; store pointer value
Global $MEM_CHAR_STATE=0x0000			; offset value

$MEM_BASEADDR=getPointer($POINTER_ADDRESS)

While 1
	If _IsPressed("24") Then MsgBox(0,"CPlayer_GetState",CPlayer_GetState())
	If _IsPressed("23") Then CPlayer_SetState()
WEnd



Func CPlayer_GetState()
	Return _MemoryRead($MEM_BASEADDR+$MEM_CHAR_STATE,$PROC,"DWORD")
EndFunc

Func CPlayer_SetState()
	Local $STATE=CPlayer_GetState()
	$STATE=Not $STATE
	_MemoryWrite($MEM_BASEADDR+$MEM_CHAR_STATE,$PROC,$STATE,"DWORD")
EndFunc

Func getPointer($vADDR,$vPROC=$PROC)
	Return _MemoryRead($vADDR,$vPROC,"DWORD")
EndFunc
fill code with correct values, process name, run script, now:
- press HOME to read current value.
- press END switch value 0/1 (this should make your char sit down, stand up)

have fun
02/03/2010 14:48 Alucard#20
i cant get the pointer ... everytime i try to get the pointer adress, the game crashes. :(