Use an address specific value as a trigger to activate another (Joker Commands)

Want Cheat Engine to do something specific and no idea how to do that, ask here. (From simple scripts to full trainers and extensions)
Post Reply
Marconeto
Noobzor
Noobzor
Posts: 7
Joined: Tue May 19, 2020 4:38 am
Reputation: 0

Use an address specific value as a trigger to activate another (Joker Commands)

Post by Marconeto »

Is there a way to create a code that uses an address as a trigger using LUA script? I mean every time the address reaches a specific value it constantly set a value of 100 to another one. It's like a Gameshark joker command, but using an address value as a hotkey or trigger to activate another one and a timer of 10ms to repeat the process if the trigger value is always the same. If there's already a thread about that could anyone share? 'cause I didn't find it.



eg.



if address 005513F000 = 0063 then set a value of 100 to 005510F244

repeat after 10ms

else if address 005513F000 [B]≠[/B] 0063 then do nothing



Sorry my bad english.

Kickyoace
Novice Cheater
Novice Cheater
Posts: 21
Joined: Sun Jun 18, 2017 1:41 am
Reputation: 14

Use an address specific value as a trigger to activate another (Joker Commands)

Post by Kickyoace »

if you wanna venture into the ASM side of things this can be done by using [URL]https://wiki.cheatengine.org/index.php?title=Assembler:Commands:CMP[/URL] or you can do an if statment in lua might be easier to just break and trace the code to tell you what to filter out when you need to set the last mem address or what is really going on in the code or just find a better spot to overwrite that value where its not being memcopy'ed around the place

Marconeto
Noobzor
Noobzor
Posts: 7
Joined: Tue May 19, 2020 4:38 am
Reputation: 0

Use an address specific value as a trigger to activate another (Joker Commands)

Post by Marconeto »

[QUOTE="Kickyoace, post: 135727, member: 6619"]

if you wanna venture into the ASM side of things this can be done by using [URL]https://wiki.cheatengine.org/index.php?title=Assembler:Commands:CMP[/URL] or you can do an if statment in lua might be easier to just break and trace the code to tell you what to filter out when you need to set the last mem address or what is really going on in the code or just find a better spot to overwrite that value where its not being memcopy'ed around the place

[/QUOTE]



Is there any templates using compare operand parameters? I've tried to use CMP, no luck, 'cause I'm using pointers and it's a lot more easier to create it by LUA script than AOB injection. I've tried to find a template with a structure like that, but looks like no one ever tried to make a joker command like code using CE. I know CE allows hotkeys to freeze, increase, decrease and set a specific value to any code, but to use an address to activate other is only possible through script.

User avatar
TheyCallMeTim13
Administration
Administration
Posts: 1480
Joined: Fri Mar 03, 2017 12:31 am
Reputation: 736

Use an address specific value as a trigger to activate another (Joker Commands)

Post by TheyCallMeTim13 »

Try a[URL='https://fearlessrevolution.com/threads/6493/'][U] thread[/U][/URL] or a [U][URL='https://fearlessrevolution.com/threads/6492/']timer[/URL][/U].



[CODE=lua]{$lua}

------------------------------ ENABLE ------------------------------

[ENABLE]

local aTimer = nil

local aTimerInterval = 100

local address = 0xdeadbeef

local address2 = 0xbeef0000

local function aTimer_tick(timer)

if readInteger(address) == 100 then

writeInteger(address2, 100)

end

end

----------------------------------

if syntaxcheck then return end

aTimer = createTimer(MainForm)

aTimer.Interval = aTimerInterval

aTimer.OnTimer = aTimer_tick

------------------------------ DISABLE ------------------------------

[DISABLE]

if syntaxcheck then return end

aTimer.destroy()[/CODE]
Last edited by TheyCallMeTim13 on Thu Jan 01, 1970 12:00 am, edited 1 time in total.

Marconeto
Noobzor
Noobzor
Posts: 7
Joined: Tue May 19, 2020 4:38 am
Reputation: 0

