|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Sun Feb 01, 2015 1:47 pm Post subject: Ceck box timer not functioning |
|
|
There is a check box with a timer associated on my main panel. Since the code is way too long to post entirely, I'll post the pertinent code lines. Perhaps someone may be able to figure out why the timer function isn't executing.
Code: | trainer = {}--data in this part, all the data loads correctly
function trainer:start()
...
self.t = createTimer(nil, false)
self.t.onTimer = MaxHP
self.t.Interval = 1000; --checks every 1000 milliseconds
print("The Gode Mode timer has not been enabled")
self.gm_cb = createCheckBox(self.form);
self.gm_cb.Caption = 'God Mode';
self.gm_cb.Height = 20;
self.gm_cb.Left = 240;
self.gm_cb.Width = 75;
self.gm_cb.Top = 90;
self.gm_cb.onClick = function (sender)
if sender.Checked then
self.t.Enabled = true;
print("God mode is enabled from the trainer")
else
self.t.Enabled = false;
print("God mode is not enabled from the trainer")
end
end
--Check box is created and when it is/isn't checked the appropriate print line executes
...
end--trainer
trainer:start()
...
function MaxHP(sender)
local addresslist = getAddressList()
maxhp1address = addresslist_getMemoryRecordByDescription(addresslist, "1st Max HP")
maxhp1 = memoryrecord_getValue(maxhp1address)
curhp1address = addresslist_getMemoryRecordByDescription(addresslist, "1st Cur HP")
curhp1 = memoryrecord_getValue(curhp1address)
maxfiremp1address = addresslist_getMemoryRecordByDescription(addresslist, "1st Max Fire SP")
maxfiremp1 = memoryrecord_getValue(maxfiremp1address)
curfiremp1address = addresslist_getMemoryRecordByDescription(addresslist, "1st Cur Fire SP")
curfiremp1 = memoryrecord_getValue(curfiremp1address)
maxwatermp1address = addresslist_getMemoryRecordByDescription(addresslist, "1st Max Water SP")
maxwatermp1 = memoryrecord_getValue(maxwatermp1address)
curwatermp1address = addresslist_getMemoryRecordByDescription(addresslist, "1st Cur Water SP")
curwatermp1 = memoryrecord_getValue(curwatermp1address)
maxairmp1address = addresslist_getMemoryRecordByDescription(addresslist, "1st Max Air SP")
maxairmp1 = memoryrecord_getValue(maxairmp1address)
curairmp1address = addresslist_getMemoryRecordByDescription(addresslist, "1st Cur Air SP")
curairmp1 = memoryrecord_getValue(curairmp1address)
maxearthmp1address = addresslist_getMemoryRecordByDescription(addresslist, "1st Max Earth SP")
maxearthmp1 = memoryrecord_getValue(maxearthmp1address)
curearthmp1address = addresslist_getMemoryRecordByDescription(addresslist, "1st Cur Earth SP")
curearthmp1 = memoryrecord_getValue(curearthmp1address)
maxmentalmp1address = addresslist_getMemoryRecordByDescription(addresslist, "1st Max Mental SP")
maxmentalmp1 = memoryrecord_getValue(maxmentalmp1address)
curmentalmp1address = addresslist_getMemoryRecordByDescription(addresslist, "1st Cur Mental SP")
curmentalmp1 = memoryrecord_getValue(curmentalmp1address)
maxholymp1address = addresslist_getMemoryRecordByDescription(addresslist, "1st Max Holy SP")
maxholymp1 = memoryrecord_getValue(maxholymp1address)
curholymp1address = addresslist_getMemoryRecordByDescription(addresslist, "1st Cur Holy SP")
curholymp1 = memoryrecord_getValue(curholymp1address)
cursleepstatus1address = addresslist_getMemoryRecordByDescription(addresslist, "1st Sleep Status")
cursleepstatus1 = memoryrecord_getValue(cursleepstatus1address)
curparalyzestatus1address = addresslist_getMemoryRecordByDescription(addresslist, "1st Paralyzed Status")
curparalyzestatus1 = memoryrecord_getValue(curparalyzestatus1address)
curblindstatus1address = addresslist_getMemoryRecordByDescription(addresslist, "1st Blind Status")
curblindstatus1 = memoryrecord_getValue(curblindstatus1address)
curpoisonstatus1address = addresslist_getMemoryRecordByDescription(addresslist, "1st Poison Status")
curpoisonstatus1 = memoryrecord_getValue(curpoisonstatus1address)
(addresslist, "1st Nausea Status")
curnauseastatus1 = memoryrecord_getValue(curnauseastatus1address)
curirritatestatus1address = addresslist_getMemoryRecordByDescription(addresslist, "1st Irritated Status")
curirritatestatus1 = memoryrecord_getValue(curirritatestatus1address)
maxstam1address = addresslist_getMemoryRecordByDescription(addresslist, "1st Max Stamina")
maxstam1 = memoryrecord_getValue(maxstam1address)
curstam1address = addresslist_getMemoryRecordByDescription(addresslist, "1st Cur Stamina")
curstam1 = memoryrecord_getValue(curstam1address)
print("1st Params set")
--This print line is not executed when the check box is checked, there are more steps to execute, but obviously the function is never executed
...
end |
Any suggestions?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Sun Feb 01, 2015 1:59 pm Post subject: |
|
|
place a print at the start of MaxHP
perhaps (addresslist, "1st Nausea Status") will error out when executed causing the print after it to never get called
and execute MaxHP() manually to make sure it has no other error
_________________
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 |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Sun Feb 01, 2015 2:08 pm Post subject: |
|
|
My bet, this line:
Code: | self.t.onTimer = MaxHP |
doesn't work as you intended. It doesn't know what MaxHP is.
change it to
Code: | self.t.onTimer = "MaxHP" |
Or move MaxHP function before function trainer:start()
_________________
|
|
Back to top |
|
|
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Sun Feb 01, 2015 2:49 pm Post subject: |
|
|
Dark Byte wrote: | place a print at the start of MaxHP
perhaps (addresslist, "1st Nausea Status") will error out when executed causing the print after it to never get called
and execute MaxHP() manually to make sure it has no other error |
The lines should have been like this, edit error when posting the code lines.
Code: |
curnauseastatus1address = addresslist_getMemoryRecordByDescription(addresslist, "1st Nausea Status")
curnauseastatus1 = memoryrecord_getValue(curnauseastatus1address)
|
As you suggested I did try a manual execution in the status window and the function executed as expected.
mgr.inz.Player wrote: | My bet, this line:
Code: | self.t.onTimer = MaxHP |
doesn't work as you intended. It doesn't know what MaxHP is.
change it to
Code: | self.t.onTimer = "MaxHP" |
Or move MaxHP function before function trainer:start() |
Statements like this have worked without parentheses in other cheat engine table codes, as with the position of MaxHP. That's why I asked the question the statement worked in other tables. I just checked and some of the check box code lines have been placed after the MaxHP function. Maybe I will try and move the MaxHP code into the the trainer prior to the check box and see if that might work.
|
|
Back to top |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Sun Feb 01, 2015 3:07 pm Post subject: |
|
|
When "function MaxHP" is defined at the end, after executing script, execute this in Lua Engine:
Code: | return trainer.t.onTimer |
You will get nil
Move MaxHP function just before function trainer:start or before trainer:start()
or use self.t.onTimer = "MaxHP"
Quick test. Check it. It will work.
Description: |
|
Download |
Filename: |
test.ct |
Filesize: |
1.3 KB |
Downloaded: |
618 Time(s) |
_________________
|
|
Back to top |
|
|
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Sun Feb 01, 2015 4:13 pm Post subject: |
|
|
After moving the function prior to the timer creation, all works as expected. I'm not sure why placement of the functions "needs" to be this way but it works.
Thanks to both
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|