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 


Adding values for lvl and exp

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

PostPosted: Sun Aug 07, 2022 9:29 am    Post subject: Adding values for lvl and exp Reply with quote

I had a code that worked great until today when I added some lvl, exp data toward the beginning of the of the code and i get an error that a "}" needs to be inserted at line sixteen. That would be the line that begins with Stats =
Code:

trainer =    {
                         Data =    {
                                          Characters =    {
                                                     [0] = 'Slyzaar';-- Table auto selects characters based alphabet order... so we will append the characters to the groupbox using value index.
                                                     [1] = 'Tunarle';
                                                     [2] = 'Thai-Chai';
                                                     [3] = 'Zothen';
                                                     [4] = 'No One';

                                                     ["Slyzaar"] = 0;-- Index of radiogroup
                                                     ["Tunarle"] = 1;
                                                     ["Thai-Chai"] = 2;
                                                     ['Zothen'] = 3;
                                                     ['No One'] = 4;
                                          }--Characters
                                          Stats =   { -- Exp and level
                                                      {{1,999};{2,1999};{3,2999};{4,3999};{5,4999};{6,5999};{7,6999};{8,7999};{9,8999};{10,9999};{11,10999};{12,11999};{13,12999};{14,13999};{15,14999};{16,15999};{17,16999};{18,17999};{19,18999};{20,19999};{21,20999};{22,21999};{23,22999};{24,23999};{25,24999};{26,25999};{27,26999};{28,27999};{29,28999};{30,29999};{31,30999};{32,31999};{33,32999};{34,33999};{35,34999};{36,35999};{37,36999};{38,37999};{39,38999};{40,39999};{41,40999};{42,41999};{43,42999};{44,43999};{45,44999};{46,45999};{47,46999};{48,47999};{49,48999};{50,49999};{51,50999};{52,51999};{53,52999};{54,53999};{55,54999};{56,55999};{57,56999};{58,57999};{59,58999};{60,59999};{61,60999};{62,61999};{63,62999};{64,63999};{65,64999};{66,65999};{67,66999};{68,67999};{69,68999};{70,69999};{71,70999};{72,71999};{73,72999};{74,73999};{75,74999};{76,75999};{77,76999};{78,77999};{79,78777};{80,79777};{81,80999};{82,81999};{83,82999};{84,83999};{85,84999};{86,85999};{87,86999};{88,87999};{89,88999};{90,89999};{91,90999};{92,91999};{93,92999};{94,93999};{95,94999};{96,95999};{97,96999};{98,97999};{99,98999};{100,99999};};
                                                      {};
                                                    };--Stats
                          };--Data
             }--Trainer


I am unable to decide where the "}" should be placed.
Back to top
View user's profile Send private message Yahoo Messenger
Frouk
Grandmaster Cheater
Reputation: 5

Joined: 22 Jun 2021
Posts: 512

PostPosted: Sun Aug 07, 2022 11:46 am    Post subject: Reply with quote

