Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Executing a second AA script if a first one fails

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Spavid04
Newbie cheater
Reputation: 0

Joined: 30 May 2009
Posts: 15

PostPosted: Sat Feb 24, 2024 6:14 pm    Post subject: Executing a second AA script if a first one fails Reply with quote

Hey all!

How could I achieve the following flow: try the A autoassembler script, and if it fails, try B. They are fairly different scripts, including the code that is injected, and they can't both be active at the same time.
Script A will sometimes fail (intentionally) because of an assert inside of it. If afterwards, script B fails aswell, then "everything" fails.

Currently, I have two separate rows in the scripts list; I enable the first one, and if it fails, I enable the second one. This is pretty clunky, though...
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25288
Location: The netherlands

PostPosted: Sat Feb 24, 2024 6:43 pm    Post subject: Reply with quote

something like this (untested, just wrote this out of my head but you might get the idea)

Code:


[enable]
{$lua}
if scriptDisableInfo==nil then
  scriptDisableInfo={}
end

local r,di=autoAssemble([[yourscriptEnablePartOnly
...
]])
if r then
  scriptDisableInfo[memrec]={}
  scriptDisableInfo[memrec].di=di
  scriptDisableInfo[memrec].disableScript=[[yourscriptDisablePartOnly
...]]
else
  r,di=autoAssemble([[yourOtherscriptEnablePartOnly
...
]])
  if r then
    scriptDisableInfo[memrec]={}
    scriptDisableInfo[memrec].di=di
    scriptDisableInfo[memrec].disableScript=[[yourOtherscriptDisablePartOnly
...]]
  end
end
if r==false then
  error('both scripts failed. I give up')
end

{$lua}

[disable] 
{$lua}
autoAssemble(scriptDisableInfo[memrec].disableScript,scriptDisableInfo[memrec].di)
{$asm}

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Spavid04
Newbie cheater
Reputation: 0

Joined: 30 May 2009
Posts: 15

PostPosted: Sun Feb 25, 2024 7:52 am    Post subject: Reply with quote

Dark Byte wrote:
...


Yup, that seems to have done it. Thank you very much!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites