View previous topic :: View next topic |
Author |
Message |
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Sun Jul 24, 2022 11:13 am Post subject: Worrisome behavior to old table |
|
|
I have an old table that code has worked. However when trying to execute commands that begin with trainer.XXX, I get an Access violation. The code compiles without error and I'll attach a partial bit of the code.
Code: |
function trainer:start()
self.form = createForm(false); -- self = trainer since it's a function inside of a table...
setProperty(self.form , "BiDiMode", "bdLeftToRight");
self.form.Caption = 'Cheat Panel';
self.form.Width = 420;
self.form.Height = 420;
self.form.Left = 385;
self.form.Top =7;
.......
self.value_panel3 = createPanel(self.form);
self.value_panel3.Caption = '';
self.value_panel3.left = 240;
self.value_panel3.top = 130;
self.value_panel3.Height = 35;
self.value_panel3.Width = 90;--Extra Exp
--
self.value_panel4 = createPanel(self.form);
self.value_panel4.Caption = '';
self.value_panel4.left = 240;
self.value_panel4.top = 170;
self.value_panel4.Height = 35;
self.value_panel4.Width = 90;--Extra Ap
--
self.extra_ap_value = createEdit(self.value_panel4);
self.extra_ap_value.top = 4;
self.extra_ap_value.left = 2;
self.extra_ap_value.Width = 86;
self.extra_ap_value.Height = 33;
local keynr = string.byte(key); if (keynr~=8) and (keynr~=45) and (keynr~=13) and ((keynr<48) or (keynr>57)) then key=nil; end if (keynr==13 and not(sender.Caption == nil or sender.Caption == '')) then key = nil; self.set_exp.onClick(); end return key; end)
--
self.extra_exp_value = createEdit(self.value_panel3);
self.extra_exp_value.top = 4;
self.extra_exp_value.left = 2;
self.extra_exp_value.Width = 86;
self.extra_exp_value.Height = 33;
local keynr = string.byte(key); if (keynr~=8) and (keynr~=45) and (keynr~=13) and ((keynr<48) or (keynr>57)) then key=nil; end if (keynr==13 and not(sender.Caption == nil or sender.Caption == '')) then key = nil; self.set_exp.onClick(); end return key; end)
--
function ExtraExp(sender)
local AL = getAddressList();
-- if not valueE then
valueE = tonumber(trainer.extra_exp_value.Text);
--print(valueE)
-- end;
-- if not valueA then
valueA = tonumber(trainer.extra_ap_value.Text);
--print(valueA)
-- end;
if tonumber(addresslist_getMemoryRecordByDescription(AL, "Battle Byte").Value) == 32 then
if valueE then
addresslist_getMemoryRecordByDescription(AL, "After Battle Non Kill XP").Value = valueE
end;
if valueA then
addresslist_getMemoryRecordByDescription(AL, "After Battle AP").Value = tonumber(valueA)
end;
end;
end
--
|
valueE = tonumber(trainer.extra_exp_value.Text); gives the Access violation
valueA = tonumber(trainer.extra_ap_value.Text); gives the Access violation
Code: |
self.characters_rg = createRadioGroup(self.form);
self.characters_rg.height = 250;
self.characters_rg.width = 90;
self.characters_rg.top = 90;
self.characters_rg.left = 5;
for character,_ in pairs(self.Data.Characters) do
if tonumber(character) then
self.characters_rg.getItems().add(_);
end
end
|
Further forward in the code
trainer.characters_rg.setItemIndex( gives the same Access violation
Code: |
self.form.show();
print("God mode is not enabled");
print("The table needs to be recalculated");
end--trainer
--
trainer:start();
|
Any ideas why the code that used to work, now is an Access violation?
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1257
|
Posted: Sun Jul 24, 2022 2:01 pm Post subject: |
|
|
Code: | valueE = tonumber(trainer.extra_exp_value.Text);
valueA = tonumber(trainer.extra_ap_value.Text);
-- use
valueE = tonumber(self.extra_exp_value.Text);
valueA = tonumber(self.extra_ap_value.Text);
|
and
Code: |
local self = { }
function trainer_start()
self.form = createForm(false);
...
end
trainer_start()
|
_________________
Last edited by AylinCE on Sun Jul 24, 2022 3:20 pm; edited 1 time in total |
|
Back to top |
|
|
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Sun Jul 24, 2022 2:14 pm Post subject: |
|
|
AylinCE wrote: | Code: | valueE = tonumber(trainer.extra_exp_value.Text);
valueA = tonumber(trainer.extra_ap_value.Text);
-- use
valueE = tonumber(self.extra_exp_value.Text);
valueA = tonumber(self.extra_ap_value.Text);
|
|
The procedure call is after the initial compilation and I have had problems using self. That being said I will give it a try and report back.
ETA: I changed the code to self and all works well thanks.
|
|
Back to top |
|
|
|