result of address <classMemory>RHCP Topic is solved

Ask gaming related questions (AHK v1.1 and older)
User avatar
boiler
Posts: 17387
Joined: 21 Dec 2014, 02:44

Re: result of address <classMemory>

04 Mar 2021, 09:19

theon wrote:
04 Mar 2021, 09:13
I changed more, nothing happens.
Post your complete code now with all the changes. So far there have been syntax and flow/logic problems in everything you posted, so all of that needs to be corrected before looking into the actual correct use of the ClassMemory class.
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: result of address <classMemory>

04 Mar 2021, 09:27

Code: Select all

5::
life:= mem.read(men.ReadEOClient1 + 0x1c, "int")
MsgBox, % life
return
I think I have to get some function from the classmemory so I don't know which one

Commonly used methods:
Spoiler
User avatar
boiler
Posts: 17387
Joined: 21 Dec 2014, 02:44

Re: result of address <classMemory>

04 Mar 2021, 09:34

Using ReadE0Client1 and other variables before they are assigned has to do with the logic and flow of your script, not the use of the other methods/functions. You have flow issues in your previous scripts such that they can’t work. If you post the latest updated version of your script, I can point out if you still have those issues. In any case, it won’t be possible for anyone to help unless you post your latest script.
User avatar
boiler
Posts: 17387
Joined: 21 Dec 2014, 02:44

Re: result of address <classMemory>

04 Mar 2021, 09:37

You also have an error in the line below where you have men instead of mem.

Code: Select all

life:= mem.read(men.ReadEOClient1 + 0x1c, "int")
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: result of address <classMemory>

04 Mar 2021, 09:45

full code

Code: Select all

#Include <classMemory>
#SingleInstance,Force
#NoEnv
#WinActivateForce ; need to test it

SetTitleMatchMode, RegEx
#Warn All, Off    ; #Warn eables warnings to assist with detecting common errors, while "all, off" makes them all disabled
#Persistent

SendMode InputThenPlay
global food

Gui, add, Text, x20 y20 w70 h40 vchar,
Gui, add, Text, x20 y40 w70 h40 vchar2,
Gui, add, Text, x20 y60 w70 h40 vchar3, 
Gui, add, Text, x20 y80 w70 h40 vchar4,
Gui, add, Text, x20 y100 w70 h40 vchar5,
Gui, add, Text, x130 y20 w70 h40 vchar6,
Gui, add, Text, x130 y40 w70 h40 vchar7,
Gui, add, Text, x130 y60 w70 h40 vchar8,
Gui, add, Text, x130 y80 w70 h40 vchar9,
Gui, add, Text, x130 y100 w70 h40 vchar10,
Gui, add, Text, x130 y120 w70 h40 vchar11,

Gui +LastFound +AlwaysOnTop
Gui Show, w400 h200, Elder Bot - LOGar Maker  V.1.1



5::
life:= mem.RawRead(mem.ReadEOClient1 + 0x1c, "int")
MsgBox, % life
return
1::
SetTimer casa, 500
return
global casa
casa:
Loop 11 ; Para criarmos 10 arrays
{
	OFFSET_ATUAL := A_Index ; Salvamos o valor da iteração atual do loop externo para poder usá-lo dentro do loop interno abaixo.
	Offset%OFFSET_ATUAL% := [0xC, 0xF4] ; Iniciamos com o modelo básico da array
	Loop % A_Index ; E aí vamos fazer um loop pelo número da iteração atual
	{
		Offset%OFFSET_ATUAL%.InsertAt(1, 0x0) ; Para inserir tantos elementos 0x0 quanta for a iteração atual (por exemplo, na 5a iteração, inseriremos 5 elementos 0x0)
	}
}
loop, 11
{
	OFFSET1_ATUAL := A_Index ; Salvamos o valor da iteração atual do loop externo para poder usá-lo dentro do loop interno abaixo.
	Offset1%OFFSET_ATUAL1% := [0xC, 0xF4] ; Iniciamos com o modelo básico da array
	Loop % A_Index ; E aí vamos fazer um loop pelo número da iteração atual
	{
		Offset1%OFFSET_ATUAL1%.InsertAt(1, 0x0) ; Para inserir tantos elementos 0x0 quanta for a iteração atual (por exemplo, na 5a iteração, inseriremos 5 elementos 0x0)
	}
}


