Page 1 of 1

[solved by: Cake-san] Failing to get a DEFINE to be used at global level

Posted: Fri Nov 06, 2020 12:47 pm
by Messy6666
erm soz bout the empty post, pressed "submit" accidentally

Plz, what am i doing wrong here ( using Cheat Engine 7.2) ?
In the "Enable" script which activates before all others
i define PLAYER_MAX_LEVEL and then make it globally by using the registerSymbol(PLAYER_MAX_LEVEL)

Code: Select all

[ENABLE]
// Globals
define(PLAYER_MAX_LEVEL,#100)       // Max supported player lvl
registerSymbol(PLAYER_MAX_LEVEL)  // make it global ?
{$LUA}
if syntaxcheck then return end
if process and readInteger(process) ~= 0 then
...  bla bla bla ....
Now with this turned on i still can't refer to this constant in another script
for example:

Code: Select all

   db PLAYER_MAX_LEVEL
will give the error: this instruction can't be compiled.

if i do a local define tho it's working
but... the value of PLAYER_MAX_LEVEL is to be used in other scripts also

Code: Select all

define(PLAYER_MAX_LEVEL,#100)
    db PLAYER_MAX_LEVEL
works fine

tia
left is enable button/script, right is a child of that
Image

Re: Failing to get a DEFINE to be used at global level

Posted: Sat Nov 07, 2020 1:29 pm
by Cake-san
use Lua global variable eg:

Code: Select all

{$lua}
PLAYER_MAX_LEVEL=100
{$asm}

Re: Failing to get a DEFINE to be used at global level

Posted: Sat Nov 07, 2020 1:32 pm
by Messy6666
ow tyvm gonna try that thanks! ( LUA noob here )

Re: Failing to get a DEFINE to be used at global level

Posted: Sat Nov 07, 2020 2:19 pm
by Messy6666
Cake-san wrote:
Sat Nov 07, 2020 1:29 pm
use Lua global variable eg:

Code: Select all

{$lua}
PLAYER_MAX_LEVEL=100
{$asm}
That solved it! thanks a lot