View previous topic :: View next topic |
Author |
Message |
omax Newbie cheater Reputation: 0
Joined: 29 May 2014 Posts: 14 Location: Jupiter
|
Posted: Wed Sep 10, 2014 5:03 am Post subject: Invalid class object error |
|
|
Hi,
I'm trying to make a trainer but every time I try to check the status of my check box using checkbox_getStatus() I get an error in the console stating: Invalid class object.
here's the code:
Code: | function no_railgun_inaccuracyChange(sender)
local no_railgun_inaccuracy_mr=addresslist_getMemoryRecordByDescription(getAddressList(),"No loss of aiming accuracy after a railgun shot")
if checkbox_getState(no_railgun_inaccuracy) == 1 then
memoryrecord_freeze(no_railgun_inaccuracy_mr)
else
memoryrecord_unfreeze(no_railgun_inaccuracy_mr)
end
end |
I've also tried using "if checkbox_getState(no_railgun_inaccuracy) == cbChecked then" and "if checkbox_getState(no_railgun_inaccuracy, 1) then"
but I keep on getting the same error every time
is there a problem in the compiler or am I doing something wrong
thanks for the help
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Wed Sep 10, 2014 5:49 am Post subject: |
|
|
memoryrecords are no checkbox classes, so don't use checkbox_ methods on them
Instead, check the Active property of the memoryrecord
e,.g something like:
Code: |
function no_railgun_inaccuracyChange(sender)
local no_railgun_inaccuracy_mr=getAddressList().getMemoryRecordByDescription("No loss of aiming accuracy after a railgun shot")
if no_railgun_inaccuracy_mr.Active then
no_railgun_inaccuracy_mr.Active=false --freeze
else
no_railgun_inaccuracy_mr.Active=true --unfreeze
--alternatively instead of the if and these 3 other lines do
--no_railgun_inaccuracy_mr.Active=not no_railgun_inaccuracy_mr.Active
end
|
_________________
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 |
|
|
omax Newbie cheater Reputation: 0
Joined: 29 May 2014 Posts: 14 Location: Jupiter
|
Posted: Wed Sep 10, 2014 7:10 am Post subject: |
|
|
thanks for your reply Dark Byte.
i was not trying using my memory record as a check box, i have one in my trainer named "no_railgun_inaccuracy" and the memory record i was trying to freeze/unfreeze was "no_railgun_inaccuracy_mr". your method worked perfectly fine for me, thanks, but i wanted use checkbox_getState(no_railgun_inaccuracy), in my if condition, to check my check box's(which is in my trainer, not the memory recored) status, however i get that Invalid class object error every time i try to use "if checkbox_getState(no_railgun_inaccuracy) == 1 then"", so my question basicly is if this class itself is buggy or am i using it wrongly.
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Wed Sep 10, 2014 10:21 am Post subject: |
|
|
Instead of no_railgun_inaccuracy give sender and see if that works
Also, it's most likely you haven't defined a global variable named no_railgun_inaccuracy and assigned it the checkbox object, so i suggest getting the checkbox from the form it is on
E.g myformname.no_railgun_inaccuracy
_________________
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 |
|
|
|