View previous topic :: View next topic |
Author |
Message |
Merlini Advanced Cheater Reputation: 2
Joined: 12 Jun 2016 Posts: 53
|
Posted: Mon Apr 10, 2017 3:25 pm Post subject: can autoAssemble return error message? |
|
|
Is it possible for LUA autoAssemble to pass the error message?
Suppose I make a mistake in the auto assemble editor and press OK,
it will show the error message like the attached picture.
I am trying to use the autoAssemble function found in the main.lua,
and from the docs in
http://wiki.cheatengine.org/index.php?title=autoAssemble
it seems to return a boolean for success.
Is it possible to also pass error message like the one shown in the pic?
Even just the line number for the wrong code could be useful.
Thank you.
Description: |
|
Filesize: |
4.87 KB |
Viewed: |
6545 Time(s) |
|
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25295 Location: The netherlands
|
Posted: Mon Apr 10, 2017 5:22 pm Post subject: |
|
|
the github version (next ce version) does that. It returns false, and a second return a string saying what went wrong
there this will work:
Code: |
r,error=autoAssemble([[
alloc(bla,4096)
bla:
nop
noop
nop
]])
if (r==false) then print(error) end
|
and prints out:
Code: |
Error in line 5 (noop) :This instruction can't be compiled
|
_________________
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 |
|
|
Merlini Advanced Cheater Reputation: 2
Joined: 12 Jun 2016 Posts: 53
|
Posted: Mon Apr 10, 2017 5:56 pm Post subject: |
|
|
Dark Byte wrote: | the github version (next ce version) does that. It returns false, and a second return a string saying what went wrong |
A) Just cloned and compiled from github and it seems to be working.
Thank you.
Pic 1
B) During compilation I had a problem as shown in pic 2.
formdesignerunit line 581
I just commented the line, and it seems to be working.
I don't use form designer feature of CE. Do I have to worry about
commenting out that line?
C) Is there a way for me to get the error message without actually
committing the result to the memory?
In autoassembler.pas line 24
Code: | function autoassemble(code: Tstrings; popupmessages,enable,syntaxcheckonly, targetself: boolean):boolean; overload; |
there is a flag for syntaxcheckonly.
Is this overloaded version of the call available in LUA?
If so, can you give an example?
D) Not at all important but is this code available in LUA?
Code: | function getenableanddisablepos(code:tstrings;var enablepos,disablepos: integer): boolean; |
Thank you very much DB.
Description: |
|
Filesize: |
12.84 KB |
Viewed: |
6507 Time(s) |
|
Description: |
|
Filesize: |
9.86 KB |
Viewed: |
6507 Time(s) |
|
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25295 Location: The netherlands
|
Posted: Mon Apr 10, 2017 6:06 pm Post subject: |
|
|
B: That means you used a lazarus version newer than 1.6.0
commenting it out just means the form designer will have a limited event property editor.
Not a too big issue
C: Not at the moment
D: No, but that function is easy enough to do in lua 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 |
|
|
Merlini Advanced Cheater Reputation: 2
Joined: 12 Jun 2016 Posts: 53
|
Posted: Mon Apr 10, 2017 6:11 pm Post subject: |
|
|
C:
I figured as much. I think I can just do a quick flip-flop of autoassemble to do an enable-AA then do a disable-AA to simulate syntaxcheck.
D:
Yes. I simply need to search for enable and disable strings and mark their positions.
All in all everything is looking up and can consider the inquiries solved.
Thank you again DB.
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25295 Location: The netherlands
|
Posted: Mon Apr 10, 2017 6:23 pm Post subject: |
|
|
I just implemented C as
Code: |
autoAssembleCheck(script, enable, targetself)
|
enable is a boolean. If true, syntax checks the enable section, false syntax checks the disable section
targetself is the same as in autoassemble
note that syntaxchecks do not check AOBScan results
_________________
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 |
|
|
Merlini Advanced Cheater Reputation: 2
Joined: 12 Jun 2016 Posts: 53
|
Posted: Mon Apr 10, 2017 7:42 pm Post subject: |
|
|
Dark Byte wrote: | I just implemented C as
Code: |
autoAssembleCheck(script, enable, targetself)
|
|
You did that faster than I could type my questions out.
Impressive.
Everything is working out perfectly and will serve an important role
in one of the LUA plugins that I'm using.
Thanks again DB.
===========================================
https://streamable.com/h9xqv
I thought I'd post a short clip about why I was asking for all this.
I've always found the auto assemble editor in CE lacking in functionality.
Then one day it dawned on me that the best memory manager in the
world doesn't have to also ship with the best editor in the world.
After all we have VIM (or insert any other editor/IDE here) for that.
Why reinvent the wheel of text editor when we can
simply outsource it to one of the many established ones?
So I've asked our illustrious predprey for an lua mod to launch AA script
in an external editor which resulted in this.
http://forum.cheatengine.org/viewtopic.php?t=593483
The problem was that everytime I saved the code in editor,
I had to reopen the code in CE's AA editor to validate the change.
Small inconvenience, but annoyance nonetheless.
Wouldn't it be nice if predprey's script could also
validate the code everytime the code was saved in the external editor?
Now thanks to the new autoAssembleCheck function, I can do just that.
No more constantly opening and closing CE's editor just to validate!
Now I can use VIM's auto completion, Ultisnip's snippet libraries,
syntax highlighting, code folding, backward and forward searches,
omnibus replacements, macros, python interpolation, fuzzy searches,
and much more at no additional cost.
I've recently seen a feature request to allow for backward search
capabilities, so I think I'm not the only one who wants a more powerful
autoassembler editor. If I can request a feature request, I think
it would be to incorporate a streamlined version of predprey's
external editor script into the main executable.
This way users can simply outsource their editor needs to their own
editors they are comfortable with and CE staff can dedicate more
time working on core developments.
Anyhow, thanks again for the the modifications to all involved.
Much appreciated.
|
|
Back to top |
|
|
|