Posted: Sat Jul 19, 2014 11:46 am Post subject: Timer issue
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?
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
_________________
I'm rusty and getting older, help me re-learn lua.
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