Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Timer not working

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 590

PostPosted: Mon Apr 20, 2020 8:13 am    Post subject: Timer not working Reply with quote

Code:

                   function IncBtlExpTo99(sender)
                             addresslist = getAddressList()
                             btlexp1_address = addresslist_getMemoryRecordByDescription(addresslist, "Hero ATC 1 Exp In Battle");
                             btlexp1 = memoryrecord_getValue(btlexp1_address);
                             memoryrecord_setValue(btlexp1_address, 99);
                             btlexp2_address = addresslist_getMemoryRecordByDescription(addresslist, "Hero ATC 2 Exp In Battle");
                             btlexp2 = memoryrecord_getValue(btlexp2_address);
                             memoryrecord_setValue(btlexp2_address, 99);
                             btlexp3_address = addresslist_getMemoryRecordByDescription(addresslist, "Hero ATC 3 Exp In Battle");
                             btlexp3 = memoryrecord_getValue(btlexp3_address);
                             memoryrecord_setValue(btlexp3_address, 99);
                             btlexp4_address = addresslist_getMemoryRecordByDescription(addresslist, "Hero ATC 4 Exp In Battle");
                             btlexp4 = memoryrecord_getValue(btlexp4_address);
                             memoryrecord_setValue(btlexp4_address, 99);
                             btlexp5_address = addresslist_getMemoryRecordByDescription(addresslist, "Hero ATC 5 Exp In Battle");
                             btlexp5 = memoryrecord_getValue(btlexp5_address);
                             memoryrecord_setValue(btlexp5_address, 99);
                             btlexp6_address = addresslist_getMemoryRecordByDescription(addresslist, "Hero ATC 6 Exp In Battle");
                             btlexp6 = memoryrecord_getValue(btlexp6_address);
                             memoryrecord_setValue(btlexp6_address, 99);
                             btlexp7_address = addresslist_getMemoryRecordByDescription(addresslist, "Hero ATC 7 Exp In Battle");
                             btlexp7 = memoryrecord_getValue(btlexp7_address);
                             memoryrecord_setValue(btlexp7_address, 99);
                             btlexp8_address = addresslist_getMemoryRecordByDescription(addresslist, "Hero ATC 8 Exp In Battle");
                             btlexp8 = memoryrecord_getValue(btlexp8_address);
                             memoryrecord_setValue(btlexp8_address, 99);
                             btlexp9_address = addresslist_getMemoryRecordByDescription(addresslist, "Hero ATC 9 Exp In Battle");
                             btlexp9 = memoryrecord_getValue(btlexp9_address);
                             memoryrecord_setValue(btlexp9_address, 99);
                             btlexp10_address = addresslist_getMemoryRecordByDescription(addresslist, "Hero ATC 10 Exp In Battle");
                             btlexp10 = memoryrecord_getValue(btlexp10_address);
                             memoryrecord_setValue(btlexp10_address, 99);
                             btlexp11_address = addresslist_getMemoryRecordByDescription(addresslist, "Hero ATC 11 Exp In Battle");
                             btlexp11 = memoryrecord_getValue(btlexp11_address);
                             memoryrecord_setValue(btlexp11_address, 99);

                             btlexpa2_address = addresslist_getMemoryRecordByDescription(addresslist, "Hero ATC Ally 2 Exp In Battle");
                             btlexpa2 = memoryrecord_getValue(btlexpa2_address);
                             memoryrecord_setValue(btlexpa2_address, 99);
                             print("Battle Exp. inc. to 99")
                   end;--IncBtlExpTo99()

--
   self.tbtl = createTimer(nil, false)
   self.tbtl.onTimer = IncBtlExpTo99
   self.tbtl.Interval = 500;
   self.tbtl.Enable = false
--
   self.update_btlexp = createButton(self.form);
   self.update_btlexp.Caption = 'Inc. Battle Exp To 99 (Battles ONLY)';
   self.update_btlexp.height = 35;
   self.update_btlexp.left = 84;
   self.update_btlexp.top = 137;
   self.update_btlexp.width = 250;
   self.update_btlexp.onClick = function (sender)
                                         self.tbtl.Enable = true
                                end;--function (sender)

What I'm attempting to accomplish is to have a timer but only have it run once the button is selected.
Two questions what is the correct syntax for a print statement to check status of a timer? As the function never runs what needs to change to make it work?
Back to top
View user's profile Send private message Yahoo Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Mon Apr 20, 2020 9:59 am    Post subject: Reply with quote

Try change:

Code:
self.tbtl = createTimer(nil, false)
self.tbtl.onTimer = IncBtlExpTo99
self.tbtl.Interval = 500;
self.tbtl.Enable = false


to

Code:
self.tbtl = createTimer()
self.tbtl.onTimer = IncBtlExpTo99
self.tbtl.Interval = 500;
self.tbtl.Enabled = false


And

Code:
self.update_btlexp.onClick = function (sender)
                                         self.tbtl.Enable = true
                                end;--function (sender)


to

Code:
self.update_btlexp.onClick = function ()
                                         self.tbtl.Enabled = true
                                end



My example:

Code:
f = createForm()

local x = 0

function increase()
 y = x + 1
 x = y
 print(x)
end

tbtl = createTimer()
tbtl.Interval = 500;
tbtl.Enabled = false
tbtl.onTimer = increase

update_btlexp = createButton(f);
update_btlexp.Caption = 'Inc. Battle Exp To 99 (Battles ONLY)';
update_btlexp.height = 35;
update_btlexp.left = 10;
update_btlexp.top = 137;
update_btlexp.width = 250;

function start()
 tbtl.Enabled = true
end

update_btlexp.OnClick = start

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites