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.
result of address <classMemory>RHCP Topic is solved
Re: result of address <classMemory>
Re: result of address <classMemory>
Code: Select all
5::
life:= mem.read(men.ReadEOClient1 + 0x1c, "int")
MsgBox, % life
return
Commonly used methods:
Spoiler
Re: result of address <classMemory>
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.
Re: result of address <classMemory>
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")
Re: result of address <classMemory>
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
Re: result of address <classMemory>
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:
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):
That’s just one thing and it likely won’t change the outcome. I will review the code and post again.
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%
}
Re: result of address <classMemory>
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:
This also doesn't affect the outcome, but just cleaning things up.
Code: Select all
global casa
Re: result of address <classMemory>
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.
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.
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'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.
Re: result of address <classMemory>
I need to add the base addres + 18
thanks for organizing the code
I am waiting for you to study the classmemory I love you
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.
I am waiting for you to study the classmemory I love you
Re: result of address <classMemory>
@boiler
Yeah
Yeah
Re: result of address <classMemory>
Code: Select all
5::
loop 11
{
value := mem.read(mem.BaseAddress + ReadEOClient%A_Index% + 0x12 , "int")
MsgBox, % value
}
return
Re: result of address <classMemory>
help my code plz !
@rommmcek
@RHCP
@boiler
@jNizM
@rommmcek
@RHCP
@boiler
@jNizM
Re: result of address <classMemory>RHCP
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. '****'
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)
}
Re: result of address <classMemory>RHCP
@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
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
Re: result of address <classMemory>RHCP
@RHCP
sorry for bothering you again, but it didn't work out, in fact I couldn't organize the code
my code
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
Re: result of address <classMemory>RHCP Topic is solved
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
Re: result of address <classMemory>RHCP
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"
and strange names are showing up
filter who has 65535 will not appear "Pino 65535"
Spoiler
Who is online
Users browsing this forum: No registered users and 89 guests