 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
usernotfound Expert Cheater
Reputation: 0
Joined: 21 Feb 2016 Posts: 115
|
Posted: Wed Dec 28, 2016 5:06 pm Post subject: How to use writeString with a memory record script? |
|
|
I'm not familiar using memory records with Lua so not sure what function to look for, I want to change a string defined in an AA script with the editbox object like so
Code: | define(Example,StringToChange) |
Normally I'd just use string.format with a variable for the editbox value (or using writeString in the editbox function) but how would I write to that value without it being in the Lua script?
|
|
Back to top |
|
 |
panraven Grandmaster Cheater
Reputation: 62
Joined: 01 Oct 2008 Posts: 958
|
Posted: Wed Dec 28, 2016 6:59 pm Post subject: |
|
|
Since you mention EditBox, Lua script seems necessary if I'm not misunderstood.
In UI/Trainer Lua code, should run before AA script below
Code: |
...
local symbol, maxLength = "MyString", 0x200
local isUnicode = false
-- ^ setup the String symbol
s2bt = isUnicode and wideStringToByteTable or stringToByteTable
if isUnicode then maxLength = maxLength * 2 end
MYScript = string.format("globalalloc(%s,%d)",symbol,maxLength)
function CEEdit1Change(sender)
local str = sender.Text
if MYScript and not readInteger(symbol) then
autoAssemble(MYScript)
end
if readInteger(symbol) then
str = str:sub(1,maxLength-1)..string.char(0) -- zero terminated
GetMainForm().Caption = str -- just for test, should remove
writeBytes(symbol,s2bt(str))
end
end
...
|
In AA script
Code: |
...
{$lua}
if MYScript then return MYScript end -- will not execute if MYScript not yet defined
{$asm}
...
mov esi,MyString // set your EditBox connected String Pointer
mov edi,[ebx+120]
@@: // sample copy code, not tested
mov al,[esi] // use ax and edi+2 -> edi for unicode
mov [edi],al
inc edi
inc esi
test al,al
jne @b
...
|
_________________
- Retarded. |
|
Back to top |
|
 |
usernotfound Expert Cheater
Reputation: 0
Joined: 21 Feb 2016 Posts: 115
|
Posted: Thu Dec 29, 2016 1:52 am Post subject: |
|
|
Thanks panraven, I think I will just stick to using the autoAssemble function in Lua for now. Memory records are a bit complicated for me at the moment
|
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|