View previous topic :: View next topic |
Author |
Message |
kiennguyen1101 Newbie cheater
Reputation: 0
Joined: 10 Oct 2016 Posts: 10
|
Posted: Fri Oct 28, 2016 9:56 am Post subject: Lua script with function cannot be assigned to table? |
|
|
Hi,
I've made a Lua script for my cheat table (h3hota). It works fine on Lua engine. However, when I tried to add it to the cheat table, it generates an error: Error in line 3 (function setResources()): This instruction cannot be compiled. I found two ways to solve this problem:
- Adding Lua script manually by editing cheat engine file .CT (symbols like < or > must be changed to < or >)
- Seperate my function using Table >> Show Cheat Table Lua Script (Ctrl + Alt + L) (it shows pop up!)
Here's the full code:
Code: | [ENABLE]
{lua}
function setResources()
local pointer = readPointer("0069CCFC")
for i = 6, 0, -1 do
local addr = pointer + 0x9c + 4*i
if i==6 then
if readPointer(addr) < 5000000 then
writeInteger(addr, 5000000)
else
break
end
else
if readPointer(addr) <5000 then
writeInteger(addr, 5000)
end
end
end
end
GameTimer=createTimer(nil)
GameTimer.Interval=5000
GameTimer.OnTimer = setResources
GameTimer.Enabled = true
[DISABLE]
GameTimer.destroy()
{asm}
{
}
|
Still, I want to ask if this was a bug with Cheat Engine? Because I found no way to automatically add my script to the table (with enable/disable function) without using Auto Assemble >> File >> Assign to current cheat table.
|
|
Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Fri Oct 28, 2016 10:25 am Post subject: |
|
|
{$lua}
Code: | [ENABLE]
{$lua}
function setResources()
local pointer = readPointer("0069CCFC")
for i = 6, 0, -1 do
local addr = pointer + 0x9c + 4*i
if i==6 then
if readPointer(addr) < 5000000 then
writeInteger(addr, 5000000)
else
break
end
else
if readPointer(addr) < 5000 then
writeInteger(addr, 5000)
end
end
end
end
GameTimer=createTimer(nil)
GameTimer.Interval=5000
GameTimer.OnTimer = setResources
GameTimer.Enabled = true
[DISABLE]
GameTimer.destroy()
{$asm}
{
} |
|
|
Back to top |
|
 |
mgr.inz.Player I post too much
Reputation: 222
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Fri Oct 28, 2016 3:05 pm Post subject: |
|
|
Yes, missing $ symbol
you should use:
{$Lua} and {$Asm}
Not those
{Lua} and {Asm}
_________________
|
|
Back to top |
|
 |
|