you forgot ; near --Characters
Code:
trainer =    {
                         Data =    {
                                          Characters =    {
                                                     [0] = 'Slyzaar';-- Table auto selects characters based alphabet order... so we will append the characters to the groupbox using value index.
                                                     [1] = 'Tunarle';
                                                     [2] = 'Thai-Chai';
                                                     [3] = 'Zothen';
                                                     [4] = 'No One';

                                                     ["Slyzaar"] = 0;-- Index of radiogroup
                                                     ["Tunarle"] = 1;
                                                     ["Thai-Chai"] = 2;
                                                     ['Zothen'] = 3;
                                                     ['No One'] = 4;
                                          };--Characters
                                          Stats =   { -- Exp and level
                                                      {{1,999};{2,1999};{3,2999};{4,3999};{5,4999};{6,5999};{7,6999};{8,7999};{9,8999};{10,9999};{11,10999};{12,11999};{13,12999};{14,13999};{15,14999};{16,15999};{17,16999};{18,17999};{19,18999};{20,19999};{21,20999};{22,21999};{23,22999};{24,23999};{25,24999};{26,25999};{27,26999};{28,27999};{29,28999};{30,29999};{31,30999};{32,31999};{33,32999};{34,33999};{35,34999};{36,35999};{37,36999};{38,37999};{39,38999};{40,39999};{41,40999};{42,41999};{43,42999};{44,43999};{45,44999};{46,45999};{47,46999};{48,47999};{49,48999};{50,49999};{51,50999};{52,51999};{53,52999};{54,53999};{55,54999};{56,55999};{57,56999};{58,57999};{59,58999};{60,59999};{61,60999};{62,61999};{63,62999};{64,63999};{65,64999};{66,65999};{67,66999};{68,67999};{69,68999};{70,69999};{71,70999};{72,71999};{73,72999};{74,73999};{75,74999};{76,75999};{77,76999};{78,77999};{79,78777};{80,79777};{81,80999};{82,81999};{83,82999};{84,83999};{85,84999};{86,85999};{87,86999};{88,87999};{89,88999};{90,89999};{91,90999};{92,91999};{93,92999};{94,93999};{95,94999};{96,95999};{97,96999};{98,97999};{99,98999};{100,99999};};
                                                      {};
                                                    };--Stats
                          };--Data
             }--Trainer
Back to top
View user's profile Send private message
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 586

PostPosted: Sun Aug 07, 2022 12:25 pm    Post subject: Reply with quote

Frouk wrote:
you forgot ; near --Characters
Code:
trainer =    {
                         Data =    {
                                          Characters =    {
                                                     [0] = 'Slyzaar';-- Table auto selects characters based alphabet order... so we will append the characters to the groupbox using value index.
                                                     [1] = 'Tunarle';
                                                     [2] = 'Thai-Chai';
                                                     [3] = 'Zothen';
                                                     [4] = 'No One';

                                                     ["Slyzaar"] = 0;-- Index of radiogroup
                                                     ["Tunarle"] = 1;
                                                     ["Thai-Chai"] = 2;
                                                     ['Zothen'] = 3;
                                                     ['No One'] = 4;
                                          };--Characters
                                          Stats =   { -- Exp and level
                                                      {{1,999};{2,1999};{3,2999};{4,3999};{5,4999};{6,5999};{7,6999};{8,7999};{9,8999};{10,9999};{11,10999};{12,11999};{13,12999};{14,13999};{15,14999};{16,15999};{17,16999};{18,17999};{19,18999};{20,19999};{21,20999};{22,21999};{23,22999};{24,23999};{25,24999};{26,25999};{27,26999};{28,27999};{29,28999};{30,29999};{31,30999};{32,31999};{33,32999};{34,33999};{35,34999};{36,35999};{37,36999};{38,37999};{39,38999};{40,39999};{41,40999};{42,41999};{43,42999};{44,43999};{45,44999};{46,45999};{47,46999};{48,47999};{49,48999};{50,49999};{51,50999};{52,51999};{53,52999};{54,53999};{55,54999};{56,55999};{57,56999};{58,57999};{59,58999};{60,59999};{61,60999};{62,61999};{63,62999};{64,63999};{65,64999};{66,65999};{67,66999};{68,67999};{69,68999};{70,69999};{71,70999};{72,71999};{73,72999};{74,73999};{75,74999};{76,75999};{77,76999};{78,77999};{79,78777};{80,79777};{81,80999};{82,81999};{83,82999};{84,83999};{85,84999};{86,85999};{87,86999};{88,87999};{89,88999};{90,89999};{91,90999};{92,91999};{93,92999};{94,93999};{95,94999};{96,95999};{97,96999};{98,97999};{99,98999};{100,99999};};
                                                      {};
                                                    };--Stats
                          };--Data
             }--Trainer

