View previous topic :: View next topic |
Author |
Message |
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Mon Mar 27, 2017 4:01 pm Post subject: CheckBox syntax |
|
|
I'm getting an invalid Class object using an old syntax.
Code: | tSave = createTimer(nil, true)
timer_onTimer(tSave, SaveAnywhere)
timer_setInterval(tSave, 500)
timer_setEnabled(tSave, false)
|
So what is the new current syntax?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25287 Location: The netherlands
|
Posted: Mon Mar 27, 2017 4:07 pm Post subject: |
|
|
That code works just fine, I recommend checking SaveAnywhere
Anyhow, the current syntax would be:
Code: |
tSave = createTimer(nil, true)
tSave.OnTimer=SaveAnywhere
tSave.Interval=500
tSave.Enabled=false
|
_________________
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 |
|
|
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Mon Mar 27, 2017 4:11 pm Post subject: |
|
|
Will a function result in an invalid Class object?
Thanks
EDIT: Can a function result in an invalid class object?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25287 Location: The netherlands
|
Posted: Mon Mar 27, 2017 5:58 pm Post subject: |
|
|
If the function does something with the deprecated function call method and gives the wrong kind of object, then yes, it's possible that it will trigger such a message
_________________
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 |
|
|
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Mon Mar 27, 2017 9:42 pm Post subject: |
|
|
What in the world is a deprecated function call method?
I had a print statement as the first line and it never printed just the error message, that is why I thought it was the timer syntax.
Well I re-did a checkbox function and eliminated the timer altogether, works without errors now.
|
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Tue Mar 28, 2017 5:39 pm Post subject: |
|
|
Code: | timer_setInterval({}, 1) |
|
|
Back to top |
|
|
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Tue Mar 28, 2017 8:00 pm Post subject: |
|
|
Zanzer wrote: | Code: | timer_setInterval({}, 1) |
|
OK, but it was set to 500, not 1
|
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Tue Mar 28, 2017 8:57 pm Post subject: |
|
|
Doesn't matter what the number is. When you pass in the wrong object, like the table {}, it throws that error.
|
|
Back to top |
|
|
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Tue Mar 28, 2017 9:12 pm Post subject: |
|
|
Ok, Now I understand what you meant, thanks.
|
|
Back to top |
|
|
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Mon Apr 03, 2017 6:00 pm Post subject: |
|
|
I thought I had this working but...
Code: | self.tp = createTimer(nil, false)
self.tp.onTimer = ConstProtection
self.tp.Interval = 1000;
self.cp_cb = createCheckBox(self.form);
self.cp_cb.Caption = 'Const Protection';
self.cp_cb.Height = 20;
self.cp_cb.Left = 260;
self.cp_cb.Width = 75;
self.cp_cb.Top = 245;
self.cp_cb.onClick = function(sender)
al = getAddressList();
if sender.Checked then
self.tp.Enabled = true;
print("Constant Protection is enabled");
al = getAddressList();
constantarmorplate = readBytes(memoryrecord_getAddress(addresslist_getMemoryRecordByDescription(al, "Armorplate")), 2);
constantchamelon = readBytes(memoryrecord_getAddress(addresslist_getMemoryRecordByDescription(al, "Chameleon")), 2);
constantdetect = readBytes(memoryrecord_getAddress(addresslist_getMemoryRecordByDescription(al, "Detect Secret")), 2);
constantblade = readBytes(memoryrecord_getAddress(addresslist_getMemoryRecordByDescription(al, "Enchanted Blade")), 2);
constantlight = readBytes(memoryrecord_getAddress(addresslist_getMemoryRecordByDescription(al, "Light")), 2);
constantscreen = readBytes(memoryrecord_getAddress(addresslist_getMemoryRecordByDescription(al, "Magic Screen")), 2);
constantshield = readBytes(memoryrecord_getAddress(addresslist_getMemoryRecordByDescription(al, "Missle Shield")), 2);
constanthound = readBytes(memoryrecord_getAddress(addresslist_getMemoryRecordByDescription(al, "Shadow Hound")), 2);
constantxray = readBytes(memoryrecord_getAddress(addresslist_getMemoryRecordByDescription(al, "X-Ray")), 2);
print("Constant Protection is enabled");
else
self.tp.Enabled = false;
print("Constant Protection is not enabled");
end;
end;
function ConstProtection(sender)
al = getAddressList();
print("writing")
writeBytes(memoryrecord_getAddress(addresslist_getMemoryRecordByDescription(al, "Armorplate")), constantarmorplate);
writeBytes(memoryrecord_getAddress(addresslist_getMemoryRecordByDescription(al, "Chameleon")), constantchamelon);
writeBytes(memoryrecord_getAddress(addresslist_getMemoryRecordByDescription(al, "Detect Secret")), constantdetect);
writeBytes(memoryrecord_getAddress(addresslist_getMemoryRecordByDescription(al, "Enchanted Blade")), constantblade);
writeBytes(memoryrecord_getAddress(addresslist_getMemoryRecordByDescription(al, "Light")), constantlight);
writeBytes(memoryrecord_getAddress(addresslist_getMemoryRecordByDescription(al, "Magic Screen")), constantscreen);
writeBytes(memoryrecord_getAddress(addresslist_getMemoryRecordByDescription(al, "Missle Shield")), constantshield);
writeBytes(memoryrecord_getAddress(addresslist_getMemoryRecordByDescription(al, "Shadow Hound")), constanthound);
writeBytes(memoryrecord_getAddress(addresslist_getMemoryRecordByDescription(al, "X-Ray")), constantxray);
end;
|
What is wrong with the code as it isn't working?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25287 Location: The netherlands
|
Posted: Mon Apr 03, 2017 6:14 pm Post subject: |
|
|
at the time self.tp.onTimer = ConstProtection is executed, ConstProtection is nil
to fix this, move the function declaration of function ConstProtection to before that code
Also, unrelated, and assuming the value type is 2 bytes, you can do: al.getMemoryRecordByDescription('Armorplate').Value=constantarmorplate
_________________
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 |
|
|
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Tue Apr 04, 2017 9:54 am Post subject: |
|
|
Ok, moved them, but it seems to me that I had that similar issues and had built the code in the sequence I had i.e.
timer
function
And that seemed to work until the previous thread post, but thanks I'll try to remember what you posted.
Yes those bytes are 2 byte numbers and I'll retype the value setting.
|
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Tue Apr 04, 2017 7:51 pm Post subject: |
|
|
While developing the script, you're constantly hitting the execute script button.
So the previously defined function was being loaded into the timer on the second execution.
It just gave the appearance that it was actually working correctly.
|
|
Back to top |
|
|
|