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 issue

 
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: 577

PostPosted: Sat Jul 19, 2014 11:46 am    Post subject: Timer issue Reply with quote

Using a timer with 6.3 with the following code.
Code:
tAP = createTimer(nil, true)
timer_onTimer(tAP, ConstAP)
timer_setInterval(tAP, 500)
timer_setEnabled(tAP, false)


Further down in the code
Code:
function ConstAP(sender)
local addresslist = getAddressList()
APvalue = tonumber(control_getCaption(CheatPanel_CEEdit1))
APaddress = addresslist_getMemoryRecordByDescription(addresslist, "AP Rec From Battle")
AP = memoryrecord_getValue(APaddress)
memoryrecord_setValue(APaddress, APvalue)
end

function CECheckbox3Click(sender)
boxstateAP = checkbox_getState(CheatPanel_CECheckbox3)
  if boxstateAP == cbChecked then
    timer_setEnabled(tAP, true)
    print("The AP timer is enabled")
    form_show(CheatPanel_CEPanel1)
    form_show(CheatPanel_CEEdit1)
  else
    timer_setEnabled(tAP, false)
    print("The AP timer is not enabled")
    form_hide(CheatPanel_CEPanel1)
    form_hide(CheatPanel_CEEdit1)
    edit_clear(CheatPanel_CEEdit1)
  end
end


The process was to make an edit box visible then input a value and that value carried into the rest of the code. This used to work in 6.2, but now in 9.3, I get an error message Error:Invalid integer. I'm assuming that the error indicates that no entry is in the edit box.

What code steps do I need to add/edit to make the process work again?
Back to top
View user's profile Send private message Yahoo Messenger
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Sat Jul 19, 2014 12:32 pm    Post subject: Reply with quote

Code:
function ConstAP(sender)
   APvalue = tonumber(CheatPanel_CEEdit1.Text);
   if (APvalue) then
      local entry = getAddressList().getMemoryRecordByDescription("AP Rec From Battle");
      AP = entry.value;
      entry.value = APvalue;
   end
end

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 577

PostPosted: Sat Jul 19, 2014 1:49 pm    Post subject: Reply with quote

Code:
AP = entry.value;
entry.value = APvalue;


Seems recursive to me, but it does work.
Thanks
Back to top
View user's profile Send private message Yahoo Messenger
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Sat Jul 19, 2014 2:29 pm    Post subject: Reply with quote

bknight2602 wrote:
Code:
AP = entry.value;
entry.value = APvalue;


Seems recursive to me, but it does work.
Thanks

You defined AP in your script as the entry value, so I added it incase you use it in the script.

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
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