Um I seee a ";" immediatley after "}" But thanks for the responce.
Back to top
View user's profile Send private message Yahoo Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1527

PostPosted: Sun Aug 07, 2022 12:29 pm    Post subject: Reply with quote

You added a lot of unnecessary bytes.
Why not focus on the result instead of the complex tables?

Here is the shorter code that will give the same stats;



Code:
trainer =    {
    Characters =    {'Slyzaar','Tunarle','Thai-Chai','Zothen','No One'
},--Characters
Stats =   { -- Exp and level
{999},{1999},{2999},{3999},{4999},{5999},{6999},{7999},{8999},{9999},{10999},{11999},{12999},{13999},{14999},{15999},{16999},{17999},{18999},{19999},{20999},{21999},{22999},{23999},{24999},{25999},{26999},{27999},{28999},{29999},{30999},{31999},{32999},{33999},{34999},{35999},{36999},{37999},{38999},{39999},{40999},{41999},{42999},{43999},{44999},{45999},{46999},{47999},{48999},{49999},{50999},{51999},{52999},{53999},{54999},{55999},{56999},{57999},{58999},{59999},{60999},{61999},{62999},{63999},{64999},{65999},{66999},{67999},{68999},{69999},{70999},{71999},{72999},{73999},{74999},{75999},{76999},{77999},{78777},{79777},{80999},{81999},{82999},{83999},{84999},{85999},{86999},{87999},{88999},{89999},{90999},{91999},{92999},{93999},{94999},{95999},{96999},{97999},{98999},{99999}
};--Stats
}--Trainer

--Characters:
for index,character in pairs(trainer.Characters) do
    radio_Index = tonumber(index) -1
--print("radio_Index: "..radio_Index.."\nTableIndex: "..index.."\nCharacters: "..character.."\n")
end

-- Ex Radio index 1 = Table index: aa = tonumber(radio index) + 1 , trainer.Data.Characters[aa]
-- Ex Character index 2 = Radio index: tonumber(Characters index) - 1
--for character,_ in pairs(trainer.Characters) do
      --self.characters_rg.getItems().add(_);
  --end

--Stats
for i=1, #trainer.Stats do
 Level = i -- or table index
 Xp = trainer.Stats[i][1]
 print("\nLevel: "..Level.."\nXp: "..Xp)
end

--use
local Lvl = 7
 Xp = trainer.Stats[Lvl][1]
 print("Level: "..Lvl.."\nXp: "..Xp) -- > Level: 7  Xp: 6999

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 586

PostPosted: Sun Aug 07, 2022 1:20 pm    Post subject: Reply with quote

AylinCE wrote:
You added a lot of unnecessary bytes.
Why not focus on the result instead of the complex tables?

Here is the shorter code that will give the same stats;



Code:
trainer =    {
    Characters =    {'Slyzaar','Tunarle','Thai-Chai','Zothen','No One'
},--Characters
Stats =   { -- Exp and level
{999},{1999},{2999},{3999},{4999},{5999},{6999},{7999},{8999},{9999},{10999},{11999},{12999},{13999},{14999},{15999},{16999},{17999},{18999},{19999},{20999},{21999},{22999},{23999},{24999},{25999},{26999},{27999},{28999},{29999},{30999},{31999},{32999},{33999},{34999},{35999},{36999},{37999},{38999},{39999},{40999},{41999},{42999},{43999},{44999},{45999},{46999},{47999},{48999},{49999},{50999},{51999},{52999},{53999},{54999},{55999},{56999},{57999},{58999},{59999},{60999},{61999},{62999},{63999},{64999},{65999},{66999},{67999},{68999},{69999},{70999},{71999},{72999},{73999},{74999},{75999},{76999},{77999},{78777},{79777},{80999},{81999},{82999},{83999},{84999},{85999},{86999},{87999},{88999},{89999},{90999},{91999},{92999},{93999},{94999},{95999},{96999},{97999},{98999},{99999}
};--Stats
}--Trainer

