View previous topic :: View next topic |
Author |
Message |
atom0s Moderator
Reputation: 204
Joined: 25 Jan 2006 Posts: 8579 Location: 127.0.0.1
|
Posted: Fri Jun 09, 2017 7:59 pm Post subject: autoAssemble 'disableInfo' Example? |
|
|
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 |
|
 |
atom0s Moderator
Reputation: 204
Joined: 25 Jan 2006 Posts: 8579 Location: 127.0.0.1
|
Posted: Fri Jun 09, 2017 8:25 pm Post subject: |
|
|
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 |
|
 |
Dark Byte Site Admin
Reputation: 467
Joined: 09 May 2003 Posts: 25705 Location: The netherlands
|
Posted: Fri Jun 09, 2017 11:26 pm Post subject: |
|
|
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 |
|
 |
atom0s Moderator
Reputation: 204
Joined: 25 Jan 2006 Posts: 8579 Location: 127.0.0.1
|
|
Back to top |
|
 |
ByTransient Expert Cheater
Reputation: 5
Joined: 05 Sep 2020 Posts: 240
|
Posted: Tue Nov 17, 2020 2:03 pm Post subject: |
|
|
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 |
|
 |
Dark Byte Site Admin
Reputation: 467
Joined: 09 May 2003 Posts: 25705 Location: The netherlands
|
Posted: Tue Nov 17, 2020 3:37 pm Post subject: |
|
|
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 |
|
 |
ByTransient Expert Cheater
Reputation: 5
Joined: 05 Sep 2020 Posts: 240
|
Posted: Tue Nov 17, 2020 5:16 pm Post subject: |
|
|
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 |
|
 |
ParkourPenguin I post too much
Reputation: 150
Joined: 06 Jul 2014 Posts: 4652
|
Posted: Tue Nov 17, 2020 8:06 pm Post subject: |
|
|
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 |
|
 |
atom0s Moderator
Reputation: 204
Joined: 25 Jan 2006 Posts: 8579 Location: 127.0.0.1
|
Posted: Wed Nov 18, 2020 2:31 am Post subject: |
|
|
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 |
|
 |
ByTransient Expert Cheater
Reputation: 5
Joined: 05 Sep 2020 Posts: 240
|
Posted: Wed Nov 18, 2020 11:06 am Post subject: |
|
|
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.
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.
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 |
|
 |
|