mem := new _ClassMemory("ahk_exe client_dx.exe")
if !isObject(mem)
    msgbox failed to open a handle



 



Loop 11
{


	ReadEOClient%A_Index% := mem.readString(mem.BaseAddress + 0x55B11C, 15, "utf-8",  Offset%A_Index%*)
		GuiControl,,char, %ReadEOClient1%
		GuiControl,,char, %ReadEOClient2%
		GuiControl,,char3, %ReadEOClient3%
		GuiControl,,char4, %ReadEOClient4%
		GuiControl,,char5, %ReadEOClient5%
		GuiControl,,char6, %ReadEOClient6%
		GuiControl,,char7, %ReadEOClient7%
		GuiControl,,char8, %ReadEOClient8%
		GuiControl,,char9, %ReadEOClient9%
		GuiControl,,char10, %ReadEOClient10%
		GuiControl,,char11, %ReadEOClient11%

   

}


loop,11
If (StrLen(ReadEOClient%A_Index%) > 2)    
if  ((ReadEOClient%A_Index% = "Rat") 
OR (ReadEOClient%A_Index% = "Kod"))

{
}
else
{

FileAppend, % ReadEOClient%A_Index% , FileNo.txt
}
return

desloger(){
loop,5
{
ControlSend,, {Ctrl Down}q{Ctrl Up},
}}



return 
GuiClose:
ExitApp
return
User avatar
boiler
Posts: 17387
Joined: 21 Dec 2014, 02:44

Re: result of address <classMemory>

04 Mar 2021, 10:09

These variables get populated as it iterates through the loop, so it doesn’t really make sense to have all the GuiControl lines in each iteration of the loop:

Code: Select all

 Loop 11
{


	ReadEOClient%A_Index% := mem.readString(mem.BaseAddress + 0x55B11C, 15, "utf-8",  Offset%A_Index%*)
		GuiControl,,char, %ReadEOClient1%
		GuiControl,,char, %ReadEOClient2%
		GuiControl,,char3, %ReadEOClient3%
		GuiControl,,char4, %ReadEOClient4%
		GuiControl,,char5, %ReadEOClient5%
		GuiControl,,char6, %ReadEOClient6%
		GuiControl,,char7, %ReadEOClient7%
		GuiControl,,char8, %ReadEOClient8%
		GuiControl,,char9, %ReadEOClient9%
		GuiControl,,char10, %ReadEOClient10%
		GuiControl,,char11, %ReadEOClient11%

   

}

I would make it like the following, which only performs the GuiControl for the control associated with that iteration of the loop (and notice you had char where it should have been char2 in your version):

Code: Select all

Loop 11
{
	ReadEOClient%A_Index% := mem.readString(mem.BaseAddress + 0x55B11C, 15, "utf-8",  Offset%A_Index%*)
	GuiControl,,char%A_Index%, % ReadEOClient%A_Index%
}
That’s just one thing and it likely won’t change the outcome. I will review the code and post again.
User avatar
boiler
Posts: 17387
Joined: 21 Dec 2014, 02:44

Re: result of address <classMemory>

04 Mar 2021, 10:17

Posting things as I find them... This line never executes (known as unreachable code) because it doesn't appear in the auto-execute section (at the top before any hotkeys) and isn't part of any subroutine. It isn't needed anyway, so delete it:

Code: Select all

global casa
This also doesn't affect the outcome, but just cleaning things up.
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: result of address <classMemory>

04 Mar 2021, 10:22

ok, ty
User avatar
boiler
Posts: 17387
Joined: 21 Dec 2014, 02:44

Re: result of address <classMemory>

04 Mar 2021, 10:39