--Characters:
for index,character in pairs(trainer.Characters) do
    radio_Index = tonumber(index) -1
--print("radio_Index: "..radio_Index.."\nTableIndex: "..index.."\nCharacters: "..character.."\n")
end

-- Ex Radio index 1 = Table index: aa = tonumber(radio index) + 1 , trainer.Data.Characters[aa]
-- Ex Character index 2 = Radio index: tonumber(Characters index) - 1
--for character,_ in pairs(trainer.Characters) do
      --self.characters_rg.getItems().add(_);
  --end

--Stats
for i=1, #trainer.Stats do
 Level = i -- or table index
 Xp = trainer.Stats[i][1]
 print("\nLevel: "..Level.."\nXp: "..Xp)
end

--use
local Lvl = 7
 Xp = trainer.Stats[Lvl][1]
 print("Level: "..Lvl.."\nXp: "..Xp) -- > Level: 7  Xp: 6999

I'll give that a try. The characters load into a radiogroup characters_rg
the lvl, exp loads into a listview listview_Level further down the code. The code I have for the rg works, I believe, the listview, I could not load due to error. Ultimately that experience will change the character experience upon selecting one in the listvieew.


ETA:
Well that didn't work
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(trainer.Characters) do
      if tonumber(character) then
         self.characters_rg.getItems().add(_);
      end
   end
   self.characters_rg.onClick =    function (sender)
                                    local index = strings_getString(sender.getItems(), sender.ItemIndex); -- I'm bit lazy, so sender == trainer.characters_rg
                                    local i = nil;

the code fails on this one, maybe more but this one for sure, on selecting one of the radio items. attempt to perform arithmetic on a nil value (field '?')
i = trainer.characters_rg[index] + 1;
Code:

                                    if i then
                                       heroname = index;
                                       --print("The index selected is", trainer.characters_rg[index]);
                                       --print("The hero selected from index is ", index);
                                       print("The hero name is ", heroname);
entry.getSubItems().add(__table[2]);
                                    end
                                    if expvalue and goldvalue and heroname and heroname ~= "No One" then
                                       RecalculateAddresses()
                                    end
                                 end
Back to top
View user's profile Send private message Yahoo Messenger
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 586

PostPosted: Mon Aug 08, 2022 9:46 am    Post subject: Reply with quote

From the edit of previous post.

Well that didn't work
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(trainer.Characters) do
      if tonumber(character) then
         self.characters_rg.getItems().add(_);
      end
   end
   self.characters_rg.onClick =    function (sender)
                                    local index = strings_getString(sender.getItems(), sender.ItemIndex); -- I'm bit lazy, so sender == trainer.characters_rg
                                    local i = nil;

the code fails on this one, maybe more but this one for sure, on selecting one of the radio items. attempt to perform arithmetic on a nil value (field '?')
i = trainer.characters_rg[index] + 1;
Code:

                                    if i then
                                       heroname = index;
                                       --print("The index selected is", trainer.characters_rg[index]);
                                       --print("The hero selected from index is ", index);
                                       print("The hero name is ", heroname);
entry.getSubItems().add(__table[2]);
                                    end
                                    if expvalue and goldvalue and heroname and heroname ~= "No One" then
                                       RecalculateAddresses()
                                    end
                                 end
Back to top
View user's profile Send private message Yahoo Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1527

PostPosted: Mon Aug 08, 2022 11:27 am    Post subject: Reply with quote