Use an address specific value as a trigger to activate another (Joker Commands)

Post by Marconeto »

[QUOTE="TheyCallMeTim13, post: 135767, member: 91"]

Try a[URL='https://fearlessrevolution.com/threads/6493/'][U] thread[/U][/URL] or a [U][URL='https://fearlessrevolution.com/threads/6492/']timer[/URL][/U].



[CODE=lua]{$lua}

------------------------------ ENABLE ------------------------------

[ENABLE]

local aTimer = nil

local aTimerInterval = 100

local address = 0xdeadbeef

local address2 = 0xbeef0000

local function aTimer_tick(timer)

if readInteger(address) == 100 then

writeInteger(address2, 100)

end

end

----------------------------------

if syntaxcheck then return end

aTimer = createTimer(MainForm)

aTimer.Interval = aTimerInterval

aTimer.OnTimer = aTimer_tick

------------------------------ DISABLE ------------------------------

[DISABLE]

if syntaxcheck then return end

aTimer.destroy()[/CODE]

[/QUOTE]



[QUOTE]

if readInteger(address) == 100 then

writeInteger(address2, 100)

[/QUOTE]



These values here are in HEX or DEC form?

Is there a way to use dd , dw , db and dq to establish the byte limits (4, 2, 1 and 8 bytes) and # to id the values as decimal?



And I tried to use pointers as addresses with no success



Here's how I write them:

[QUOTE]

local address = ["Tutorial-i386.exe"+000000]+1C2

local address2 = ["Tutorial-i386.exe"+000001]+2A1

[/QUOTE]
Last edited by Marconeto on Thu Jan 01, 1970 12:00 am, edited 1 time in total.

Marconeto
Noobzor
Noobzor
Posts: 7
Joined: Tue May 19, 2020 4:38 am
Reputation: 0

Use an address specific value as a trigger to activate another (Joker Commands)

Post by Marconeto »

Sorry. I was really dumb here tsk tsk



I use this to write a specific integer to the address and they are already decimal. 0x should be used for HEX

[QUOTE]

[B]readSmallInteger[/B](address) == 4 then

[B]writeSmallInteger[/B](address2, 100)

end

[/QUOTE]



That part is ok so far, but I had no luck and with the effects and the script wouldn't turn off when using a timer, but It stay enabled even when I click the box.



Thread would be like this?



[CODE=lua]

{$lua}

------------------------------ ENABLE ------------------------------

local addr = "octoshock.dll+1E600B" //BizHawk: (PSX)Resident Evil - Hand gun bullets

local addr2 = "octoshock.dll+1E600B" //same

[ENABLE]

local function luaThread(thread)

while RunLuaThread do

if readSmallInteger(address) == 0x000F then //Every time the bullets reach 15 it will automatically write 100

writeSmallInteger(address2, 0x0064)

end

sleep(0)

end

thread.terminate()

end

----------------------------------

if syntaxcheck then return end

RunLuaThread = true

createThread(luaThread)

------------------------------ DISABLE ------------------------------

[DISABLE]

if syntaxcheck then return end

RunLuaThread = false

[/CODE]
Last edited by Marconeto on Thu Jan 01, 1970 12:00 am, edited 2 times in total.

Marconeto
Noobzor
Noobzor
Posts: 7
Joined: Tue May 19, 2020 4:38 am
Reputation: 0

Use an address specific value as a trigger to activate another (Joker Commands)

Post by Marconeto »

GOTCHA! The thread worked perfectly!

Thank you so much, [B][USER=91]TheyCallMeTim13[/USER][/B]!



I'm going to post the correct thread here for those interested.



[CODE=lua]



{$lua}

------------------------------ ENABLE ------------------------------

local addr = "octoshock.dll+1E600B"

local addr2 = "octoshock.dll+1E600B"

[ENABLE]

local function luaThread(thread)

while RunLuaThread do