I'm not finding any other syntax or obvious flow/logic errors. I modified the code with the above fixes and restructured and formatted some things that I think will make it easier for others to follow. I suggest using the version below going forward. I may try to understand what's actually going on with the memory stuff later when I have time, but I invite others to look at it and see what they can recommend be done.

Code: Select all

#Include <classMemory>
#SingleInstance,Force
#NoEnv
#WinActivateForce ; need to test it

SetTitleMatchMode, RegEx
#Warn All, Off    ; #Warn eables warnings to assist with detecting common errors, while "all, off" makes them all disabled
#Persistent

SendMode InputThenPlay
global food

Gui, add, Text, x20 y20 w70 h40 vchar,
Gui, add, Text, x20 y40 w70 h40 vchar2,
Gui, add, Text, x20 y60 w70 h40 vchar3, 
Gui, add, Text, x20 y80 w70 h40 vchar4,
Gui, add, Text, x20 y100 w70 h40 vchar5,
Gui, add, Text, x130 y20 w70 h40 vchar6,
Gui, add, Text, x130 y40 w70 h40 vchar7,
Gui, add, Text, x130 y60 w70 h40 vchar8,
Gui, add, Text, x130 y80 w70 h40 vchar9,
Gui, add, Text, x130 y100 w70 h40 vchar10,
Gui, add, Text, x130 y120 w70 h40 vchar11,

Gui +LastFound +AlwaysOnTop
Gui Show, w400 h200, Elder Bot - LOGar Maker  V.1.1
return

5::
	life:= mem.RawRead(mem.ReadEOClient1 + 0x1c, "int")
	MsgBox, % life
return

1::SetTimer casa, 500

casa:
	Loop 11 ; Para criarmos 10 arrays
	{
		OFFSET_ATUAL := A_Index ; Salvamos o valor da iteração atual do loop externo para poder usá-lo dentro do loop interno abaixo.
		Offset%OFFSET_ATUAL% := [0xC, 0xF4] ; Iniciamos com o modelo básico da array
		Loop % A_Index ; E aí vamos fazer um loop pelo número da iteração atual
			Offset%OFFSET_ATUAL%.InsertAt(1, 0x0) ; Para inserir tantos elementos 0x0 quanta for a iteração atual (por exemplo, na 5a iteração, inseriremos 5 elementos 0x0)
	}
	loop, 11
	{
		OFFSET1_ATUAL := A_Index ; Salvamos o valor da iteração atual do loop externo para poder usá-lo dentro do loop interno abaixo.
		Offset1%OFFSET_ATUAL1% := [0xC, 0xF4] ; Iniciamos com o modelo básico da array
		Loop % A_Index ; E aí vamos fazer um loop pelo número da iteração atual
			Offset1%OFFSET_ATUAL1%.InsertAt(1, 0x0) ; Para inserir tantos elementos 0x0 quanta for a iteração atual (por exemplo, na 5a iteração, inseriremos 5 elementos 0x0)
	}

	mem := new _ClassMemory("ahk_exe client_dx.exe")
	if !isObject(mem)
	{
		msgbox failed to open a handle
		return
	}

	Loop 11
	{
		ReadEOClient%A_Index% := mem.readString(mem.BaseAddress + 0x55B11C, 15, "utf-8",  Offset%A_Index%*)
		GuiControl,,char%A_Index%, % ReadEOClient%A_Index%
	}

	loop,11
		if (StrLen(ReadEOClient%A_Index%) > 2)
			if  NOT ((ReadEOClient%A_Index% = "Rat") OR (ReadEOClient%A_Index% = "Kod"))
				FileAppend, % ReadEOClient%A_Index% , FileNo.txt
return

desloger() { ; doesn't appear to be used
	loop, 5
	ControlSend,, {Ctrl Down}q{Ctrl Up},
}

GuiClose:
ExitApp
return
I assume you press the "1" hotkey once and only once, and then you press the "5" hotkey. I'm not sure you want to be re-instantiating the mem instance of the class every 500 ms, but maybe it's fine.