Code:
local self = {}
trainer =    {
    Characters =    {'Slyzaar','Tunarle','Thai-Chai','Zothen','No One'
},--Characters
Stats =   { -- Exp and level
{999},{1999},{2999},{3999},{4999},{5999},{6999},{7999},{8999},{9999},{10999},{11999},{12999},{13999},{14999},{15999},{16999},{17999},{18999},{19999},{20999},{21999},{22999},{23999},{24999},{25999},{26999},{27999},{28999},{29999},{30999},{31999},{32999},{33999},{34999},{35999},{36999},{37999},{38999},{39999},{40999},{41999},{42999},{43999},{44999},{45999},{46999},{47999},{48999},{49999},{50999},{51999},{52999},{53999},{54999},{55999},{56999},{57999},{58999},{59999},{60999},{61999},{62999},{63999},{64999},{65999},{66999},{67999},{68999},{69999},{70999},{71999},{72999},{73999},{74999},{75999},{76999},{77999},{78777},{79777},{80999},{81999},{82999},{83999},{84999},{85999},{86999},{87999},{88999},{89999},{90999},{91999},{92999},{93999},{94999},{95999},{96999},{97999},{98999},{99999}
};--Stats
}--Trainer

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 = 450;
   self.form.Height = 360;
   self.form.Left = 340;
   self.form.Top =7;

   self.characters_rg = createRadioGroup(self.form)
  self.characters_rg.Caption = 'Characters:'
  self.characters_rg.AutoSize = true
  self.characters_rg.Columns = 1
  self.characters_rg.setItemIndex(-1)
  self.characters_rg.Top = 90
  self.characters_rg.Left = 5
  for character,_ in pairs(trainer.Characters) do
    if tonumber(character) then
      self.characters_rg.getItems().add(_);
    end
  end--for character,_ in pairs(trainer.Characters) do
self.characters_rg.onClick =    function (sender)
                                    local heroname = strings_getString(sender.getItems(), sender.ItemIndex);
                                    local index = sender.ItemIndex
                                    local TableIndex = sender.ItemIndex + 1
                                    --print(index)
                                    print("The index ("..index..") selected is: ", trainer.Characters[TableIndex])
                                    end


self.form.show()

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 586

PostPosted: Tue Aug 09, 2022 5:21 am    Post subject: Reply with quote

I have been busy running around in circles and changing some of the old code. I found more accurate lvl/exp data so those were changed but generally work, at least no error codes.
Code:

trainer =    {
                         Data =    {
                                          Characters =    {
                                                     [0] = 'Slyzaar';
                                                     [1] = 'Tunarle';
                                                     [2] = 'Thai-Chai';
                                                     [3] = 'Zothen';
                                                     [4] = 'No One';
                                          };--Characters
                                          Stats =   { -- Exp and level
                                                    {{1,1999};{2,5999};{3,11999};{4,24999};{5,49999};{6,99999};{7,199999};{8,299999};{9,419999};{10,549999};{11,699999};{12,849999};{13,999999};{14,1249999};{15,1499999};{16,1749999};{17,1999999};{18,2499999};{19,2999999};{20,3999999};{21,4999999};{22,5999999};{23,7999999};{24,9999999};{25,19999999};{26,49999999};{27,99999999};};
                                                    {{1,1999};{2,5999};{3,11999};{4,24999};{5,49999};{6,99999};{7,199999};{8,299999};{9,419999};{10,549999};{11,699999};{12,849999};{13,999999};{14,1249999};{15,1499999};{16,1749999};{17,1999999};{18,2499999};{19,2999999};{20,3999999};{21,4999999};{22,5999999};{23,7999999};{24,9999999};{25,19999999};{26,49999999};{27,99999999};};
                                                    {{1,1999};{2,5999};{3,11999};{4,24999};{5,49999};{6,99999};{7,199999};{8,299999};{9,419999};{10,549999};{11,699999};{12,849999};{13,999999};{14,1249999};{15,1499999};{16,1749999};{17,1999999};{18,2499999};{19,2999999};{20,3999999};{21,4999999};{22,5999999};{23,7999999};{24,9999999};{25,19999999};{26,49999999};{27,99999999};};
                                                    {{1,1999};{2,5999};{3,11999};{4,24999};{5,49999};{6,99999};{7,199999};{8,299999};{9,419999};{10,549999};{11,699999};{12,849999};{13,999999};{14,1249999};{15,1499999};{16,1749999};{17,1999999};{18,2499999};{19,2999999};{20,3999999};{21,4999999};{22,5999999};{23,7999999};{24,9999999};{25,19999999};{26,49999999};{27,99999999};};
                                                    {{0,0}};
                                                    };--Stats

                         };--Data
             };--Trainer


