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 


autoAssemble 'disableInfo' Example?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
atom0s
Moderator
Reputation: 204

Joined: 25 Jan 2006
Posts: 8579
Location: 127.0.0.1

PostPosted: Fri Jun 09, 2017 7:59 pm    Post subject: autoAssemble 'disableInfo' Example? Reply with quote

With 6.7, disableInfo was added to the Lua autoAssemble function. Is there an example of how this should be used and what it can be used for? I have a feeling it can be useful for what I am working on currently but I cannot find any example of how this is intended on being used.

Code:
autoAssemble(text, targetself OPTIONAL, disableInfo OPTIONAL) : runs the auto assembler with the given text. Returns true on success, with as secondary a table you can use when disabling (if targetself is set it will assemble into Cheat Engine itself). If disableInfo is provided the [Disable] section will be handled

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
atom0s
Moderator
Reputation: 204

Joined: 25 Jan 2006
Posts: 8579
Location: 127.0.0.1

PostPosted: Fri Jun 09, 2017 8:25 pm    Post subject: Reply with quote

As an assumption, based on the Delphi code (which I don't code in so I'm just speculating based on the flow) this is used like this:

Code:
local script = [[
[ENABLE]
alloc(newmem,2048);

newmem:
db 90 90 90 90

[DISABLE]
dealloc(newmem,2048);
]];

-- Execute and enable the script..
local a, b = autoAssemble(script, false);
if (a) then
    -- Disable the script?
    autoAssemble(script, false, b);
end


Is this correct? Seems to work the way I think it does, cleans up the newmem alloc when I call the second time passing the new returned table. Just want to make sure I'm using it correctly.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Dark Byte
Site Admin
Reputation: 467

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

PostPosted: Fri Jun 09, 2017 11:26 pm    Post subject: Reply with quote

yes, also autoAssemble(script,b) will work as well
_________________
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
atom0s
Moderator
Reputation: 204

Joined: 25 Jan 2006
Posts: 8579
Location: 127.0.0.1

PostPosted: Sat Jun 10, 2017 7:41 pm    Post subject: Reply with quote

Dark Byte wrote:
yes, also autoAssemble(script,b) will work as well


Great, thanks. Smile This is very useful for dynamically generating auto-assembly scripts on the fly for constant changing games and updates.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
ByTransient
Expert Cheater
Reputation: 5

Joined: 05 Sep 2020
Posts: 240

PostPosted: Tue Nov 17, 2020 2:03 pm    Post subject: Reply with quote

atom0s wrote:

Code:
local script = [[
[ENABLE]
alloc(newmem,2048);

newmem:
db 90 90 90 90

[DISABLE]
dealloc(newmem,2048);
]];

-- Execute and enable the script..
local a, b = autoAssemble(script, false);
if (a) then
    -- Disable the script?
    autoAssemble(script, false, b);
end


This code, which is referenced to many questions in CEF, does not work properly.
"Active" print immediately drops to "deactivated" position.

For active and (after use) "deactivated" printing,
An example is available as arranged below.

Code:
local a, b = autoAssemble("", false);

if f then f.destroy() end
f=createForm()
b1=createCheckBox(f)

b1.OnChange=function()
local script = [[
[ENABLE]
{$lua}
print("assamble active")
{$asm}
[DISABLE]
{$lua}
print("assamble deactive")
]];

-- Execute and enable the script..
if b1.checked==true then
autoAssemble(script);
print("true")
else
autoAssemble(script, b);
print("false")
end
end


Note: If it's seen as "cocky", I apologize.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 467

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

PostPosted: Tue Nov 17, 2020 3:37 pm    Post subject: Reply with quote

That won't work for scripts that allocate memory
_________________
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
ByTransient
Expert Cheater
Reputation: 5

Joined: 05 Sep 2020
Posts: 240

PostPosted: Tue Nov 17, 2020 5:16 pm    Post subject: Reply with quote

Dark Byte wrote:
That won't work for scripts that allocate memory


I am not using AutoAssemble. Actually, I am unfamiliar with the subject.
When I searched, I came across this reference a lot.
I wanted to try it before giving an example.
I saw that the current code is processing "Enable" and "Disable" at the same time.
If I did an incorrect or incomplete encoding, please correct it.
If it's a properly working reference, it means I was cocky.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 150

Joined: 06 Jul 2014
Posts: 4652

PostPosted: Tue Nov 17, 2020 8:06 pm    Post subject: Reply with quote

ByTransient wrote:
This code, which is referenced to many questions in CEF, does not work properly.
"Active" print immediately drops to "deactivated" position.
Examples aren't meant to be copied and pasted into scripts. They're meant to be read by people seeking to learn. If you want something you can copy and paste, go ask someone else to write the script for you.
This example, in combination with the documentation in celua.txt, provides enough context for someone to learn how to use this in their own scripts.

The GUI code you wrote gives supplementary information to that which the example intends to convey. It's an unnecessary detail that distracts people from learning what they were sent here to learn.
If the question was "how to activate and deactivate an AA script from Lua using a checkbox," then your code (if it were correct) would be more applicable to that specific question.
  • Your code should be indented and formatted well (no random semicolons)
  • I have no clue what kind of magic you think that first line is doing, but it's wrong
  • The script string should ideally be defined outside the function
  • "if var == true then..." is redundant except in esoteric scenarios (this is not one of them); use "if var then..."
  • The line "autoAssemble(script);" neither checks for errors nor captures the disableinfo
  • "autoAssemble(script, b);" - again, no clue why you're passing the disableinfo from some random call to autoAssemble, but this is wrong
  • print("true") / print("false") could be replaced with "print(b1.checked)" after the if...else...end

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 204

Joined: 25 Jan 2006
Posts: 8579
Location: 127.0.0.1

PostPosted: Wed Nov 18, 2020 2:31 am    Post subject: Reply with quote

ByTransient wrote:

This code, which is referenced to many questions in CEF, does not work properly.
"Active" print immediately drops to "deactivated" position.


The entire point to my question / this topic was just to ask about how the new API that was added at the time worked and accepted enable/disable section usage. It was not meant to be any real-world usage setup.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
ByTransient
Expert Cheater
Reputation: 5

Joined: 05 Sep 2020
Posts: 240

PostPosted: Wed Nov 18, 2020 11:06 am    Post subject: Reply with quote

atom0s wrote:
The entire point to my question / this topic was just to ask about how the new API that was added at the time worked and accepted enable/disable section usage. It was not meant to be any real-world usage setup.
( The final disclosure has been made. )
Sorry for moving this up, @atom0s.

@ParkourPenguin didn't need to brush me with his experience. Smile

You have interpreted user-defined variables as options, like the main piece of code.
Also when I don't define the first row, the function "b" (false [DISABLE]) doesn't work.

I do not understand that; He throws a brush in such stylish ways,
But even though it's easier, it doesn't give a code example. Very Happy

I give up.
I guess it is right to give this sharing as a solution so that people ask questions again.

Now I'm going to go to my room and cry alone.
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 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