I'm not sure why you're adding 0x1c to the base address since 0x1c is 28 and I thought you are trying to add 18.
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: result of address <classMemory>

04 Mar 2021, 11:18

I need to add the base addres + 18

Code: Select all

I fumbled = I'm not sure why you're adding 0x1c to the base address since 0x1c is 28 and I thought you are trying to add 18.
thanks for organizing the code

I am waiting for you to study the classmemory I love you
:superhappy: :bravo:
User avatar
boiler
Posts: 17387
Joined: 21 Dec 2014, 02:44

Re: result of address <classMemory>

04 Mar 2021, 12:50

theon wrote: I need to add the base addres + 18
Then it needs to be either + 18 or + 0x12.
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: result of address <classMemory>

04 Mar 2021, 13:40

@boiler
Yeah
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: result of address <classMemory>

04 Mar 2021, 15:12

Code: Select all

5::
  loop 11
  {
	value := mem.read(mem.BaseAddress + ReadEOClient%A_Index% + 0x12 , "int")
	MsgBox, % value
	}
return
error again
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: result of address <classMemory>

05 Mar 2021, 08:23

help my code plz !
@rommmcek
@RHCP
@boiler
@jNizM
RHCP
Posts: 202
Joined: 30 Sep 2013, 10:59

Re: result of address <classMemory>RHCP

05 Mar 2021, 09:47

In cheat engine, all addresses are in HEX and they are NOT prefixed '0x'.
For example, in the cheat engine screenshot one of the addresses is '1135690 + 18'. These are both hex numbers, and so in AHK they need to be written as '0x1135690 + 0x18'

Lets keep things very simple for a start. Once you get it working, you can fix your original code.
Try this and see if it works. This will only read the name and life of animal number 1.

I have placed questions in the code comments, they are noted by the asterisks i.e. '****'

Code: Select all

#Include <classMemory>
#SingleInstance,Force
#NoEnv
#Warn All, Off    
#Persistent

return 

5::
    ; *** In cheat engine screenshot the process is 'client_maker3.exe'
    ; but here you are using 'client_dx.exe' ??? Which is it?***
    mem := new _ClassMemory("ahk_exe client_dx.exe")
    if !isObject(mem)
    {
        msgbox failed to open a handle
        return
    }

    Offset1 := [0x0, 0xC, 0x20] ; ***in your screenshot cheat engine showed hex '20' NOT F4 ???***

    ; This address needs to match the base address shown in cheat engine
    ; i.e. the address displayed in CE when you manually add
    ; an address of client_dx.exe 
    msgbox % "mem.BaseAddress: " toHex(mem.BaseAddress)

    string1 := mem.readString(mem.BaseAddress + 0x55B11C,, "utf-8", Offset1*)
    msgbox % "string1: " string1

    unitStringAddress := mem.getAddressFromOffsets(mem.BaseAddress + 0x55B11C, Offset1*)
    ; according to your cheat engine screenshot the offset is 18 (hex)
    ; from the start of the unit's sting name address
    life := mem.read(unitStringAddress + 0x18, "int") 
    MsgBox % "Life of 1: " life

    ; Alternatively, this should work too
    Offset1Life := [0x0, 0xC, 0x20 + 0x18] ; same as [0x0, 0xC, 0x38]
    lifeAlt := mem.read(mem.BaseAddress + 0x55B11C, "int", Offset1Life*) 
    MsgBox % "Life of 1 alternate: " lifeAlt

return

toHex(int)
{
	return format("0x{:X}", int)

}

theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: result of address <classMemory>RHCP

05 Mar 2021, 10:18

@RHCP
yes it worked, now just put it in my script so he can use the arrays, right?


thank you very much to everyone who helped
RHCP
Posts: 202
Joined: 30 Sep 2013, 10:59

Re: result of address <classMemory>RHCP

05 Mar 2021, 10:25