Further forward in the code the rg and listview were created. The rg works without error, but the listview isn't populated with lvl/exp data.
Code:

--
   self.listview_Level = createListView(self.form)
   setProperty(self.listview_Level, 'ViewStyle', 'vsReport')
   setProperty(self.listview_Level, 'RowSelect', 'True')
   setProperty(self.listview_Level, 'ReadOnly', 'True')
   setProperty(self.listview_Level, 'HideSelection', 'False')
   self.listview_Level.top = 180;
   self.listview_Level.width = 140;
   self.listview_Level.left = 95;
   self.listview_Level.height = 170;
   self.listview_Level.OnClick = function (sender)
                              local char
                              if (self.characters_rg.ItemIndex >= 0 ) then
                                 char = strings_getString(self.characters_rg.getItems(), self.characters_rg.ItemIndex);
                                 self.listview_Level.visible = true
                              end
                              local row_1 = sender.getItems().getItem(sender.getItemIndex()); -- Level
                              local row_2 = strings_getString(row_1.getSubItems(),0) + 0; -- Exp
                              if (char and row_1 and row_2) then
                                 local address_1 = addresslist_getMemoryRecordByDescription(getAddressList(),char .. ' Exp 8 Times Displayed Value');
                                 memoryrecord_setValue(address_1, row_2)
                              end
                              self.characters_rg.setItemIndex(8);
                              self.listview_Level.visible = false
                           end
   self.listview_Level_colum1 = self.listview_Level.getColumns().add()
   self.listview_Level_colum1.Width = 40;
   self.listview_Level_colum1.Caption = 'Lvl';
   self.listview_Level_colum2 = self.listview_Level.getColumns().add()
   self.listview_Level_colum2.Width = 90;
   self.listview_Level_colum2.Caption = 'Exp';
--
   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
   self.characters_rg.onClick =    function (sender)
                                    local index = strings_getString(sender.getItems(), sender.ItemIndex);
                                    local i = nil;
                                    i = self.Data.Characters[index] + 1;
                                    -- for k,v in pairs (self.Data.Characters) do
                                       -- if k==index then
                                          -- i = v+1
                                    -- end

I added those last four lines to get the rg to display the names, but they were displayed even with the lines commented out.
Code:

                                    if i then
                                       heroname = index;
                                       self.Data.Characters[index]);
                                       print("The hero name is ", heroname);
                                       self.listview_Level.clear();
                                       for _,__table in pairs(self.Data.Stats[i]) do
                                          local entry = self.listview_Level.getItems().add();
                                          entry.Caption = __table[1];
                                          local subentry = entry.getSubItems().add(__table[2]);
                                       end
                                    end
                                    if expvalue and goldvalue and heroname and heroname ~= "No One" then
                                       RecalculateAddresses()
                                    end
                                 end

Remember the scheme of these couple of routines is to:
1, Display the names
2. When a name is selected then the lvl/exp data is supposed to be displayed
3. When a specific lvl/exp is selected from the list then the exp value of the char. is adhusted.
At least those were my ideas.
Back to top
View user's profile Send private message Yahoo Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1527

PostPosted: Tue Aug 09, 2022 7:41 am    Post subject: Reply with quote

What I want to say is;
If you are using a table and the items in it are in order (without jumping in table length (unless it is 1.4.5.8.9.11. And sequential like 1.2.3.4.5..100)), you do not need to add milestones to that table.
This gives you extra code, bytes and a waste of time.

