Jump to content
Moopler
  • 1
misterdave35

Help How to call a Lua function in AA

Question

I've searched google/cheat engine forum and I'm not finding an answer that works.

I want to call a Lua function that disables other scripts in my trainer form. An example would be for the auto cc script:

function ThisLuaFunction()
  Form.ThisHack.checked = false
end

--Auto Change Channel--
function ChangeChannel(CC)
  if CC.checked then
    autoAssemble([[
    // restore code here

    ChangeChannel:
    call ThisLuaFunction // disables the needed scripts
    push eax
    call get_field
    mov ecx,eax
    call CField__SendTransferChannelRequest

    // restore code here
    ]])
  end
end

The function I want to call is already declared in my cheat table lua script. How do I call it?

Share this post


Link to post

6 answers to this question

Recommended Posts

  • 0

Not sure exactly what you're looking to do but I made a small example here you could adapt to your trainer:

You can add your AA scripts as memory records and then use one record to toggle all their active property, add player count offset as a address and read its value in your Lua table to tell other functions that player count has changed.

 

  • Like 1

Share this post


Link to post
  • 0
Guest

@NORBIN has posted nice info about using aa in lua for cheat engine:

I'm sure you already know how to create a form with cheat engine, lua will ref to the code in the form gui.eW7e5uX.png

I made a rough poc base on norbins info: https://gist.github.com/f-ve/6dbd21bf62ea64d0caa59beee831829a

Honestly, dont have to do it this way though. You could use the AA command to enable and disable lua code or misc.

luacall(thisisaluafunction())

The cheat engine forum has alot of info but is scattered about

http://forum.cheatengine.org/viewtopic.php?p=5712053&sid=1b337489b17a757ad8bc87b14da13b53

Best of luck :)

Edited by Guest

Share this post


Link to post
  • 0
51 minutes ago, NORBIN said:

Not sure exactly what you're looking to do but I made a small example here you could adapt to your trainer:

You can add your AA scripts as memory records and then use one record to toggle all their active property, add player count offset as a address and read its value in your Lua table to tell other functions that player count has changed.

 

What I wanted was a way to call a lua function within an AA script, which @Five pointed is luacall(thisisaluafunction()). I tried using yours and when I changed Mob Count Offset to Player Count Offset, I got spammed with "You can't do this right now" blue boxes lol. Do I need to change something else to have it find player offset? (edit: might be some bug on my part. trying to debug :( )

Edited by misterdave35

Share this post


Link to post
  • 0
Guest

I wrote this pretty fast so forgive errors didn't check everything. Been messing around a bit more but I can't access the wiki page for cheat engine documentation so forgive my syntax errors. Not sure If you can call and jump to functions but will test later on.

https://gist.github.com/f-ve/47ff9de960a2d50133f788f114da28c2

then use

[enable]
luacall(ACC.Enable())

[disable]
luacall(ACC.Disable())

 

Share this post


Link to post
  • 0
On 2017-02-18 at 23:26, misterdave35 said:

I changed Mob Count Offset to Player Count Offset, I got spammed with "You can't do this right now" blue boxes lol. Do I need to change something else to have it find player offset?

That script does not have the offset it gets the value by the records description in the addresslist (since it's less messy IMO to simply add them as records), you could always just read it directly in your Lua with readPointer

See here for documentation on CELua functions: https://raw.githubusercontent.com/cheat-engine/cheat-engine/master/Cheat Engine/bin/main.lua

 

 

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×