theon wrote:
05 Mar 2021, 10:18
@RHCP
yes it worked, now just put it in my script so he can use the arrays, right?
Yes.
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: result of address <classMemory>RHCP

05 Mar 2021, 11:24

@RHCP
sorry for bothering you again, but it didn't work out, in fact I couldn't organize the code
my code

Code: Select all

#Include <classMemory>
#SingleInstance,Force
#NoEnv
#Warn All, Off    
#Persistent

Gui, add, Text, x20 y20 w70 h40 vchar,1
Gui, add, Text, x20 y40 w70 h40 vchar2,2
Gui, add, Text, x20 y60 w70 h40 vchar3,3
Gui, add, Text, x20 y80 w70 h40 vchar4,4
Gui, add, Text, x20 y100 w70 h40 vchar5,5
Gui, add, Text, x200 y20 w70 h40 vchar6,6
Gui, add, Text, x200 y40 w70 h40 vchar7,7
Gui, add, Text, x200 y60 w70 h40 vchar8,8
Gui, add, Text, x200 y80 w70 h40 vchar9,9
Gui, add, Text, x200 y100 w70 h40 vchar10,10
Gui, add, Text, x200 y120 w70 h40 vchar11,11
Gui, add, Text, x130 y20 w70 h40 vpos,pos
Gui, add, Text, x130 y40 w70 h40 vpos2,pos
Gui, add, Text, x130 y60 w70 h40 vpos3,pos
Gui, add, Text, x130 y80 w70 h40 vpos4,pos
Gui, add, Text, x130 y100 w70 h40 vpos5,pos
Gui +LastFound +AlwaysOnTop
Gui Show, w400 h200, Elder Bot - LOGar Maker  V.1.1
return

5::
loop 5
{
     pos%A_Index%  := mem.read(mem.BaseAddress + 0x55B11C, "int", Offset1%A_Index%*) 
    GuiControl,,pos%A_Index%, % pos%A_Index% 
	}
	return
toHex(int)
{
	return format("0x{:X}", int)

}

1::SetTimer casa, 500

casa:
	Loop 11 ; Para criarmos 10 arrays
	{
		OFFSET_ATUAL := A_Index ; Salvamos o valor da iteração atual do loop externo para poder usá-lo dentro do loop interno abaixo.
		Offset%OFFSET_ATUAL% := [0xC, 0x20] ; Iniciamos com o modelo básico da array
		Loop % A_Index ; E aí vamos fazer um loop pelo número da iteração atual
			Offset%OFFSET_ATUAL%.InsertAt(1, 0x0) ; Para inserir tantos elementos 0x0 quanta for a iteração atual (por exemplo, na 5a iteração, inseriremos 5 elementos 0x0)
	}
	loop, 11
	{
		OFFSET1_ATUAL := A_Index ; Salvamos o valor da iteração atual do loop externo para poder usá-lo dentro do loop interno abaixo.
		Offset1%OFFSET_ATUAL1% := [0xC, 0x20 + 0x18] ; Iniciamos com o modelo básico da array
		Loop % A_Index ; E aí vamos fazer um loop pelo número da iteração atual
			Offset1%OFFSET_ATUAL1%.InsertAt(1, 0x0) ; Para inserir tantos elementos 0x0 quanta for a iteração atual (por exemplo, na 5a iteração, inseriremos 5 elementos 0x0)
	}

	mem := new _ClassMemory("ahk_exe client_dx.exe")
	if !isObject(mem)
	{
		msgbox failed to open a handle
		return
	}

	Loop 11
	{
		ReadEOClient%A_Index% := mem.readString(mem.BaseAddress + 0x55B11C, 15, "utf-8",  Offset%A_Index%*)
		GuiControl,,char%A_Index%, % ReadEOClient%A_Index%
	}

	loop,11
		if (StrLen(ReadEOClient%A_Index%) > 2)
			if  NOT ((ReadEOClient%A_Index% = "Rat") OR (ReadEOClient%A_Index% = "Kod"))
				FileAppend, % ReadEOClient%A_Index% , FileNo.txt