if readBytes(addr) == 0x0F then

writeBytes(addr2, 0x64)

end

sleep(0)

end

thread.terminate()

end

----------------------------------

if syntaxcheck then return end

RunLuaThread = true

createThread(luaThread)

------------------------------ DISABLE ------------------------------

[DISABLE]

if syntaxcheck then return end

RunLuaThread = false

[/CODE]
Last edited by TheyCallMeTim13 on Thu Jan 01, 1970 12:00 am, edited 2 times in total.

Marconeto
Noobzor
Noobzor
Posts: 7
Joined: Tue May 19, 2020 4:38 am
Reputation: 0

Use an address specific value as a trigger to activate another (Joker Commands)

Post by Marconeto »

Hi [B][USER=91]TheyCallMeTim13[/USER][/B], here I am annoying you again rsrs.



Is there any template that shows how this thread logic would look like but using AOB injection instead?



I've looked into the Cheat Engine's Wiki but I didn't find any articles describing how the logic behind AOB works except the basics. I mean is there a way to use[B] "If, then, else, and, or"[/B] and other logic operations without relying on LUA script? The major problem with LUA is the CPU consumption when there are too many threads and I'm not familiar with AOB injection. By using CMP I should achieve something similar, but the structure doesn't work.



[URL]https://wiki.cheatengine.org/index.php?title=Assembler:Commands[/URL] (The article that I used to find the commands, but since I'm no good with the structure I couldn't make it work)



I've found this on a article that shows how to create pointer addresses using AOB, but I had no luck and no results when trying to create a logic like the one you showed me, but using AOB.

[URL unfurl="true"]https://forum.cheatengine.org/viewtopic.php?p=5730610[/URL]

User avatar
TheyCallMeTim13
Administration
Administration
Posts: 1480
Joined: Fri Mar 03, 2017 12:31 am
Reputation: 736

Use an address specific value as a trigger to activate another (Joker Commands)

Post by TheyCallMeTim13 »

Find where the address is written to and change it there. If you don't know how to find that start with the CE tutorial in the CE help menu. Once you have the injection point you can just add the logic there.

Something like this:

[CODE=cea]//...

cmp byte ptr [octoshock.dll+1E600B],0F

jne @f

mov byte ptr [octoshock.dll+1E600B],64

@@:

//...

[/CODE]



Here's a few link that might help as well.

[URL='https://fearlessrevolution.com/threads/6637/'][B][U]AOB signatures[/U][/B][/URL]

[URL='https://fearlessrevolution.com/threads/6544/'][B][U]Code Injection - Editable Values[/U][/B][/URL]

[URL='https://fearlessrevolution.com/threads/6539/'][B][U]Code Injection - Full[/U][/B][/URL]



EDIT: That or use one thread enabled as a "main script" and toggle options with global variables in other scripts. As using comparative logic you are limited to JE, JNE, JG, JL, CMOVE, CMOVG, and others like that. No real OR, AND, or ELSE; just a lot of jumps back and forth that can get a bit messy.
Last edited by TheyCallMeTim13 on Thu May 21, 2020 5:11 am, edited 2 times in total.

Marconeto
Noobzor
Noobzor
Posts: 7
Joined: Tue May 19, 2020 4:38 am
Reputation: 0

Use an address specific value as a trigger to activate another (Joker Commands)

Post by Marconeto »

[B][USER=91]TheyCallMeTim13[/USER][/B]



Got it!

It needed a [B]jne[/B] to work.

The easy way to find where the address is written is by watching the accesses and that part is ok. I screwed everything because I didn't know that a [B]jne[/B] function was needed.

But it wont change much as you said, because this injection also needs a lot of jumps but in different places since the injection point is allocated near the end of the memory. The number of addresses that I used in this process will always result in high CPU consumption and this makes it useless. As you said the only way to reduce CPU consumption is by using one thread as the base.

Thank you, man!

Post Reply

Who is online

Users browsing this forum: No registered users