Below is an abbreviated example of table characters and their usage.
You can interpret it as you wish in your trainer.

Open CE, paste the code, enable it and click the radio characters.

Code:
trainer =    {
  Characters = {'Slyzaar','Tunarle','Thai-Chai','Zothen','No One'},--Characters
  Stats = { -- Exp and level
            {1999,5999,11999,24999,49999,99999,199999,299999,419999,549999,699999,849999,999999,1249999,1499999,1749999,1999999,2499999,2999999,3999999,4999999,5999999,7999999,9999999,19999999,49999999,99999999},
            {2999,5999,11999,24999,49999,99999,199999,299999,419999,549999,699999,849999,999999,1249999,1499999,1749999,1999999,2499999,2999999,3999999,4999999,5999999,7999999,9999999,19999999,49999999,99999999},
            {3999,5999,11999,24999,49999,99999,199999,299999,419999,549999,699999,849999,999999,1249999,1499999,1749999,1999999,2499999,2999999,3999999,4999999,5999999,7999999,9999999,19999999,49999999,99999999},
            {4999,5999,11999,24999,49999,99999,199999,299999,419999,549999,699999,849999,999999,1249999,1499999,1749999,1999999,2499999,2999999,3999999,4999999,5999999,7999999,9999999,19999999,49999999,99999999},
            {"No One"}
     };--Stats
 };--Trainer

 local self = {}

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 = 450;
   self.form.Height = 360;
   self.form.Left = 340;
   self.form.Top =7;

   self.characters_rg = createRadioGroup(self.form)
  self.characters_rg.Caption = 'Characters:'
  self.characters_rg.AutoSize = true
  self.characters_rg.Columns = 1
  self.characters_rg.setItemIndex(-1)
  self.characters_rg.Top = 90
  self.characters_rg.Left = 5
  for character,_ in pairs(trainer.Characters) do
    if tonumber(character) then
      self.characters_rg.getItems().add(_);
    end
  end--for character,_ in pairs(trainer.Characters) do

   self.listview_Level = createListView(self.form)
   setProperty(self.listview_Level, 'ViewStyle', 'vsReport')
   setProperty(self.listview_Level, 'RowSelect', 'True')
   setProperty(self.listview_Level, 'ReadOnly', 'True')
   setProperty(self.listview_Level, 'HideSelection', 'False')
   self.listview_Level.top = 180;
   self.listview_Level.width = 140;
   self.listview_Level.left = 95;
   self.listview_Level.height = 170;
   self.listview_Level_colum1 = self.listview_Level.getColumns().add()
   self.listview_Level_colum1.Width = 40;
   self.listview_Level_colum1.Caption = 'Lvl';
   self.listview_Level_colum2 = self.listview_Level.getColumns().add()
   self.listview_Level_colum2.Width = 90;
   self.listview_Level_colum2.Caption = 'Exp';
--
self.characters_rg.onClick =    function (sender)
                                    local heroname = strings_getString(sender.getItems(), sender.ItemIndex);
                                    local index = sender.ItemIndex
                                    local TableIndex = sender.ItemIndex + 1
                                    --print(index)
                                    print("The index ("..index..") selected is: ", trainer.Characters[TableIndex])

                                       if index then

                                       heroname = trainer.Characters[TableIndex] -- = [tonumber(index)+1]
                                       print("The hero name is ", heroname);
                                       self.listview_Level.clear();
                                         for lvl,Xp in pairs(trainer.Stats[TableIndex]) do -- TableIndex = select self.characters_rg item index + 1
                                          local entry = self.listview_Level.getItems().add();
                                          entry.Caption = lvl
                                          local subentry = entry.getSubItems().add(Xp);
                                         end
                                       end
                                    end


self.form.show()



Note: You have been dealing with this Trainer and its codes for a long time. I hope you get a successful result working properly before 7.5 arrives. Smile

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
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