return

desloger() { ; doesn't appear to be used
	loop, 5
	ControlSend,, {Ctrl Down}q{Ctrl Up},
}


GuiClose:
ExitApp
return
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: result of address <classMemory>RHCP  Topic is solved

05 Mar 2021, 15:07

it worked, thank you all so much!

Code: Select all

#Include <classMemory>
#SingleInstance,Force
#NoEnv
#Warn All, Off    
#Persistent

Gui, add, Text, x20 y20 w70 h40 vchar,1
Gui, add, Text, x20 y40 w70 h40 vchar2,2
Gui, add, Text, x20 y60 w70 h40 vchar3,3
Gui, add, Text, x20 y80 w70 h40 vchar4,4
Gui, add, Text, x20 y100 w70 h40 vchar5,5
Gui, add, Text, x200 y20 w70 h40 vchar6,6
Gui, add, Text, x200 y40 w70 h40 vchar7,7
Gui, add, Text, x200 y60 w70 h40 vchar8,8
Gui, add, Text, x200 y80 w70 h40 vchar9,9
Gui, add, Text, x200 y100 w70 h40 vchar10,10
Gui, add, Text, x200 y120 w70 h40 vchar11,11
Gui, add, Text, x130 y20 w70 h40 vpos,pos
Gui, add, Text, x130 y40 w70 h40 vpos2,pos
Gui, add, Text, x130 y60 w70 h40 vpos3,pos
Gui, add, Text, x130 y80 w70 h40 vpos4,pos
Gui, add, Text, x130 y100 w70 h40 vpos5,pos
Gui, add, Text, x300 y20 w70 h40 vpos6,pos
Gui, add, Text, x300 y40 w70 h40 vpos7,pos
Gui, add, Text, x300 y60 w70 h40 vpos8,pos
Gui, add, Text, x300 y80 w70 h40 vpos9,pos
Gui, add, Text, x300 y100 w70 h40 vpos10,pos
Gui, add, Text, x300 y120 w70 h40 vpos11,pos

Gui +LastFound +AlwaysOnTop
Gui Show, w400 h200, Elder Bot - LOGar Maker  V.1.1
return 

5::
    ; *** In cheat engine screenshot the process is 'client_maker3.exe'
    ; but here you are using 'client_dx.exe' ??? Which is it?***
    mem := new _ClassMemory("ahk_exe client_dx.exe")
    if !isObject(mem)
    {
        msgbox failed to open a handle
        return
    }
	
	
	Loop 11 ; Para criarmos 10 arrays
{
	OFFSET_ATUAL := A_Index ; Salvamos o valor da iteração atual do loop externo para poder usá-lo dentro do loop interno abaixo.
	Offset%OFFSET_ATUAL% :=  [0x0, 0xC, 0x20] ; Iniciamos com o modelo básico da array
	Loop % A_Index ; E aí vamos fazer um loop pelo número da iteração atual
	{
		Offset%OFFSET_ATUAL%.InsertAt(1, 0x0) ; Para inserir tantos elementos 0x0 quanta for a iteração atual (por exemplo, na 5a iteração, inseriremos 5 elementos 0x0)
	}
}
	
	
loop 11
{

    string1%A_Index% := mem.readString(mem.BaseAddress + 0x55B11C,, "utf-8", Offset%A_Index%*)
    unitStringAddress%A_Index% := mem.getAddressFromOffsets(mem.BaseAddress + 0x55B11C, Offset%A_Index%*)
    life%A_Index% := mem.read(unitStringAddress%A_Index% - 0x10, "int") 
	GuiControl,,char%A_Index%, % string1%A_Index%
    GuiControl,,pos%A_Index%, %  life%A_Index%
}
return
:dance: :dance: :dance:
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: result of address <classMemory>RHCP

05 Mar 2021, 15:24

now one more question how do i not appear who is with 65535
and strange names are showing up
filter who has 65535 will not appear "Pino 65535"
Spoiler

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: Rohwedder and 86 guests