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 


loading correct table values
Goto page 1, 2  Next
 
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: 582

PostPosted: Wed Sep 20, 2023 1:32 pm    Post subject: loading correct table values Reply with quote

Setup, table with a RadioGroup selecting characters, once selected a listview is supposed to display level/Exp. Partial code.
Code:

trainer =    {
            Data =    {
                        Characters =    {
                                          ["Hero 1"] = 0; -- Index of radiogroup
                                          ["Hero 2"] = 1;
                                          ["Hero 3"] = 2;
                                          ["Hero 4"] = 3;
                                          ["No One"] = 4;
                                       };
                        Stats =   { -- Exp and level
                                           {{1,28};{2,86};{3,173};{4,303};{5,498};{6,791};{7,1231};{8,1890};{9,2879};{10,4363};{11,6217};{12,8533};{13,11427};{14,15044};{15,19113};{16,23689};{17,28836};{18,34626};{19,41140};{20,48467};{21,56710};{22,65982};{23,76412};{24,88146};{25,101346};{26,116195};{27,132900};{28,151693};{29,172835};{30,196620};{31,223377};{32,253479};{33,287343};{34,325439};{35,368297};{36,416511};{37,470751};{38,531770};{39,600416};{40,677643};{41,764523};{42,862262};{43,960001};{44,1057740};{45,1155479};{46,1253218};{47,1350957};{48,1448696};{49,1546435};{50,1644174};{51,1741913};{52,1839652};{53,1937391};{54,2035130};{55,2132869};{56,2230608};{57,2328347};{58,2426086};{59,2523825};{60,2621564};{61,2719303};{62,2817042};{63,2914781};{64,3012520};{65,3110259};{66,3207998};{67,3305737};{68,3403476};{69,3501215};{70,3598954};{71,3696693};{72,3794432};{73,3892171};{74,3989910};{75,4087649};{76,4185388};{77,4283127};{78,4380866};{79,4478605};{80,4576344};{81,4674083};{82,4771822};{83,4869561};{84,4967300};{85,5065039};{86,5162778};{87,5260517};{88,5358256};{89,5455995};{90,5553734};{91,5651473};{92,5749212};{93,5846951};{94,5944690};{95,6042429};{96,6140168};{97,6237907};{98,6335646};};
                                           {{1,11};{2,35};{3,83};{4,155};{5,263};{6,425};{7,668};{8,1032};{9,1578};{10,2397};{11,3626};{12,5162};{13,7082};{14,9482};{15,12482};{16,16232};{17,20919};{18,26778};{19,34101};{20,42339};{21,51607};{22,62033};{23,73762};{24,86956};{25,101800};{26,118499};{27,137285};{28,158420};{29,182196};{30,208944};{31,239035};{32,272887};{33,310971};{34,353815};{35,402014};{36,456238};{37,517240};{38,585867};{39,663072};{40,749927};{41,847638};{42,945349};{43,1043060};{44,1140771};{45,1238482};{46,1336193};{47,1433904};{48,1531615};{49,1629326};{50,1727037};{51,1824748};{52,1922459};{53,2020170};{54,2117881};{55,2215592};{56,2313303};{57,2411014};{58,2508725};{59,2606436};{60,2704147};{61,2801858};{62,2899569};{63,2997280};{64,3094991};{65,3192702};{66,3290413};{67,3388124};{68,3485835};{69,3583546};{70,3681257};{71,3778968};{72,3876679};{73,3974390};{74,4072101};{75,4169812};{76,4267523};{77,4365234};{78,4462945};{79,4560656};{80,4658367};{81,4756078};{82,4853789};{83,4951500};{84,5049211};{85,5146922};{86,5244633};{87,5342344};{88,5440055};{89,5537766};{90,5635477};{91,5733188};{92,5830899};{93,5928610};{94,6026321};{95,6124032};{96,6221743};{97,6319454};{98,6417165};};
                                           {{1,13};{2,41};{3,97};{4,181};{5,307};{6,496};{7,779};{8,1204};{9,1841};{10,2797};{11,4231};{12,6023};{13,8263};{14,11063};{15,14563};{16,18938};{17,24406};{18,30558};{19,37478};{20,45262};{21,54019};{22,63871};{23,74954};{24,87422};{25,101449};{26,117228};{27,134980};{28,154951};{29,177418};{30,202693};{31,231127};{32,263115};{33,299101};{34,339584};{35,385127};{36,436363};{37,494003};{38,558848};{39,631798};{40,713866};{41,806193};{42,910060};{43,1026911};{44,1143762};{45,1260613};{46,1377464};{47,1494315};{48,1611166};{49,1728017};{50,1844868};{51,1961719};{52,2078570};{53,2195421};{54,2312272};{55,2429123};{56,2545974};{57,2662825};{58,2779676};{59,2896527};{60,3013378};{61,3130229};{62,3247080};{63,3363931};{64,3480782};{65,3597633};{66,3714484};{67,3831335};{68,3948186};{69,4065037};{70,4181888};{71,4298739};{72,4415590};{73,4532441};{74,4649292};{75,4766143};{76,4882994};{77,4999845};{78,5116696};{79,5233547};{80,5350398};{81,5467249};{82,5584100};{83,5700951};{84,5817802};{85,5934653};{86,6051504};{87,6168355};{88,6285206};{89,6402057};{90,6518908};{91,6635759};{92,6752610};{93,6869461};{94,6986312};{95,7103163};{96,7220014};{97,7336865};{98,7453716};};
                                           {{1,19};{2,59};{3,139};{4,259};{5,439};{6,709};{7,1114};{8,1721};{9,2632};{10,3998};{11,6046};{12,8606};{13,11806};{14,15806};{15,20806};{16,27056};{17,34868};{18,43656};{19,53542};{20,64663};{21,77174};{22,91249};{23,107082};{24,124894};{25,144932};{26,167474};{27,192834};{28,221364};{29,253460};{30,289567};{31,330187};{32,375884};{33,427292};{34,485125};{35,550187};{36,623382};{37,705725};{38,798361};{39,902576};{40,1019817};{41,1151713};{42,1300095};{43,1448477};{44,1596859};{45,1745241};{46,1893623};{47,2042005};{48,2190387};{49,2338769};{50,2487151};{51,2635533};{52,2783915};{53,2932297};{54,3080679};{55,3229061};{56,3377443};{57,3525825};{58,3674207};{59,3822589};{60,3970971};{61,4119353};{62,4267735};{63,4416117};{64,4564499};{65,4712881};{66,4861263};{67,5009645};{68,5158027};{69,5306409};{70,5454791};{71,5603173};{72,5751555};{73,5899937};{74,6048319};{75,6196701};{76,6345083};{77,6493465};{78,6641847};{79,6790229};{80,6938611};{81,7086993};{82,7235375};{83,7383757};{84,7532139};{85,7680521};{86,7828903};{87,7977285};{88,8125667};{89,8274049};{90,8422431};{91,8570813};{92,8719195};{93,8867577};{94,9015959};{95,9164341};{96,9312723};{97,9461105};{98,9609487};};
                                           {{1,14};{2,44};{3,104};{4,194};{5,329};{6,531};{7,834};{8,1289};{9,1972};{10,2996};{11,4532};{12,6452};{13,8852};{14,11852};{15,15602};{16,20289};{17,25562};{18,31494};{19,38168};{20,45675};{21,54120};{22,63621};{23,74309};{24,86333};{25,99860};{26,115077};{27,132196};{28,151455};{29,173120};{30,197493};{31,224912};{32,255757};{33,290457};{34,329494};{35,373411};{36,422817};{37,478398};{38,540926};{39,611270};{40,690407};{41,779435};{42,879591};{43,992267};{44,1119027};{45,1245787};{46,1372547};{47,1499307};{48,1626067};{49,1752827};{50,1879587};{51,2006347};{52,2133107};{53,2259867};{54,2386627};{55,2513387};{56,2640147};{57,2766907};{58,2893667};{59,3020427};{60,3147187};{61,3273947};{62,3400707};{63,3527467};{64,3654227};{65,3780987};{66,3907747};{67,4034507};{68,4161267};{69,4288027};{70,4414787};{71,4541547};{72,4668307};{73,4795067};{74,4921827};{75,5048587};{76,5175347};{77,5302107};{78,5428867};{79,5555627};{80,5682387};{81,5809147};{82,5935907};{83,6062667};{84,6189427};{85,6316187};{86,6442947};{87,6569707};{88,6696467};{89,6823227};{90,6949987};{91,7076747};{92,7203507};{93,7330267};{94,7457027};{95,7583787};{96,7710547};{97,7837307};{98,7964067};};
                                           {{1,9};{2,29};{3,69};{4,129};{5,219};{6,354};{7,556};{8,859};{9,1314};{10,1997};{11,3021};{12,4301};{13,5901};{14,7901};{15,10401};{16,13526};{17,17432};{18,22314};{19,27806};{20,33984};{21,40934};{22,48753};{23,57549};{24,67444};{25,78576};{26,91099};{27,105187};{28,121036};{29,138866};{30,158924};{31,181489};{32,206875};{33,235434};{34,267562};{35,303706};{36,344367};{37,390111};{38,441572};{39,499466};{40,564596};{41,637867};{42,720297};{43,813031};{44,905765};{45,998499};{46,1091233};{47,1183967};{48,1276701};{49,1369435};{50,1462169};{51,1554903};{52,1647637};{53,1740371};{54,1833105};{55,1925839};{56,2018573};{57,2111307};{58,2204041};{59,2296775};{60,2389509};{61,2482243};{62,2574977};{63,2667711};{64,2760445};{65,2853179};{66,2945913};{67,3038647};{68,3131381};{69,3224115};{70,3316849};{71,3409583};{72,3502317};{73,3595051};{74,3687785};{75,3780519};{76,3873253};{77,3965987};{78,4058721};{79,4151455};{80,4244189};{81,4336923};{82,4429657};{83,4522391};{84,4615125};{85,4707859};{86,4800593};{87,4893327};{88,4986061};{89,5078795};{90,5171529};{91,5264263};{92,5356997};{93,5449731};{94,5542465};{95,5635199};{96,5727933};{97,5820667};{98,5913401};};
                                           {{1,17};{2,53};{3,125};{4,233};{5,395};{6,638};{7,1002};{8,1548};{9,2368};{10,3597};{11,5440};{12,7744};{13,10624};{14,14224};{15,18724};{16,24349};{17,30677};{18,37796};{19,45804};{20,54813};{21,64948};{22,76349};{23,89175};{24,103604};{25,119836};{26,138097};{27,158640};{28,181750};{29,207748};{30,236995};{31,269897};{32,306911};{33,348551};{34,395396};{35,448096};{36,507383};{37,574080};{38,649114};{39,733527};{40,828491};{41,935325};{42,1055513};{43,1190724};{44,1325935};{45,1461146};{46,1596357};{47,1731568};{48,1866779};{49,2001990};{50,2137201};{51,2272412};{52,2407623};{53,2542834};{54,2678045};{55,2813256};{56,2948467};{57,3083678};{58,3218889};{59,3354100};{60,3489311};{61,3624522};{62,3759733};{63,3894944};{64,4030155};{65,4165366};{66,4300577};{67,4435788};{68,4570999};{69,4706210};{70,4841421};{71,4976632};{72,5111843};{73,5247054};{74,5382265};{75,5517476};{76,5652687};{77,5787898};{78,5923109};{79,6058320};{80,6193531};{81,6328742};{82,6463953};{83,6599164};{84,6734375};{85,6869586};{86,7004797};{87,7140008};{88,7275219};{89,7410430};{90,7545641};{91,7680852};{92,7816063};{93,7951274};{94,8086485};{95,8221696};{96,8356907};{97,8492118};{98,8627329};};
                                           {{1,10};{2,32};{3,76};{4,142};{5,241};{6,389};{7,611};{8,945};{9,1446};{10,2197};{11,3323};{12,4731};{13,6491};{14,8691};{15,11441};{16,14878};{17,19174};{18,24544};{19,31257};{20,38809};{21,47305};{22,56862};{23,67613};{24,79708};{25,93315};{26,108622};{27,125843};{28,145216};{29,167011};{30,191530};{31,219113};{32,250144};{33,285054};{34,324328};{35,368510};{36,418215};{37,474133};{38,537041};{39,607812};{40,687429};{41,776997};{42,877761};{43,991120};{44,1104479};{45,1217838};{46,1331197};{47,1444556};{48,1557915};{49,1671274};{50,1784633};{51,1897992};{52,2011351};{53,2124710};{54,2238069};{55,2351428};{56,2464787};{57,2578146};{58,2691505};{59,2804864};{60,2918223};{61,3031582};{62,3144941};{63,3258300};{64,3371659};{65,3485018};{66,3598377};{67,3711736};{68,3825095};{69,3938454};{70,4051813};{71,4165172};{72,4278531};{73,4391890};{74,4505249};{75,4618608};{76,4731967};{77,4845326};{78,4958685};{79,5072044};{80,5185403};{81,5298762};{82,5412121};{83,5525480};{84,5638839};{85,5752198};{86,5865557};{87,5978916};{88,6092275};{89,6205634};{90,6318993};{91,6432352};{92,6545711};{93,6659070};{94,6772429};{95,6885788};{96,6999147};{97,7112506};{98,7225865};};
                                   };
                        Profession =  {
                                           [0] = "Hero";
                                           [1] = "Soldier";
                                           [2] = "Pilgrim";
                                           [3] = "Sage";
                                           [4] = "Wizard";
                                           [5] = "Merchant";
                                           [6] = "Fighter";
                                           [7] = "Goof Off";
                                           [8] = "None";
                                      };
                     };--Data
            };--Trainer


Furhter down the code list
Code:

   self.characters_rg = createRadioGroup(self.form);
   self.characters_rg.height = 200;
   self.characters_rg.width = 87;
   self.characters_rg.top = 90;
   self.characters_rg.left = 3;
   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);        i = nil;
                                    i = self.Data.Stats[index]--i = self.Data.Characters[index] + 1;
                                    heroname = index;
                                    for k,v in pairs (self.Data.Characters) do
                                       if k==index then
                                          i = v+1
                                       end
                                    end
                                    if i then
                                       heroname = index;
                                       local al=getAddressList()
                                       prof = addresslist_getMemoryRecordByDescription(al, heroname .. " Profession/Sex").Value
                                       i= tonumber(prof);
                                       self.listview.clear();
                                       for _,__table in pairs(self.Data.Stats[i]) do
                                          local entry = self.listview.getItems().add();
                                          entry.Caption = __table[1];
                                          local subentry = entry.getSubItems().add(__table[2]);
                                       end
                                    end
                                    if expvalue and goldvalue and heroname then
                                       RecalculateAddresses()
                                    end
                                 end

The RadioGroup is used in another function besides displaying Level/Exp.
The problem is that the data loaded is for the position of the character, not the profession, which in this case is what I would like to load. You can see that I attempted to set i to the profession, but that didn't work as it still display the data for the position in the RaioGroup. Any suggestions on how to get the correct data to display?
Back to top
View user's profile Send private message Yahoo Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 35

Joined: 16 Feb 2017
Posts: 1478

PostPosted: Thu Sep 21, 2023 12:47 am    Post subject: Reply with quote

Code:
Profession =  {
                                           [0] = "Hero";
                                     


Lua tables index starts at 1.
The table above will probably not be saved. ([0] = nil (i.e. none))
Try starting from 1.

_________________
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: 582

PostPosted: Thu Sep 21, 2023 8:30 am    Post subject: Reply with quote

Changing just the code suggestion.
Code:

                        Profession =  {
                                           [1] = "Hero";
                                           [2] = "Soldier";
                                           [3] = "Pilgrim";
                                           [4] = "Sage";
                                           [5] = "Wizard";
                                           [6] = "Merchant";
                                           [7] = "Fighter";
                                           [8] = "Goof Off";
                                           [9] = "None";
                                      };


Yields an error when Hero 1 is selected.
The hero name is Hero 2

The hero name is Hero 1
Error:[string "trainer = {
..."]:564: bad argument #1 to 'pairs' (table expected, got nil)
Selecting others the listview is populated, but with incorrect tale values
Hero 2 has the fourth data.
Hero 3 has the first data.
Hero 4 has the second data.
I would have changed some of the other code, but I can't find a pattern.
Back to top
View user's profile Send private message Yahoo Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 35

Joined: 16 Feb 2017
Posts: 1478

PostPosted: Thu Sep 21, 2023 12:41 pm    Post subject: Reply with quote

Code:
trainer =    {
            Data =    {
                        Characters =    {
                                          "Hero 1", -- -- Index of radiogroup
                                          "Hero 2", --= 1;
                                          "Hero 3", --= 2;
                                          "Hero 4", --= 3;
                                          "No One" --= 4;
                                       };
                        Stats =   { -- Exp and level
                                           {{1,28};{2,86};{3,173};{4,303};{5,498};{6,791};{7,1231};{8,1890};{9,2879};{10,4363};{11,6217};{12,8533};{13,11427};{14,15044};{15,19113};{16,23689};{17,28836};{18,34626};{19,41140};{20,48467};{21,56710};{22,65982};{23,76412};{24,88146};{25,101346};{26,116195};{27,132900};{28,151693};{29,172835};{30,196620};{31,223377};{32,253479};{33,287343};{34,325439};{35,368297};{36,416511};{37,470751};{38,531770};{39,600416};{40,677643};{41,764523};{42,862262};{43,960001};{44,1057740};{45,1155479};{46,1253218};{47,1350957};{48,1448696};{49,1546435};{50,1644174};{51,1741913};{52,1839652};{53,1937391};{54,2035130};{55,2132869};{56,2230608};{57,2328347};{58,2426086};{59,2523825};{60,2621564};{61,2719303};{62,2817042};{63,2914781};{64,3012520};{65,3110259};{66,3207998};{67,3305737};{68,3403476};{69,3501215};{70,3598954};{71,3696693};{72,3794432};{73,3892171};{74,3989910};{75,4087649};{76,4185388};{77,4283127};{78,4380866};{79,4478605};{80,4576344};{81,4674083};{82,4771822};{83,4869561};{84,4967300};{85,5065039};{86,5162778};{87,5260517};{88,5358256};{89,5455995};{90,5553734};{91,5651473};{92,5749212};{93,5846951};{94,5944690};{95,6042429};{96,6140168};{97,6237907};{98,6335646};};
                                           {{1,11};{2,35};{3,83};{4,155};{5,263};{6,425};{7,668};{8,1032};{9,1578};{10,2397};{11,3626};{12,5162};{13,7082};{14,9482};{15,12482};{16,16232};{17,20919};{18,26778};{19,34101};{20,42339};{21,51607};{22,62033};{23,73762};{24,86956};{25,101800};{26,118499};{27,137285};{28,158420};{29,182196};{30,208944};{31,239035};{32,272887};{33,310971};{34,353815};{35,402014};{36,456238};{37,517240};{38,585867};{39,663072};{40,749927};{41,847638};{42,945349};{43,1043060};{44,1140771};{45,1238482};{46,1336193};{47,1433904};{48,1531615};{49,1629326};{50,1727037};{51,1824748};{52,1922459};{53,2020170};{54,2117881};{55,2215592};{56,2313303};{57,2411014};{58,2508725};{59,2606436};{60,2704147};{61,2801858};{62,2899569};{63,2997280};{64,3094991};{65,3192702};{66,3290413};{67,3388124};{68,3485835};{69,3583546};{70,3681257};{71,3778968};{72,3876679};{73,3974390};{74,4072101};{75,4169812};{76,4267523};{77,4365234};{78,4462945};{79,4560656};{80,4658367};{81,4756078};{82,4853789};{83,4951500};{84,5049211};{85,5146922};{86,5244633};{87,5342344};{88,5440055};{89,5537766};{90,5635477};{91,5733188};{92,5830899};{93,5928610};{94,6026321};{95,6124032};{96,6221743};{97,6319454};{98,6417165};};
                                           {{1,13};{2,41};{3,97};{4,181};{5,307};{6,496};{7,779};{8,1204};{9,1841};{10,2797};{11,4231};{12,6023};{13,8263};{14,11063};{15,14563};{16,18938};{17,24406};{18,30558};{19,37478};{20,45262};{21,54019};{22,63871};{23,74954};{24,87422};{25,101449};{26,117228};{27,134980};{28,154951};{29,177418};{30,202693};{31,231127};{32,263115};{33,299101};{34,339584};{35,385127};{36,436363};{37,494003};{38,558848};{39,631798};{40,713866};{41,806193};{42,910060};{43,1026911};{44,1143762};{45,1260613};{46,1377464};{47,1494315};{48,1611166};{49,1728017};{50,1844868};{51,1961719};{52,2078570};{53,2195421};{54,2312272};{55,2429123};{56,2545974};{57,2662825};{58,2779676};{59,2896527};{60,3013378};{61,3130229};{62,3247080};{63,3363931};{64,3480782};{65,3597633};{66,3714484};{67,3831335};{68,3948186};{69,4065037};{70,4181888};{71,4298739};{72,4415590};{73,4532441};{74,4649292};{75,4766143};{76,4882994};{77,4999845};{78,5116696};{79,5233547};{80,5350398};{81,5467249};{82,5584100};{83,5700951};{84,5817802};{85,5934653};{86,6051504};{87,6168355};{88,6285206};{89,6402057};{90,6518908};{91,6635759};{92,6752610};{93,6869461};{94,6986312};{95,7103163};{96,7220014};{97,7336865};{98,7453716};};
                                           {{1,19};{2,59};{3,139};{4,259};{5,439};{6,709};{7,1114};{8,1721};{9,2632};{10,3998};{11,6046};{12,8606};{13,11806};{14,15806};{15,20806};{16,27056};{17,34868};{18,43656};{19,53542};{20,64663};{21,77174};{22,91249};{23,107082};{24,124894};{25,144932};{26,167474};{27,192834};{28,221364};{29,253460};{30,289567};{31,330187};{32,375884};{33,427292};{34,485125};{35,550187};{36,623382};{37,705725};{38,798361};{39,902576};{40,1019817};{41,1151713};{42,1300095};{43,1448477};{44,1596859};{45,1745241};{46,1893623};{47,2042005};{48,2190387};{49,2338769};{50,2487151};{51,2635533};{52,2783915};{53,2932297};{54,3080679};{55,3229061};{56,3377443};{57,3525825};{58,3674207};{59,3822589};{60,3970971};{61,4119353};{62,4267735};{63,4416117};{64,4564499};{65,4712881};{66,4861263};{67,5009645};{68,5158027};{69,5306409};{70,5454791};{71,5603173};{72,5751555};{73,5899937};{74,6048319};{75,6196701};{76,6345083};{77,6493465};{78,6641847};{79,6790229};{80,6938611};{81,7086993};{82,7235375};{83,7383757};{84,7532139};{85,7680521};{86,7828903};{87,7977285};{88,8125667};{89,8274049};{90,8422431};{91,8570813};{92,8719195};{93,8867577};{94,9015959};{95,9164341};{96,9312723};{97,9461105};{98,9609487};};
                                           {{1,14};{2,44};{3,104};{4,194};{5,329};{6,531};{7,834};{8,1289};{9,1972};{10,2996};{11,4532};{12,6452};{13,8852};{14,11852};{15,15602};{16,20289};{17,25562};{18,31494};{19,38168};{20,45675};{21,54120};{22,63621};{23,74309};{24,86333};{25,99860};{26,115077};{27,132196};{28,151455};{29,173120};{30,197493};{31,224912};{32,255757};{33,290457};{34,329494};{35,373411};{36,422817};{37,478398};{38,540926};{39,611270};{40,690407};{41,779435};{42,879591};{43,992267};{44,1119027};{45,1245787};{46,1372547};{47,1499307};{48,1626067};{49,1752827};{50,1879587};{51,2006347};{52,2133107};{53,2259867};{54,2386627};{55,2513387};{56,2640147};{57,2766907};{58,2893667};{59,3020427};{60,3147187};{61,3273947};{62,3400707};{63,3527467};{64,3654227};{65,3780987};{66,3907747};{67,4034507};{68,4161267};{69,4288027};{70,4414787};{71,4541547};{72,4668307};{73,4795067};{74,4921827};{75,5048587};{76,5175347};{77,5302107};{78,5428867};{79,5555627};{80,5682387};{81,5809147};{82,5935907};{83,6062667};{84,6189427};{85,6316187};{86,6442947};{87,6569707};{88,6696467};{89,6823227};{90,6949987};{91,7076747};{92,7203507};{93,7330267};{94,7457027};{95,7583787};{96,7710547};{97,7837307};{98,7964067};};
                                           {{1,9};{2,29};{3,69};{4,129};{5,219};{6,354};{7,556};{8,859};{9,1314};{10,1997};{11,3021};{12,4301};{13,5901};{14,7901};{15,10401};{16,13526};{17,17432};{18,22314};{19,27806};{20,33984};{21,40934};{22,48753};{23,57549};{24,67444};{25,78576};{26,91099};{27,105187};{28,121036};{29,138866};{30,158924};{31,181489};{32,206875};{33,235434};{34,267562};{35,303706};{36,344367};{37,390111};{38,441572};{39,499466};{40,564596};{41,637867};{42,720297};{43,813031};{44,905765};{45,998499};{46,1091233};{47,1183967};{48,1276701};{49,1369435};{50,1462169};{51,1554903};{52,1647637};{53,1740371};{54,1833105};{55,1925839};{56,2018573};{57,2111307};{58,2204041};{59,2296775};{60,2389509};{61,2482243};{62,2574977};{63,2667711};{64,2760445};{65,2853179};{66,2945913};{67,3038647};{68,3131381};{69,3224115};{70,3316849};{71,3409583};{72,3502317};{73,3595051};{74,3687785};{75,3780519};{76,3873253};{77,3965987};{78,4058721};{79,4151455};{80,4244189};{81,4336923};{82,4429657};{83,4522391};{84,4615125};{85,4707859};{86,4800593};{87,4893327};{88,4986061};{89,5078795};{90,5171529};{91,5264263};{92,5356997};{93,5449731};{94,5542465};{95,5635199};{96,5727933};{97,5820667};{98,5913401};};
                                           {{1,17};{2,53};{3,125};{4,233};{5,395};{6,638};{7,1002};{8,1548};{9,2368};{10,3597};{11,5440};{12,7744};{13,10624};{14,14224};{15,18724};{16,24349};{17,30677};{18,37796};{19,45804};{20,54813};{21,64948};{22,76349};{23,89175};{24,103604};{25,119836};{26,138097};{27,158640};{28,181750};{29,207748};{30,236995};{31,269897};{32,306911};{33,348551};{34,395396};{35,448096};{36,507383};{37,574080};{38,649114};{39,733527};{40,828491};{41,935325};{42,1055513};{43,1190724};{44,1325935};{45,1461146};{46,1596357};{47,1731568};{48,1866779};{49,2001990};{50,2137201};{51,2272412};{52,2407623};{53,2542834};{54,2678045};{55,2813256};{56,2948467};{57,3083678};{58,3218889};{59,3354100};{60,3489311};{61,3624522};{62,3759733};{63,3894944};{64,4030155};{65,4165366};{66,4300577};{67,4435788};{68,4570999};{69,4706210};{70,4841421};{71,4976632};{72,5111843};{73,5247054};{74,5382265};{75,5517476};{76,5652687};{77,5787898};{78,5923109};{79,6058320};{80,6193531};{81,6328742};{82,6463953};{83,6599164};{84,6734375};{85,6869586};{86,7004797};{87,7140008};{88,7275219};{89,7410430};{90,7545641};{91,7680852};{92,7816063};{93,7951274};{94,8086485};{95,8221696};{96,8356907};{97,8492118};{98,8627329};};
                                           {{1,10};{2,32};{3,76};{4,142};{5,241};{6,389};{7,611};{8,945};{9,1446};{10,2197};{11,3323};{12,4731};{13,6491};{14,8691};{15,11441};{16,14878};{17,19174};{18,24544};{19,31257};{20,38809};{21,47305};{22,56862};{23,67613};{24,79708};{25,93315};{26,108622};{27,125843};{28,145216};{29,167011};{30,191530};{31,219113};{32,250144};{33,285054};{34,324328};{35,368510};{36,418215};{37,474133};{38,537041};{39,607812};{40,687429};{41,776997};{42,877761};{43,991120};{44,1104479};{45,1217838};{46,1331197};{47,1444556};{48,1557915};{49,1671274};{50,1784633};{51,1897992};{52,2011351};{53,2124710};{54,2238069};{55,2351428};{56,2464787};{57,2578146};{58,2691505};{59,2804864};{60,2918223};{61,3031582};{62,3144941};{63,3258300};{64,3371659};{65,3485018};{66,3598377};{67,3711736};{68,3825095};{69,3938454};{70,4051813};{71,4165172};{72,4278531};{73,4391890};{74,4505249};{75,4618608};{76,4731967};{77,4845326};{78,4958685};{79,5072044};{80,5185403};{81,5298762};{82,5412121};{83,5525480};{84,5638839};{85,5752198};{86,5865557};{87,5978916};{88,6092275};{89,6205634};{90,6318993};{91,6432352};{92,6545711};{93,6659070};{94,6772429};{95,6885788};{96,6999147};{97,7112506};{98,7225865};};
                                   };
                        Profession =  {
                                           [0] = "Hero";
                                           [1] = "Soldier";
                                           [2] = "Pilgrim";
                                           [3] = "Sage";
                                           [4] = "Wizard";
                                           [5] = "Merchant";
                                           [6] = "Fighter";
                                           [7] = "Goof Off";
                                           [8] = "None";
                                      };
                     };--Data
            };--Trainer

self = {}
self.form = createForm()
self.form.height = 300;
self.form.width = 260;
self.form.Position="poDesktopCenter"
self.listview = createListview(self.form)
self.listview.height = 200;
self.listview.width = 140;
self.listview.top = 90;
self.listview.left = 93;
self.listview.colum1 = self.listview.getColumns().add()
   self.listview.colum1.Width = 50;
   self.listview.colum1.Caption = 'Lvl';
   self.listview.colum2 = self.listview.getColumns().add()
   self.listview.colum2.Width = 90;
   self.listview.colum2.Caption = 'Exp';
self.label_1 = createLabel(self.form)
self.label_1.Top = 15
self.label_1.Left = 15
self.label_2 = createLabel(self.form)
self.label_2.Top = 30
self.label_2.Left = 15

   self.characters_rg = createRadioGroup(self.form);
   self.characters_rg.height = 200;
   self.characters_rg.width = 87;
   self.characters_rg.top = 90;
   self.characters_rg.left = 3;
   --for character,_ in ipairs(trainer.Data.Characters) do
   for i=1, #trainer.Data.Characters do
      --if character then
         self.characters_rg.getItems().add(trainer.Data.Characters[i]);
      --end
   end
   self.characters_rg.onClick =    function (sender)
                                    local index = strings_getString(sender.getItems(), sender.ItemIndex);
                                    i = nil;
                                    i = (sender.ItemIndex) + 1
                                    --i = self.Data.Characters[index] + 1;                                    --print(1,sender.ItemIndex)
                                    --print(2,index)
                                    heroname = index;
                                    --for k,v in pairs (trainer.Data.Characters) do
                                     --  if k==index then
                                      --    i = v+1
                                     --  end
                                    --end
                                    self.label_2.caption = heroname
                                    if i==5 then
                                       self.listview.clear();
                                    else
                                     if i then
                                      -- heroname = index;
                                       --local al=getAddressList()
                                       --prof = addresslist_getMemoryRecordByDescription(al, heroname .. " Profession/Sex").Value
                                       --i= tonumber(prof);

                                       self.listview.clear();
                                       for _,__table in pairs(trainer.Data.Stats[i]) do
                                          local entry = self.listview.getItems().add();
                                          entry.Caption = __table[1];
                                          local subentry = entry.getSubItems().add(__table[2]);
                                       end
                                     end
                                    end
                                    if expvalue and goldvalue and heroname then
                                       RecalculateAddresses()
                                    end
                                 end


I am only giving an example of table manipulations, not the general code.
What value does the "prof" you read from the address list normally give? (Level or xp?)

_________________
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: 582

PostPosted: Thu Sep 21, 2023 2:47 pm    Post subject: Reply with quote

Neither, it is a byte referring to profession and professions have different lvl/exp as the table of values.
I borrowed this table not the code from here I think. The author did a good job in finding/labelling the record. I assumed through searches the professions, exp levels that the professions had the characteristics shown in my code, however, that was/is totally wrong. There are 16 professions, 8 male 8 female, that have different lvl/exp. My table was correct values in the wrong lines.
The professions go like this:
Hero(0)
Wizard(1)
Pilgrim(2)
Sage(3)
Soldier(4)
Merchant(5)
Fighter(6)
Goof Off(7)
These are males, add 8 to get females. So I rebuilt the code with that in mind and ran into a hornets nest.
The first error was the characters gave me errors closing the "{" after the first 8. Cutting the professions to eight allowed the code to be complied.
I'll post the new data section and old, not working now radio graph. I sill have the same error,
the prof is 0
The hero name is Hero 1
Error:[string "trainer = {
..."]:581: bad argument #1 to 'pairs' (table expected, got nil)
When selecting the other 3 characters the listview is populated with still the wrong data, but I stopped working on that sometime ago. I believe I'll be able to display the correct values, but the error on Hero1 has me puzzle.
Code:

trainer =    {
            Data =    {
                        Characters =    {
                                          [1] = "Hero 1";
                                          [2] = "Hero 2";
                                          [3] = "Hero 3";
                                          [4] = "Hero 4";
                                          [5] = "No One";
                                       };--Characters
                        Stats =   { -- Exp and level
                                           {{1,28};{2,86};{3,173};{4,303};{5,498};{6,791};{7,1231};{8,1890};{9,2879};{10,4363};{11,6217};{12,8533};{13,11427};{14,15044};{15,19113};{16,23689};{17,28836};{18,34626};{19,41140};{20,48467};{21,56710};{22,65982};{23,76412};{24,88146};{25,101346};{26,116195};{27,132900};{28,151693};{29,172835};{30,196620};{31,223377};{32,253479};{33,287343};{34,325439};{35,368297};{36,416511};{37,470751};{38,531770};{39,600416};{40,677643};{41,764523};{42,862262};{43,960001};{44,1057740};{45,1155479};{46,1253218};{47,1350957};{48,1448696};{49,1546435};{50,1644174};{51,1741913};{52,1839652};{53,1937391};{54,2035130};{55,2132869};{56,2230608};{57,2328347};{58,2426086};{59,2523825};{60,2621564};{61,2719303};{62,2817042};{63,2914781};{64,3012520};{65,3110259};{66,3207998};{67,3305737};{68,3403476};{69,3501215};{70,3598954};{71,3696693};{72,3794432};{73,3892171};{74,3989910};{75,4087649};{76,4185388};{77,4283127};{78,4380866};{79,4478605};{80,4576344};{81,4674083};{82,4771822};{83,4869561};{84,4967300};{85,5065039};{86,5162778};{87,5260517};{88,5358256};{89,5455995};{90,5553734};{91,5651473};{92,5749212};{93,5846951};{94,5944690};{95,6042429};{96,6140168};{97,6237907};{98,6335646};};
                                           {{1,14};{2,44};{3,104};{4,194};{5,329};{6,531};{7,834};{8,1289};{9,1972};{10,2996};{11,4532};{12,6452};{13,8852};{14,11852};{15,15602};{16,20289};{17,25562};{18,31494};{19,38168};{20,45675};{21,54120};{22,63621};{23,74309};{24,86333};{25,99860};{26,115077};{27,132196};{28,151455};{29,173120};{30,197493};{31,224912};{32,255757};{33,290457};{34,329494};{35,373411};{36,422817};{37,478398};{38,540926};{39,611270};{40,690407};{41,779435};{42,879591};{43,992267};{44,1119027};{45,1245787};{46,1372547};{47,1499307};{48,1626067};{49,1752827};{50,1879587};{51,2006347};{52,2133107};{53,2259867};{54,2386627};{55,2513387};{56,2640147};{57,2766907};{58,2893667};{59,3020427};{60,3147187};{61,3273947};{62,3400707};{63,3527467};{64,3654227};{65,3780987};{66,3907747};{67,4034507};{68,4161267};{69,4288027};{70,4414787};{71,4541547};{72,4668307};{73,4795067};{74,4921827};{75,5048587};{76,5175347};{77,5302107};{78,5428867};{79,5555627};{80,5682387};{81,5809147};{82,5935907};{83,6062667};{84,6189427};{85,6316187};{86,6442947};{87,6569707};{88,6696467};{89,6823227};{90,6949987};{91,7076747};{92,7203507};{93,7330267};{94,7457027};{95,7583787};{96,7710547};{97,7837307};{98,7964067};};
                                           {{1,13};{2,41};{3,97};{4,181};{5,307};{6,496};{7,779};{8,1204};{9,1841};{10,2797};{11,4231};{12,6023};{13,8263};{14,11063};{15,14563};{16,18938};{17,24406};{18,30558};{19,37478};{20,45262};{21,54019};{22,63871};{23,74954};{24,87422};{25,101449};{26,117228};{27,134980};{28,154951};{29,177418};{30,202693};{31,231127};{32,263115};{33,299101};{34,339584};{35,385127};{36,436363};{37,494003};{38,558848};{39,631798};{40,713866};{41,806193};{42,910060};{43,1026911};{44,1143762};{45,1260613};{46,1377464};{47,1494315};{48,1611166};{49,1728017};{50,1844868};{51,1961719};{52,2078570};{53,2195421};{54,2312272};{55,2429123};{56,2545974};{57,2662825};{58,2779676};{59,2896527};{60,3013378};{61,3130229};{62,3247080};{63,3363931};{64,3480782};{65,3597633};{66,3714484};{67,3831335};{68,3948186};{69,4065037};{70,4181888};{71,4298739};{72,4415590};{73,4532441};{74,4649292};{75,4766143};{76,4882994};{77,4999845};{78,5116696};{79,5233547};{80,5350398};{81,5467249};{82,5584100};{83,5700951};{84,5817802};{85,5934653};{86,6051504};{87,6168355};{88,6285206};{89,6402057};{90,6518908};{91,6635759};{92,6752610};{93,6869461};{94,6986312};{95,7103163};{96,7220014};{97,7336865};{98,7453716};};
                                           {{1,19};{2,59};{3,139};{4,259};{5,439};{6,709};{7,1114};{8,1721};{9,2632};{10,3998};{11,6046};{12,8606};{13,11806};{14,15806};{15,20806};{16,27056};{17,34868};{18,43656};{19,53542};{20,64663};{21,77174};{22,91249};{23,107082};{24,124894};{25,144932};{26,167474};{27,192834};{28,221364};{29,253460};{30,289567};{31,330187};{32,375884};{33,427292};{34,485125};{35,550187};{36,623382};{37,705725};{38,798361};{39,902576};{40,1019817};{41,1151713};{42,1300095};{43,1448477};{44,1596859};{45,1745241};{46,1893623};{47,2042005};{48,2190387};{49,2338769};{50,2487151};{51,2635533};{52,2783915};{53,2932297};{54,3080679};{55,3229061};{56,3377443};{57,3525825};{58,3674207};{59,3822589};{60,3970971};{61,4119353};{62,4267735};{63,4416117};{64,4564499};{65,4712881};{66,4861263};{67,5009645};{68,5158027};{69,5306409};{70,5454791};{71,5603173};{72,5751555};{73,5899937};{74,6048319};{75,6196701};{76,6345083};{77,6493465};{78,6641847};{79,6790229};{80,6938611};{81,7086993};{82,7235375};{83,7383757};{84,7532139};{85,7680521};{86,7828903};{87,7977285};{88,8125667};{89,8274049};{90,8422431};{91,8570813};{92,8719195};{93,8867577};{94,9015959};{95,9164341};{96,9312723};{97,9461105};{98,9609487};};
                                           {{1,11};{2,35};{3,83};{4,155};{5,263};{6,425};{7,668};{8,1032};{9,1578};{10,2397};{11,3626};{12,5162};{13,7082};{14,9482};{15,12482};{16,16232};{17,20919};{18,26778};{19,34101};{20,42339};{21,51607};{22,62033};{23,73762};{24,86956};{25,101800};{26,118499};{27,137285};{28,158420};{29,182196};{30,208944};{31,239035};{32,272887};{33,310971};{34,353815};{35,402014};{36,456238};{37,517240};{38,585867};{39,663072};{40,749927};{41,847638};{42,945349};{43,1043060};{44,1140771};{45,1238482};{46,1336193};{47,1433904};{48,1531615};{49,1629326};{50,1727037};{51,1824748};{52,1922459};{53,2020170};{54,2117881};{55,2215592};{56,2313303};{57,2411014};{58,2508725};{59,2606436};{60,2704147};{61,2801858};{62,2899569};{63,2997280};{64,3094991};{65,3192702};{66,3290413};{67,3388124};{68,3485835};{69,3583546};{70,3681257};{71,3778968};{72,3876679};{73,3974390};{74,4072101};{75,4169812};{76,4267523};{77,4365234};{78,4462945};{79,4560656};{80,4658367};{81,4756078};{82,4853789};{83,4951500};{84,5049211};{85,5146922};{86,5244633};{87,5342344};{88,5440055};{89,5537766};{90,5635477};{91,5733188};{92,5830899};{93,5928610};{94,6026321};{95,6124032};{96,6221743};{97,6319454};{98,6417165};};
                                           {{1,9};{2,29};{3,69};{4,129};{5,219};{6,354};{7,556};{8,859};{9,1314};{10,1997};{11,3021};{12,4301};{13,5901};{14,7901};{15,10401};{16,13526};{17,17432};{18,22314};{19,27806};{20,33984};{21,40934};{22,48753};{23,57549};{24,67444};{25,78576};{26,91099};{27,105187};{28,121036};{29,138866};{30,158924};{31,181489};{32,206875};{33,235434};{34,267562};{35,303706};{36,344367};{37,390111};{38,441572};{39,499466};{40,564596};{41,637867};{42,720297};{43,813031};{44,905765};{45,998499};{46,1091233};{47,1183967};{48,1276701};{49,1369435};{50,1462169};{51,1554903};{52,1647637};{53,1740371};{54,1833105};{55,1925839};{56,2018573};{57,2111307};{58,2204041};{59,2296775};{60,2389509};{61,2482243};{62,2574977};{63,2667711};{64,2760445};{65,2853179};{66,2945913};{67,3038647};{68,3131381};{69,3224115};{70,3316849};{71,3409583};{72,3502317};{73,3595051};{74,3687785};{75,3780519};{76,3873253};{77,3965987};{78,4058721};{79,4151455};{80,4244189};{81,4336923};{82,4429657};{83,4522391};{84,4615125};{85,4707859};{86,4800593};{87,4893327};{88,4986061};{89,5078795};{90,5171529};{91,5264263};{92,5356997};{93,5449731};{94,5542465};{95,5635199};{96,5727933};{97,5820667};{98,5913401};};
                                           {{1,17};{2,53};{3,125};{4,233};{5,395};{6,638};{7,1002};{8,1548};{9,2368};{10,3597};{11,5440};{12,7744};{13,10624};{14,14224};{15,18724};{16,24349};{17,30677};{18,37796};{19,45804};{20,54813};{21,64948};{22,76349};{23,89175};{24,103604};{25,119836};{26,138097};{27,158640};{28,181750};{29,207748};{30,236995};{31,269897};{32,306911};{33,348551};{34,395396};{35,448096};{36,507383};{37,574080};{38,649114};{39,733527};{40,828491};{41,935325};{42,1055513};{43,1190724};{44,1325935};{45,1461146};{46,1596357};{47,1731568};{48,1866779};{49,2001990};{50,2137201};{51,2272412};{52,2407623};{53,2542834};{54,2678045};{55,2813256};{56,2948467};{57,3083678};{58,3218889};{59,3354100};{60,3489311};{61,3624522};{62,3759733};{63,3894944};{64,4030155};{65,4165366};{66,4300577};{67,4435788};{68,4570999};{69,4706210};{70,4841421};{71,4976632};{72,5111843};{73,5247054};{74,5382265};{75,5517476};{76,5652687};{77,5787898};{78,5923109};{79,6058320};{80,6193531};{81,6328742};{82,6463953};{83,6599164};{84,6734375};{85,6869586};{86,7004797};{87,7140008};{88,7275219};{89,7410430};{90,7545641};{91,7680852};{92,7816063};{93,7951274};{94,8086485};{95,8221696};{96,8356907};{97,8492118};{98,8627329};};
                                           {{1,10};{2,32};{3,76};{4,142};{5,241};{6,389};{7,611};{8,945};{9,1446};{10,2197};{11,3323};{12,4731};{13,6491};{14,8691};{15,11441};{16,14878};{17,19174};{18,24544};{19,31257};{20,38809};{21,47305};{22,56862};{23,67613};{24,79708};{25,93315};{26,108622};{27,125843};{28,145216};{29,167011};{30,191530};{31,219113};{32,250144};{33,285054};{34,324328};{35,368510};{36,418215};{37,474133};{38,537041};{39,607812};{40,687429};{41,776997};{42,877761};{43,991120};{44,1104479};{45,1217838};{46,1331197};{47,1444556};{48,1557915};{49,1671274};{50,1784633};{51,1897992};{52,2011351};{53,2124710};{54,2238069};{55,2351428};{56,2464787};{57,2578146};{58,2691505};{59,2804864};{60,2918223};{61,3031582};{62,3144941};{63,3258300};{64,3371659};{65,3485018};{66,3598377};{67,3711736};{68,3825095};{69,3938454};{70,4051813};{71,4165172};{72,4278531};{73,4391890};{74,4505249};{75,4618608};{76,4731967};{77,4845326};{78,4958685};{79,5072044};{80,5185403};{81,5298762};{82,5412121};{83,5525480};{84,5638839};{85,5752198};{86,5865557};{87,5978916};{88,6092275};{89,6205634};{90,6318993};{91,6432352};{92,6545711};{93,6659070};{94,6772429};{95,6885788};{96,6999147};{97,7112506};{98,7225865};};
                                           {{1,28};{2,86};{3,173};{4,303};{5,498};{6,791};{7,1231};{8,1890};{9,2879};{10,4363};{11,6217};{12,8533};{13,11427};{14,15044};{15,19113};{16,23689};{17,28836};{18,34626};{19,41140};{20,48467};{21,56710};{22,65982};{23,76412};{24,88146};{25,101346};{26,116195};{27,132900};{28,151693};{29,172835};{30,196620};{31,223377};{32,253479};{33,287343};{34,325439};{35,368297};{36,416511};{37,470751};{38,531770};{39,600416};{40,677643};{41,764523};{42,862262};{43,960001};{44,1057740};{45,1155479};{46,1253218};{47,1350957};{48,1448696};{49,1546435};{50,1644174};{51,1741913};{52,1839652};{53,1937391};{54,2035130};{55,2132869};{56,2230608};{57,2328347};{58,2426086};{59,2523825};{60,2621564};{61,2719303};{62,2817042};{63,2914781};{64,3012520};{65,3110259};{66,3207998};{67,3305737};{68,3403476};{69,3501215};{70,3598954};{71,3696693};{72,3794432};{73,3892171};{74,3989910};{75,4087649};{76,4185388};{77,4283127};{78,4380866};{79,4478605};{80,4576344};{81,4674083};{82,4771822};{83,4869561};{84,4967300};{85,5065039};{86,5162778};{87,5260517};{88,5358256};{89,5455995};{90,5553734};{91,5651473};{92,5749212};{93,5846951};{94,5944690};{95,6042429};{96,6140168};{97,6237907};{98,6335646};};
                                           {{1,14};{2,44};{3,104};{4,194};{5,329};{6,531};{7,834};{8,1289};{9,1972};{10,2996};{11,4532};{12,6452};{13,8852};{14,11852};{15,15602};{16,20289};{17,25562};{18,31494};{19,38168};{20,45675};{21,54120};{22,63621};{23,74309};{24,86333};{25,99860};{26,115077};{27,132196};{28,151455};{29,173120};{30,197493};{31,224912};{32,255757};{33,290457};{34,329494};{35,373411};{36,422817};{37,478398};{38,540926};{39,611270};{40,690407};{41,779435};{42,879591};{43,992267};{44,1119027};{45,1245787};{46,1372547};{47,1499307};{48,1626067};{49,1752827};{50,1879587};{51,2006347};{52,2133107};{53,2259867};{54,2386627};{55,2513387};{56,2640147};{57,2766907};{58,2893667};{59,3020427};{60,3147187};{61,3273947};{62,3400707};{63,3527467};{64,3654227};{65,3780987};{66,3907747};{67,4034507};{68,4161267};{69,4288027};{70,4414787};{71,4541547};{72,4668307};{73,4795067};{74,4921827};{75,5048587};{76,5175347};{77,5302107};{78,5428867};{79,5555627};{80,5682387};{81,5809147};{82,5935907};{83,6062667};{84,6189427};{85,6316187};{86,6442947};{87,6569707};{88,6696467};{89,6823227};{90,6949987};{91,7076747};{92,7203507};{93,7330267};{94,7457027};{95,7583787};{96,7710547};{97,7837307};{98,7964067};};
                                           {{1,13};{2,41};{3,97};{4,181};{5,307};{6,496};{7,779};{8,1204};{9,1841};{10,2797};{11,4231};{12,6023};{13,8263};{14,11063};{15,14563};{16,18938};{17,24406};{18,30558};{19,37478};{20,45262};{21,54019};{22,63871};{23,74954};{24,87422};{25,101449};{26,117228};{27,134980};{28,154951};{29,177418};{30,202693};{31,231127};{32,263115};{33,299101};{34,339584};{35,385127};{36,436363};{37,494003};{38,558848};{39,631798};{40,713866};{41,806193};{42,910060};{43,1026911};{44,1143762};{45,1260613};{46,1377464};{47,1494315};{48,1611166};{49,1728017};{50,1844868};{51,1961719};{52,2078570};{53,2195421};{54,2312272};{55,2429123};{56,2545974};{57,2662825};{58,2779676};{59,2896527};{60,3013378};{61,3130229};{62,3247080};{63,3363931};{64,3480782};{65,3597633};{66,3714484};{67,3831335};{68,3948186};{69,4065037};{70,4181888};{71,4298739};{72,4415590};{73,4532441};{74,4649292};{75,4766143};{76,4882994};{77,4999845};{78,5116696};{79,5233547};{80,5350398};{81,5467249};{82,5584100};{83,5700951};{84,5817802};{85,5934653};{86,6051504};{87,6168355};{88,6285206};{89,6402057};{90,6518908};{91,6635759};{92,6752610};{93,6869461};{94,6986312};{95,7103163};{96,7220014};{97,7336865};{98,7453716};};
                                           {{1,19};{2,59};{3,139};{4,259};{5,439};{6,709};{7,1114};{8,1721};{9,2632};{10,3998};{11,6046};{12,8606};{13,11806};{14,15806};{15,20806};{16,27056};{17,34868};{18,43656};{19,53542};{20,64663};{21,77174};{22,91249};{23,107082};{24,124894};{25,144932};{26,167474};{27,192834};{28,221364};{29,253460};{30,289567};{31,330187};{32,375884};{33,427292};{34,485125};{35,550187};{36,623382};{37,705725};{38,798361};{39,902576};{40,1019817};{41,1151713};{42,1300095};{43,1448477};{44,1596859};{45,1745241};{46,1893623};{47,2042005};{48,2190387};{49,2338769};{50,2487151};{51,2635533};{52,2783915};{53,2932297};{54,3080679};{55,3229061};{56,3377443};{57,3525825};{58,3674207};{59,3822589};{60,3970971};{61,4119353};{62,4267735};{63,4416117};{64,4564499};{65,4712881};{66,4861263};{67,5009645};{68,5158027};{69,5306409};{70,5454791};{71,5603173};{72,5751555};{73,5899937};{74,6048319};{75,6196701};{76,6345083};{77,6493465};{78,6641847};{79,6790229};{80,6938611};{81,7086993};{82,7235375};{83,7383757};{84,7532139};{85,7680521};{86,7828903};{87,7977285};{88,8125667};{89,8274049};{90,8422431};{91,8570813};{92,8719195};{93,8867577};{94,9015959};{95,9164341};{96,9312723};{97,9461105};{98,9609487};};
                                           {{1,11};{2,35};{3,83};{4,155};{5,263};{6,425};{7,668};{8,1032};{9,1578};{10,2397};{11,3626};{12,5162};{13,7082};{14,9482};{15,12482};{16,16232};{17,20919};{18,26778};{19,34101};{20,42339};{21,51607};{22,62033};{23,73762};{24,86956};{25,101800};{26,118499};{27,137285};{28,158420};{29,182196};{30,208944};{31,239035};{32,272887};{33,310971};{34,353815};{35,402014};{36,456238};{37,517240};{38,585867};{39,663072};{40,749927};{41,847638};{42,945349};{43,1043060};{44,1140771};{45,1238482};{46,1336193};{47,1433904};{48,1531615};{49,1629326};{50,1727037};{51,1824748};{52,1922459};{53,2020170};{54,2117881};{55,2215592};{56,2313303};{57,2411014};{58,2508725};{59,2606436};{60,2704147};{61,2801858};{62,2899569};{63,2997280};{64,3094991};{65,3192702};{66,3290413};{67,3388124};{68,3485835};{69,3583546};{70,3681257};{71,3778968};{72,3876679};{73,3974390};{74,4072101};{75,4169812};{76,4267523};{77,4365234};{78,4462945};{79,4560656};{80,4658367};{81,4756078};{82,4853789};{83,4951500};{84,5049211};{85,5146922};{86,5244633};{87,5342344};{88,5440055};{89,5537766};{90,5635477};{91,5733188};{92,5830899};{93,5928610};{94,6026321};{95,6124032};{96,6221743};{97,6319454};{98,6417165};};
                                           {{1,9};{2,29};{3,69};{4,129};{5,219};{6,354};{7,556};{8,859};{9,1314};{10,1997};{11,3021};{12,4301};{13,5901};{14,7901};{15,10401};{16,13526};{17,17432};{18,22314};{19,27806};{20,33984};{21,40934};{22,48753};{23,57549};{24,67444};{25,78576};{26,91099};{27,105187};{28,121036};{29,138866};{30,158924};{31,181489};{32,206875};{33,235434};{34,267562};{35,303706};{36,344367};{37,390111};{38,441572};{39,499466};{40,564596};{41,637867};{42,720297};{43,813031};{44,905765};{45,998499};{46,1091233};{47,1183967};{48,1276701};{49,1369435};{50,1462169};{51,1554903};{52,1647637};{53,1740371};{54,1833105};{55,1925839};{56,2018573};{57,2111307};{58,2204041};{59,2296775};{60,2389509};{61,2482243};{62,2574977};{63,2667711};{64,2760445};{65,2853179};{66,2945913};{67,3038647};{68,3131381};{69,3224115};{70,3316849};{71,3409583};{72,3502317};{73,3595051};{74,3687785};{75,3780519};{76,3873253};{77,3965987};{78,4058721};{79,4151455};{80,4244189};{81,4336923};{82,4429657};{83,4522391};{84,4615125};{85,4707859};{86,4800593};{87,4893327};{88,4986061};{89,5078795};{90,5171529};{91,5264263};{92,5356997};{93,5449731};{94,5542465};{95,5635199};{96,5727933};{97,5820667};{98,5913401};};
                                           {{1,17};{2,53};{3,125};{4,233};{5,395};{6,638};{7,1002};{8,1548};{9,2368};{10,3597};{11,5440};{12,7744};{13,10624};{14,14224};{15,18724};{16,24349};{17,30677};{18,37796};{19,45804};{20,54813};{21,64948};{22,76349};{23,89175};{24,103604};{25,119836};{26,138097};{27,158640};{28,181750};{29,207748};{30,236995};{31,269897};{32,306911};{33,348551};{34,395396};{35,448096};{36,507383};{37,574080};{38,649114};{39,733527};{40,828491};{41,935325};{42,1055513};{43,1190724};{44,1325935};{45,1461146};{46,1596357};{47,1731568};{48,1866779};{49,2001990};{50,2137201};{51,2272412};{52,2407623};{53,2542834};{54,2678045};{55,2813256};{56,2948467};{57,3083678};{58,3218889};{59,3354100};{60,3489311};{61,3624522};{62,3759733};{63,3894944};{64,4030155};{65,4165366};{66,4300577};{67,4435788};{68,4570999};{69,4706210};{70,4841421};{71,4976632};{72,5111843};{73,5247054};{74,5382265};{75,5517476};{76,5652687};{77,5787898};{78,5923109};{79,6058320};{80,6193531};{81,6328742};{82,6463953};{83,6599164};{84,6734375};{85,6869586};{86,7004797};{87,7140008};{88,7275219};{89,7410430};{90,7545641};{91,7680852};{92,7816063};{93,7951274};{94,8086485};{95,8221696};{96,8356907};{97,8492118};{98,8627329};};
                                           {{1,10};{2,32};{3,76};{4,142};{5,241};{6,389};{7,611};{8,945};{9,1446};{10,2197};{11,3323};{12,4731};{13,6491};{14,8691};{15,11441};{16,14878};{17,19174};{18,24544};{19,31257};{20,38809};{21,47305};{22,56862};{23,67613};{24,79708};{25,93315};{26,108622};{27,125843};{28,145216};{29,167011};{30,191530};{31,219113};{32,250144};{33,285054};{34,324328};{35,368510};{36,418215};{37,474133};{38,537041};{39,607812};{40,687429};{41,776997};{42,877761};{43,991120};{44,1104479};{45,1217838};{46,1331197};{47,1444556};{48,1557915};{49,1671274};{50,1784633};{51,1897992};{52,2011351};{53,2124710};{54,2238069};{55,2351428};{56,2464787};{57,2578146};{58,2691505};{59,2804864};{60,2918223};{61,3031582};{62,3144941};{63,3258300};{64,3371659};{65,3485018};{66,3598377};{67,3711736};{68,3825095};{69,3938454};{70,4051813};{71,4165172};{72,4278531};{73,4391890};{74,4505249};{75,4618608};{76,4731967};{77,4845326};{78,4958685};{79,5072044};{80,5185403};{81,5298762};{82,5412121};{83,5525480};{84,5638839};{85,5752198};{86,5865557};{87,5978916};{88,6092275};{89,6205634};{90,6318993};{91,6432352};{92,6545711};{93,6659070};{94,6772429};{95,6885788};{96,6999147};{97,7112506};{98,7225865};};
                                  };--Stats
                        Profession = {
                                           [1] = "Hero";--Male
                                           [2] = "Wizard";--Male
                                           [3] = "Pilgrim";--Male
                                           [4] = "Sage";--Male
                                           [5] = "Soldier";--Male
                                           [6] = "Merchant";--Male
                                           [7] = "Fighter";--Male
                                           [8] = "Goof Off";--Male
                                           --[9] = "Hero"--Female
                                           --[10]= "Wizard"--Female
                                           --[11]= "Pilgrim"--Female
                                           --[12]= "Sage"--Female
                                           --[13]= "Soldier"--Female
                                           --[14]= "Merchant"--Female
                                           --[15]= "Fighter"--Female
                                           --[16]= "Goof Off"--Female
                                           [9]="None"--[17]= "None";
                                      };--Profession
                     };--Data
            };--Trainer

   self.characters_rg = createRadioGroup(self.form);
   self.characters_rg.height = 200;
   self.characters_rg.width = 87;
   self.characters_rg.top = 90;
   self.characters_rg.left = 3;
   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); -- I'm bit lazy, so sender == trainer.characters_rg
                                    local i = nil;
                                    i = self.Data.Stats[index]--i = self.Data.Characters[index] + 1;
                                    heroname = index;
                                    print(i); -- If the character does not hold the value,, i remains nil.
                                    for k,v in pairs (self.Data.Characters) do
                                       if k==index then
                                          i = v+1
                                       end
                                    end
                                    if i then
                                    --print (i);
                                       heroname = index;
                                       local al=getAddressList()
                                       prof = addresslist_getMemoryRecordByDescription(al, heroname .. " Profession/Sex").Value
                                       i= tonumber(prof);
                                       print("the prof is "..prof)
                                       --print("The index selected is", self.Data.Characters[index]);
                                       --print("The hero selected from index is ", index);
                                       print("The hero name is ", heroname);
                                       self.listview.clear();
                                       self.Data.Stats[index] = prof+1;
                                       for _,__table in pairs(self.Data.Stats[i]) do
                                          local entry = self.listview.getItems().add();
                                          entry.Caption = __table[1];
                                          local subentry = entry.getSubItems().add(__table[2]);
                                       end
                                    end
                                    if expvalue and goldvalue and heroname then
                                       RecalculateAddresses()
                                    end
                                 end
Back to top
View user's profile Send private message Yahoo Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 35

Joined: 16 Feb 2017
Posts: 1478

PostPosted: Thu Sep 21, 2023 3:58 pm    Post subject: Reply with quote

Warning;
You don't have a main table called "self"!
The main table name of the lists you use is "trainer".
I corrected the following sections in your code:

Code:
for k,v in pairs (self.Data.Characters) do
<<
for k,v in pairs (trainer.Data.Characters) do

for _,__table in pairs(self.Data.Stats[i]) do
<<
for _,__table in pairs(trainer.Data.Stats[i]) do


Here is another simulation scenario;

Example: Type a number in the "prof" box and select "hero".

Code:
trainer =    {
            Data =    {
                        Characters =    {
                                          [1] = "Hero 1";
                                          [2] = "Hero 2";
                                          [3] = "Hero 3";
                                          [4] = "Hero 4";
                                          [5] = "No One";
                                       };--Characters
                        Stats =   { -- Exp and level
                                           {{1,28};{2,86};{3,173};{4,303};{5,498};{6,791};{7,1231};{8,1890};{9,2879};{10,4363};{11,6217};{12,8533};{13,11427};{14,15044};{15,19113};{16,23689};{17,28836};{18,34626};{19,41140};{20,48467};{21,56710};{22,65982};{23,76412};{24,88146};{25,101346};{26,116195};{27,132900};{28,151693};{29,172835};{30,196620};{31,223377};{32,253479};{33,287343};{34,325439};{35,368297};{36,416511};{37,470751};{38,531770};{39,600416};{40,677643};{41,764523};{42,862262};{43,960001};{44,1057740};{45,1155479};{46,1253218};{47,1350957};{48,1448696};{49,1546435};{50,1644174};{51,1741913};{52,1839652};{53,1937391};{54,2035130};{55,2132869};{56,2230608};{57,2328347};{58,2426086};{59,2523825};{60,2621564};{61,2719303};{62,2817042};{63,2914781};{64,3012520};{65,3110259};{66,3207998};{67,3305737};{68,3403476};{69,3501215};{70,3598954};{71,3696693};{72,3794432};{73,3892171};{74,3989910};{75,4087649};{76,4185388};{77,4283127};{78,4380866};{79,4478605};{80,4576344};{81,4674083};{82,4771822};{83,4869561};{84,4967300};{85,5065039};{86,5162778};{87,5260517};{88,5358256};{89,5455995};{90,5553734};{91,5651473};{92,5749212};{93,5846951};{94,5944690};{95,6042429};{96,6140168};{97,6237907};{98,6335646};};
                                           {{1,14};{2,44};{3,104};{4,194};{5,329};{6,531};{7,834};{8,1289};{9,1972};{10,2996};{11,4532};{12,6452};{13,8852};{14,11852};{15,15602};{16,20289};{17,25562};{18,31494};{19,38168};{20,45675};{21,54120};{22,63621};{23,74309};{24,86333};{25,99860};{26,115077};{27,132196};{28,151455};{29,173120};{30,197493};{31,224912};{32,255757};{33,290457};{34,329494};{35,373411};{36,422817};{37,478398};{38,540926};{39,611270};{40,690407};{41,779435};{42,879591};{43,992267};{44,1119027};{45,1245787};{46,1372547};{47,1499307};{48,1626067};{49,1752827};{50,1879587};{51,2006347};{52,2133107};{53,2259867};{54,2386627};{55,2513387};{56,2640147};{57,2766907};{58,2893667};{59,3020427};{60,3147187};{61,3273947};{62,3400707};{63,3527467};{64,3654227};{65,3780987};{66,3907747};{67,4034507};{68,4161267};{69,4288027};{70,4414787};{71,4541547};{72,4668307};{73,4795067};{74,4921827};{75,5048587};{76,5175347};{77,5302107};{78,5428867};{79,5555627};{80,5682387};{81,5809147};{82,5935907};{83,6062667};{84,6189427};{85,6316187};{86,6442947};{87,6569707};{88,6696467};{89,6823227};{90,6949987};{91,7076747};{92,7203507};{93,7330267};{94,7457027};{95,7583787};{96,7710547};{97,7837307};{98,7964067};};
                                           {{1,13};{2,41};{3,97};{4,181};{5,307};{6,496};{7,779};{8,1204};{9,1841};{10,2797};{11,4231};{12,6023};{13,8263};{14,11063};{15,14563};{16,18938};{17,24406};{18,30558};{19,37478};{20,45262};{21,54019};{22,63871};{23,74954};{24,87422};{25,101449};{26,117228};{27,134980};{28,154951};{29,177418};{30,202693};{31,231127};{32,263115};{33,299101};{34,339584};{35,385127};{36,436363};{37,494003};{38,558848};{39,631798};{40,713866};{41,806193};{42,910060};{43,1026911};{44,1143762};{45,1260613};{46,1377464};{47,1494315};{48,1611166};{49,1728017};{50,1844868};{51,1961719};{52,2078570};{53,2195421};{54,2312272};{55,2429123};{56,2545974};{57,2662825};{58,2779676};{59,2896527};{60,3013378};{61,3130229};{62,3247080};{63,3363931};{64,3480782};{65,3597633};{66,3714484};{67,3831335};{68,3948186};{69,4065037};{70,4181888};{71,4298739};{72,4415590};{73,4532441};{74,4649292};{75,4766143};{76,4882994};{77,4999845};{78,5116696};{79,5233547};{80,5350398};{81,5467249};{82,5584100};{83,5700951};{84,5817802};{85,5934653};{86,6051504};{87,6168355};{88,6285206};{89,6402057};{90,6518908};{91,6635759};{92,6752610};{93,6869461};{94,6986312};{95,7103163};{96,7220014};{97,7336865};{98,7453716};};
                                           {{1,19};{2,59};{3,139};{4,259};{5,439};{6,709};{7,1114};{8,1721};{9,2632};{10,3998};{11,6046};{12,8606};{13,11806};{14,15806};{15,20806};{16,27056};{17,34868};{18,43656};{19,53542};{20,64663};{21,77174};{22,91249};{23,107082};{24,124894};{25,144932};{26,167474};{27,192834};{28,221364};{29,253460};{30,289567};{31,330187};{32,375884};{33,427292};{34,485125};{35,550187};{36,623382};{37,705725};{38,798361};{39,902576};{40,1019817};{41,1151713};{42,1300095};{43,1448477};{44,1596859};{45,1745241};{46,1893623};{47,2042005};{48,2190387};{49,2338769};{50,2487151};{51,2635533};{52,2783915};{53,2932297};{54,3080679};{55,3229061};{56,3377443};{57,3525825};{58,3674207};{59,3822589};{60,3970971};{61,4119353};{62,4267735};{63,4416117};{64,4564499};{65,4712881};{66,4861263};{67,5009645};{68,5158027};{69,5306409};{70,5454791};{71,5603173};{72,5751555};{73,5899937};{74,6048319};{75,6196701};{76,6345083};{77,6493465};{78,6641847};{79,6790229};{80,6938611};{81,7086993};{82,7235375};{83,7383757};{84,7532139};{85,7680521};{86,7828903};{87,7977285};{88,8125667};{89,8274049};{90,8422431};{91,8570813};{92,8719195};{93,8867577};{94,9015959};{95,9164341};{96,9312723};{97,9461105};{98,9609487};};
                                           {{1,11};{2,35};{3,83};{4,155};{5,263};{6,425};{7,668};{8,1032};{9,1578};{10,2397};{11,3626};{12,5162};{13,7082};{14,9482};{15,12482};{16,16232};{17,20919};{18,26778};{19,34101};{20,42339};{21,51607};{22,62033};{23,73762};{24,86956};{25,101800};{26,118499};{27,137285};{28,158420};{29,182196};{30,208944};{31,239035};{32,272887};{33,310971};{34,353815};{35,402014};{36,456238};{37,517240};{38,585867};{39,663072};{40,749927};{41,847638};{42,945349};{43,1043060};{44,1140771};{45,1238482};{46,1336193};{47,1433904};{48,1531615};{49,1629326};{50,1727037};{51,1824748};{52,1922459};{53,2020170};{54,2117881};{55,2215592};{56,2313303};{57,2411014};{58,2508725};{59,2606436};{60,2704147};{61,2801858};{62,2899569};{63,2997280};{64,3094991};{65,3192702};{66,3290413};{67,3388124};{68,3485835};{69,3583546};{70,3681257};{71,3778968};{72,3876679};{73,3974390};{74,4072101};{75,4169812};{76,4267523};{77,4365234};{78,4462945};{79,4560656};{80,4658367};{81,4756078};{82,4853789};{83,4951500};{84,5049211};{85,5146922};{86,5244633};{87,5342344};{88,5440055};{89,5537766};{90,5635477};{91,5733188};{92,5830899};{93,5928610};{94,6026321};{95,6124032};{96,6221743};{97,6319454};{98,6417165};};
                                           {{1,9};{2,29};{3,69};{4,129};{5,219};{6,354};{7,556};{8,859};{9,1314};{10,1997};{11,3021};{12,4301};{13,5901};{14,7901};{15,10401};{16,13526};{17,17432};{18,22314};{19,27806};{20,33984};{21,40934};{22,48753};{23,57549};{24,67444};{25,78576};{26,91099};{27,105187};{28,121036};{29,138866};{30,158924};{31,181489};{32,206875};{33,235434};{34,267562};{35,303706};{36,344367};{37,390111};{38,441572};{39,499466};{40,564596};{41,637867};{42,720297};{43,813031};{44,905765};{45,998499};{46,1091233};{47,1183967};{48,1276701};{49,1369435};{50,1462169};{51,1554903};{52,1647637};{53,1740371};{54,1833105};{55,1925839};{56,2018573};{57,2111307};{58,2204041};{59,2296775};{60,2389509};{61,2482243};{62,2574977};{63,2667711};{64,2760445};{65,2853179};{66,2945913};{67,3038647};{68,3131381};{69,3224115};{70,3316849};{71,3409583};{72,3502317};{73,3595051};{74,3687785};{75,3780519};{76,3873253};{77,3965987};{78,4058721};{79,4151455};{80,4244189};{81,4336923};{82,4429657};{83,4522391};{84,4615125};{85,4707859};{86,4800593};{87,4893327};{88,4986061};{89,5078795};{90,5171529};{91,5264263};{92,5356997};{93,5449731};{94,5542465};{95,5635199};{96,5727933};{97,5820667};{98,5913401};};
                                           {{1,17};{2,53};{3,125};{4,233};{5,395};{6,638};{7,1002};{8,1548};{9,2368};{10,3597};{11,5440};{12,7744};{13,10624};{14,14224};{15,18724};{16,24349};{17,30677};{18,37796};{19,45804};{20,54813};{21,64948};{22,76349};{23,89175};{24,103604};{25,119836};{26,138097};{27,158640};{28,181750};{29,207748};{30,236995};{31,269897};{32,306911};{33,348551};{34,395396};{35,448096};{36,507383};{37,574080};{38,649114};{39,733527};{40,828491};{41,935325};{42,1055513};{43,1190724};{44,1325935};{45,1461146};{46,1596357};{47,1731568};{48,1866779};{49,2001990};{50,2137201};{51,2272412};{52,2407623};{53,2542834};{54,2678045};{55,2813256};{56,2948467};{57,3083678};{58,3218889};{59,3354100};{60,3489311};{61,3624522};{62,3759733};{63,3894944};{64,4030155};{65,4165366};{66,4300577};{67,4435788};{68,4570999};{69,4706210};{70,4841421};{71,4976632};{72,5111843};{73,5247054};{74,5382265};{75,5517476};{76,5652687};{77,5787898};{78,5923109};{79,6058320};{80,6193531};{81,6328742};{82,6463953};{83,6599164};{84,6734375};{85,6869586};{86,7004797};{87,7140008};{88,7275219};{89,7410430};{90,7545641};{91,7680852};{92,7816063};{93,7951274};{94,8086485};{95,8221696};{96,8356907};{97,8492118};{98,8627329};};
                                           {{1,10};{2,32};{3,76};{4,142};{5,241};{6,389};{7,611};{8,945};{9,1446};{10,2197};{11,3323};{12,4731};{13,6491};{14,8691};{15,11441};{16,14878};{17,19174};{18,24544};{19,31257};{20,38809};{21,47305};{22,56862};{23,67613};{24,79708};{25,93315};{26,108622};{27,125843};{28,145216};{29,167011};{30,191530};{31,219113};{32,250144};{33,285054};{34,324328};{35,368510};{36,418215};{37,474133};{38,537041};{39,607812};{40,687429};{41,776997};{42,877761};{43,991120};{44,1104479};{45,1217838};{46,1331197};{47,1444556};{48,1557915};{49,1671274};{50,1784633};{51,1897992};{52,2011351};{53,2124710};{54,2238069};{55,2351428};{56,2464787};{57,2578146};{58,2691505};{59,2804864};{60,2918223};{61,3031582};{62,3144941};{63,3258300};{64,3371659};{65,3485018};{66,3598377};{67,3711736};{68,3825095};{69,3938454};{70,4051813};{71,4165172};{72,4278531};{73,4391890};{74,4505249};{75,4618608};{76,4731967};{77,4845326};{78,4958685};{79,5072044};{80,5185403};{81,5298762};{82,5412121};{83,5525480};{84,5638839};{85,5752198};{86,5865557};{87,5978916};{88,6092275};{89,6205634};{90,6318993};{91,6432352};{92,6545711};{93,6659070};{94,6772429};{95,6885788};{96,6999147};{97,7112506};{98,7225865};};
                                           {{1,28};{2,86};{3,173};{4,303};{5,498};{6,791};{7,1231};{8,1890};{9,2879};{10,4363};{11,6217};{12,8533};{13,11427};{14,15044};{15,19113};{16,23689};{17,28836};{18,34626};{19,41140};{20,48467};{21,56710};{22,65982};{23,76412};{24,88146};{25,101346};{26,116195};{27,132900};{28,151693};{29,172835};{30,196620};{31,223377};{32,253479};{33,287343};{34,325439};{35,368297};{36,416511};{37,470751};{38,531770};{39,600416};{40,677643};{41,764523};{42,862262};{43,960001};{44,1057740};{45,1155479};{46,1253218};{47,1350957};{48,1448696};{49,1546435};{50,1644174};{51,1741913};{52,1839652};{53,1937391};{54,2035130};{55,2132869};{56,2230608};{57,2328347};{58,2426086};{59,2523825};{60,2621564};{61,2719303};{62,2817042};{63,2914781};{64,3012520};{65,3110259};{66,3207998};{67,3305737};{68,3403476};{69,3501215};{70,3598954};{71,3696693};{72,3794432};{73,3892171};{74,3989910};{75,4087649};{76,4185388};{77,4283127};{78,4380866};{79,4478605};{80,4576344};{81,4674083};{82,4771822};{83,4869561};{84,4967300};{85,5065039};{86,5162778};{87,5260517};{88,5358256};{89,5455995};{90,5553734};{91,5651473};{92,5749212};{93,5846951};{94,5944690};{95,6042429};{96,6140168};{97,6237907};{98,6335646};};
                                           {{1,14};{2,44};{3,104};{4,194};{5,329};{6,531};{7,834};{8,1289};{9,1972};{10,2996};{11,4532};{12,6452};{13,8852};{14,11852};{15,15602};{16,20289};{17,25562};{18,31494};{19,38168};{20,45675};{21,54120};{22,63621};{23,74309};{24,86333};{25,99860};{26,115077};{27,132196};{28,151455};{29,173120};{30,197493};{31,224912};{32,255757};{33,290457};{34,329494};{35,373411};{36,422817};{37,478398};{38,540926};{39,611270};{40,690407};{41,779435};{42,879591};{43,992267};{44,1119027};{45,1245787};{46,1372547};{47,1499307};{48,1626067};{49,1752827};{50,1879587};{51,2006347};{52,2133107};{53,2259867};{54,2386627};{55,2513387};{56,2640147};{57,2766907};{58,2893667};{59,3020427};{60,3147187};{61,3273947};{62,3400707};{63,3527467};{64,3654227};{65,3780987};{66,3907747};{67,4034507};{68,4161267};{69,4288027};{70,4414787};{71,4541547};{72,4668307};{73,4795067};{74,4921827};{75,5048587};{76,5175347};{77,5302107};{78,5428867};{79,5555627};{80,5682387};{81,5809147};{82,5935907};{83,6062667};{84,6189427};{85,6316187};{86,6442947};{87,6569707};{88,6696467};{89,6823227};{90,6949987};{91,7076747};{92,7203507};{93,7330267};{94,7457027};{95,7583787};{96,7710547};{97,7837307};{98,7964067};};
                                           {{1,13};{2,41};{3,97};{4,181};{5,307};{6,496};{7,779};{8,1204};{9,1841};{10,2797};{11,4231};{12,6023};{13,8263};{14,11063};{15,14563};{16,18938};{17,24406};{18,30558};{19,37478};{20,45262};{21,54019};{22,63871};{23,74954};{24,87422};{25,101449};{26,117228};{27,134980};{28,154951};{29,177418};{30,202693};{31,231127};{32,263115};{33,299101};{34,339584};{35,385127};{36,436363};{37,494003};{38,558848};{39,631798};{40,713866};{41,806193};{42,910060};{43,1026911};{44,1143762};{45,1260613};{46,1377464};{47,1494315};{48,1611166};{49,1728017};{50,1844868};{51,1961719};{52,2078570};{53,2195421};{54,2312272};{55,2429123};{56,2545974};{57,2662825};{58,2779676};{59,2896527};{60,3013378};{61,3130229};{62,3247080};{63,3363931};{64,3480782};{65,3597633};{66,3714484};{67,3831335};{68,3948186};{69,4065037};{70,4181888};{71,4298739};{72,4415590};{73,4532441};{74,4649292};{75,4766143};{76,4882994};{77,4999845};{78,5116696};{79,5233547};{80,5350398};{81,5467249};{82,5584100};{83,5700951};{84,5817802};{85,5934653};{86,6051504};{87,6168355};{88,6285206};{89,6402057};{90,6518908};{91,6635759};{92,6752610};{93,6869461};{94,6986312};{95,7103163};{96,7220014};{97,7336865};{98,7453716};};
                                           {{1,19};{2,59};{3,139};{4,259};{5,439};{6,709};{7,1114};{8,1721};{9,2632};{10,3998};{11,6046};{12,8606};{13,11806};{14,15806};{15,20806};{16,27056};{17,34868};{18,43656};{19,53542};{20,64663};{21,77174};{22,91249};{23,107082};{24,124894};{25,144932};{26,167474};{27,192834};{28,221364};{29,253460};{30,289567};{31,330187};{32,375884};{33,427292};{34,485125};{35,550187};{36,623382};{37,705725};{38,798361};{39,902576};{40,1019817};{41,1151713};{42,1300095};{43,1448477};{44,1596859};{45,1745241};{46,1893623};{47,2042005};{48,2190387};{49,2338769};{50,2487151};{51,2635533};{52,2783915};{53,2932297};{54,3080679};{55,3229061};{56,3377443};{57,3525825};{58,3674207};{59,3822589};{60,3970971};{61,4119353};{62,4267735};{63,4416117};{64,4564499};{65,4712881};{66,4861263};{67,5009645};{68,5158027};{69,5306409};{70,5454791};{71,5603173};{72,5751555};{73,5899937};{74,6048319};{75,6196701};{76,6345083};{77,6493465};{78,6641847};{79,6790229};{80,6938611};{81,7086993};{82,7235375};{83,7383757};{84,7532139};{85,7680521};{86,7828903};{87,7977285};{88,8125667};{89,8274049};{90,8422431};{91,8570813};{92,8719195};{93,8867577};{94,9015959};{95,9164341};{96,9312723};{97,9461105};{98,9609487};};
                                           {{1,11};{2,35};{3,83};{4,155};{5,263};{6,425};{7,668};{8,1032};{9,1578};{10,2397};{11,3626};{12,5162};{13,7082};{14,9482};{15,12482};{16,16232};{17,20919};{18,26778};{19,34101};{20,42339};{21,51607};{22,62033};{23,73762};{24,86956};{25,101800};{26,118499};{27,137285};{28,158420};{29,182196};{30,208944};{31,239035};{32,272887};{33,310971};{34,353815};{35,402014};{36,456238};{37,517240};{38,585867};{39,663072};{40,749927};{41,847638};{42,945349};{43,1043060};{44,1140771};{45,1238482};{46,1336193};{47,1433904};{48,1531615};{49,1629326};{50,1727037};{51,1824748};{52,1922459};{53,2020170};{54,2117881};{55,2215592};{56,2313303};{57,2411014};{58,2508725};{59,2606436};{60,2704147};{61,2801858};{62,2899569};{63,2997280};{64,3094991};{65,3192702};{66,3290413};{67,3388124};{68,3485835};{69,3583546};{70,3681257};{71,3778968};{72,3876679};{73,3974390};{74,4072101};{75,4169812};{76,4267523};{77,4365234};{78,4462945};{79,4560656};{80,4658367};{81,4756078};{82,4853789};{83,4951500};{84,5049211};{85,5146922};{86,5244633};{87,5342344};{88,5440055};{89,5537766};{90,5635477};{91,5733188};{92,5830899};{93,5928610};{94,6026321};{95,6124032};{96,6221743};{97,6319454};{98,6417165};};
                                           {{1,9};{2,29};{3,69};{4,129};{5,219};{6,354};{7,556};{8,859};{9,1314};{10,1997};{11,3021};{12,4301};{13,5901};{14,7901};{15,10401};{16,13526};{17,17432};{18,22314};{19,27806};{20,33984};{21,40934};{22,48753};{23,57549};{24,67444};{25,78576};{26,91099};{27,105187};{28,121036};{29,138866};{30,158924};{31,181489};{32,206875};{33,235434};{34,267562};{35,303706};{36,344367};{37,390111};{38,441572};{39,499466};{40,564596};{41,637867};{42,720297};{43,813031};{44,905765};{45,998499};{46,1091233};{47,1183967};{48,1276701};{49,1369435};{50,1462169};{51,1554903};{52,1647637};{53,1740371};{54,1833105};{55,1925839};{56,2018573};{57,2111307};{58,2204041};{59,2296775};{60,2389509};{61,2482243};{62,2574977};{63,2667711};{64,2760445};{65,2853179};{66,2945913};{67,3038647};{68,3131381};{69,3224115};{70,3316849};{71,3409583};{72,3502317};{73,3595051};{74,3687785};{75,3780519};{76,3873253};{77,3965987};{78,4058721};{79,4151455};{80,4244189};{81,4336923};{82,4429657};{83,4522391};{84,4615125};{85,4707859};{86,4800593};{87,4893327};{88,4986061};{89,5078795};{90,5171529};{91,5264263};{92,5356997};{93,5449731};{94,5542465};{95,5635199};{96,5727933};{97,5820667};{98,5913401};};
                                           {{1,17};{2,53};{3,125};{4,233};{5,395};{6,638};{7,1002};{8,1548};{9,2368};{10,3597};{11,5440};{12,7744};{13,10624};{14,14224};{15,18724};{16,24349};{17,30677};{18,37796};{19,45804};{20,54813};{21,64948};{22,76349};{23,89175};{24,103604};{25,119836};{26,138097};{27,158640};{28,181750};{29,207748};{30,236995};{31,269897};{32,306911};{33,348551};{34,395396};{35,448096};{36,507383};{37,574080};{38,649114};{39,733527};{40,828491};{41,935325};{42,1055513};{43,1190724};{44,1325935};{45,1461146};{46,1596357};{47,1731568};{48,1866779};{49,2001990};{50,2137201};{51,2272412};{52,2407623};{53,2542834};{54,2678045};{55,2813256};{56,2948467};{57,3083678};{58,3218889};{59,3354100};{60,3489311};{61,3624522};{62,3759733};{63,3894944};{64,4030155};{65,4165366};{66,4300577};{67,4435788};{68,4570999};{69,4706210};{70,4841421};{71,4976632};{72,5111843};{73,5247054};{74,5382265};{75,5517476};{76,5652687};{77,5787898};{78,5923109};{79,6058320};{80,6193531};{81,6328742};{82,6463953};{83,6599164};{84,6734375};{85,6869586};{86,7004797};{87,7140008};{88,7275219};{89,7410430};{90,7545641};{91,7680852};{92,7816063};{93,7951274};{94,8086485};{95,8221696};{96,8356907};{97,8492118};{98,8627329};};
                                           {{1,10};{2,32};{3,76};{4,142};{5,241};{6,389};{7,611};{8,945};{9,1446};{10,2197};{11,3323};{12,4731};{13,6491};{14,8691};{15,11441};{16,14878};{17,19174};{18,24544};{19,31257};{20,38809};{21,47305};{22,56862};{23,67613};{24,79708};{25,93315};{26,108622};{27,125843};{28,145216};{29,167011};{30,191530};{31,219113};{32,250144};{33,285054};{34,324328};{35,368510};{36,418215};{37,474133};{38,537041};{39,607812};{40,687429};{41,776997};{42,877761};{43,991120};{44,1104479};{45,1217838};{46,1331197};{47,1444556};{48,1557915};{49,1671274};{50,1784633};{51,1897992};{52,2011351};{53,2124710};{54,2238069};{55,2351428};{56,2464787};{57,2578146};{58,2691505};{59,2804864};{60,2918223};{61,3031582};{62,3144941};{63,3258300};{64,3371659};{65,3485018};{66,3598377};{67,3711736};{68,3825095};{69,3938454};{70,4051813};{71,4165172};{72,4278531};{73,4391890};{74,4505249};{75,4618608};{76,4731967};{77,4845326};{78,4958685};{79,5072044};{80,5185403};{81,5298762};{82,5412121};{83,5525480};{84,5638839};{85,5752198};{86,5865557};{87,5978916};{88,6092275};{89,6205634};{90,6318993};{91,6432352};{92,6545711};{93,6659070};{94,6772429};{95,6885788};{96,6999147};{97,7112506};{98,7225865};};
                                  };--Stats
                        Profession = {
                                           "Hero (M)", --Male
                                           "Wizard (M)", --Male
                                           "Pilgrim (M)", --Male
                                           "Sage (M)", --Male
                                           "Soldier (M)", --Male
                                           "Merchant (M)", --Male
                                           "Fighter (M)", --Male
                                           "Goof Off (M)", --Male
                                           "Hero (W)", --Female
                                           "Wizard (W)", --Female
                                           "Pilgrim (W)", --Female
                                           "Sage (W)", --Female
                                           "Soldier (W)", --Female
                                           "Merchant (W)", --Female
                                           "Fighter (W)", --Female
                                           "Goof Off (W)", --Female
                                           "None" --[17]= "None";
                                      };--Profession
                     };--Data
            };--Trainer

self = {}
self.form = createForm()
self.form.height = 300;
self.form.width = 260;
self.form.Position="poDesktopCenter"
self.listview = createListview(self.form)
self.listview.height = 200;
self.listview.width = 140;
self.listview.top = 90;
self.listview.left = 93;
self.listview.colum1 = self.listview.getColumns().add()
   self.listview.colum1.Width = 50;
   self.listview.colum1.Caption = 'Lvl';
   self.listview.colum2 = self.listview.getColumns().add()
   self.listview.colum2.Width = 90;
   self.listview.colum2.Caption = 'Exp';
self.label_1 = createLabel(self.form)
self.label_1.Top = 15
self.label_1.Left = 15
self.label_1.caption = "Sample Prof:"
self.label_2 = createLabel(self.form)
self.label_2.Top = 30
self.label_2.Left = 15
self.label_1.caption = "Sample Prof:"
self.label_3 = createLabel(self.form)
self.label_3.Top = 45
self.label_3.Left = 15
self.edit_1 = createEdit(self.form)
self.edit_1.Top = 10
self.edit_1.Left = 90
self.edit_1.Width = 40
self.edit_1.Text = "3"

   self.characters_rg = createRadioGroup(self.form);
   self.characters_rg.height = 200;
   self.characters_rg.width = 87;
   self.characters_rg.top = 90;
   self.characters_rg.left = 3;
   --for character,_ in ipairs(trainer.Data.Characters) do
   for i=1, #trainer.Data.Characters do
      --if character then
         self.characters_rg.getItems().add(trainer.Data.Characters[i]);
      --end
   end
   self.characters_rg.onClick =    function (sender)
                                    local index = strings_getString(sender.getItems(), sender.ItemIndex);
                                    i = nil;
                                    i = (sender.ItemIndex) + 1
                                    --i = self.Data.Characters[index] + 1;                                    --print(1,sender.ItemIndex)
                                    --print(2,index)
                                    heroname = index;
                                    --for k,v in pairs (trainer.Data.Characters) do
                                     --  if k==index then
                                      --    i = v+1
                                     --  end
                                    --end
                                    self.label_2.caption = heroname
                                    if i==5 then
                                       self.listview.clear();
                                    else
                                     --if i then
                                      -- heroname = index;
                                       --local al=getAddressList()
                                       --prof = addresslist_getMemoryRecordByDescription(al, heroname .. " Profession/Sex").Value
                                       --i= tonumber(prof);
                                       prof = self.edit_1.Text
                                     if tonumber(prof)>16 then
                                       self.label_3.caption = trainer.Data.Profession[tonumber(prof)]
                                       self.listview.clear();
                                       else
                                        self.label_3.caption = trainer.Data.Profession[tonumber(prof)]
                                        self.listview.clear();
                                       for _,__table in pairs(trainer.Data.Stats[tonumber(prof)]) do
                                          local entry = self.listview.getItems().add();
                                          entry.Caption = __table[1];
                                          local subentry = entry.getSubItems().add(__table[2]);
                                       end
                                     end
                                    end
                                    if expvalue and goldvalue and heroname then
                                       RecalculateAddresses()
                                    end
                                 end

_________________
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: 582

PostPosted: Fri Sep 22, 2023 2:40 pm    Post subject: Reply with quote

Several questions,
Code:

   self.characters_rg = createRadioGroup(self.form);
   self.characters_rg.height = 200;
   self.characters_rg.width = 87;
   self.characters_rg.top = 90;
   self.characters_rg.left = 3;
   --for character,_ in ipairs(trainer.Data.Characters) do
   for i=1, #trainer.Data.Characters do
      --if character then
         self.characters_rg.getItems().add(trainer.Data.Characters[i]);
      --end
   end
   self.characters_rg.onClick =    function (sender)
                                    local index = strings_getString(sender.getItems(), sender.ItemIndex);
                                    i = nil;
                                    i = (sender.ItemIndex) + 1
                                    --i = self.Data.Characters[index] + 1;                                    --print(1,sender.ItemIndex)
                                    --print(2,index)
                                    heroname = index;
                                    --for k,v in pairs (trainer.Data.Characters) do
                                     --  if k==index then
                                      --    i = v+1
                                     --  end
                                    --end
                                    self.label_2.caption = heroname

self.label_2.caption = heroname results in an error
Code:

                                    if i==5 then
                                       self.listview.clear();
                                    else
                                     --if i then
                                      -- heroname = index;
                                       --local al=getAddressList()
                                       --prof = addresslist_getMemoryRecordByDescription(al, heroname .. " Profession/Sex").Value
                                       --i= tonumber(prof);
                                       prof = self.edit_1.Text

Where is edit_1? What are you attempting?
Code:

                                     if tonumber(prof)>16 then
                                       self.label_3.caption = trainer.Data.Profession[tonumber(prof)]

Similarly what is label_3? What are you attempting to reference.
Code:

                                       self.listview.clear();
                                       else
                                        self.label_3.caption = trainer.Data.Profession[tonumber(prof)]

What is label_3? Same question.
Code:
 
                                        self.listview.clear();
                                       for _,__table in pairs(trainer.Data.Stats[tonumber(prof)]) do
                                          local entry = self.listview.getItems().add();
                                          entry.Caption = __table[1];
                                          local subentry = entry.getSubItems().add(__table[2]);
                                       end
                                     end
                                    end
                                    if expvalue and goldvalue and heroname then
                                       RecalculateAddresses()
                                    end
                                 end

I realize you are working in a partial dark place, but these questions will help me attempt to sync with your thoughts.
Thanks for your input.
Results, nothing is displayed in the listview and the following errors occurred while selecting each of the characters:

Error:[string "trainer = {
..."]:569: attempt to index a nil value (field 'label_2')

Error:[string "trainer = {
..."]:569: attempt to index a nil value (field 'label_2')

Error:[string "trainer = {
..."]:569: attempt to index a nil value (field 'label_2')

Error:[string "trainer = {
..."]:569: attempt to index a nil value (field 'label_2')
569 = self.label_2.caption = heroname
Back to top
View user's profile Send private message Yahoo Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 35

Joined: 16 Feb 2017
Posts: 1478

PostPosted: Fri Sep 22, 2023 3:25 pm    Post subject: Reply with quote

If you copied the entire sample code I gave and tried it in the lua table, you would have used the following lines.

Code:
self.label_1 = createLabel(self.form)
self.label_1.Top = 15
self.label_1.Left = 15
self.label_1.caption = "Sample Prof:"
self.label_2 = createLabel(self.form)
self.label_2.Top = 30
self.label_2.Left = 15
self.label_1.caption = "Sample Prof:"
self.label_3 = createLabel(self.form)
self.label_3.Top = 45
self.label_3.Left = 15
self.edit_1 = createEdit(self.form)
self.edit_1.Top = 10
self.edit_1.Left = 90
self.edit_1.Width = 40
self.edit_1.Text = "3"


My last code is given as an example of table loading simulations.
https://forum.cheatengine.org/viewtopic.php?p=5786288#5786288

Run it independently of your Trainer code and compare it with your own code.

_________________
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
Dark Byte
Site Admin
Reputation: 467

Joined: 09 May 2003
Posts: 25704
Location: The netherlands

PostPosted: Fri Sep 22, 2023 4:09 pm    Post subject: This post has 1 review(s) Reply with quote

Here's a version with a slight performance improvement:
Code:

https://pastebin.com/DdK8Am62

(using OnData)

_________________
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
View user's profile Send private message MSN Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 35

Joined: 16 Feb 2017
Posts: 1478

PostPosted: Fri Sep 22, 2023 11:41 pm    Post subject: Reply with quote

Dark Byte wrote:
Here's a version with a slight performance improvement:
Code:

https://pastebin.com/DdK8Am62

(using OnData)



Code:
--local currentprof = 0 --It's weird to start using this without assigning it first. But it doesn't give any error.

   self.listview.OnData=function(sender, listitem)
     listitem.caption=trainer.Data.Stats[currentprof][listitem.Index+1][1]
     listitem.subItems.add(trainer.Data.Stats[currentprof][listitem.Index+1][2])
   end

prof = "11"
currentprof=tonumber(prof)

--clear list:
self.listview.Items.Count=0;

--clear and load list
  self.listview.Items.Count=#trainer.Data.Stats[tonumber(prof)];
  self.listview.refresh()


Yes, it's like magic, but cleaner and more useful.
Thanks..

#########################

@bknight2602 use the given code independently and compare it with your own Trainer code.

You can figure out where you went wrong and adapt it.

_________________
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: 582

PostPosted: Sat Sep 23, 2023 9:37 am    Post subject: Reply with quote

You noted that you had entered the appropriate code, so I looked at the radiogroup only. My bad
After entering the code, nothing worked.
Moved createlistview before radiogroup deleted the example self.edit_1.Text = "3" an specific example, not general. In terms of setting it to prof, well your suggestion is prof = self.edit_1.Text, but self.edit_1.Text hasn't been set yet, remember createlistview is before createradiogroup, currently.
So I added into createradiogroup
Code:

   self.characters_rg = createRadioGroup(self.form);
   self.characters_rg.height = 200;
   self.characters_rg.width = 87;
   self.characters_rg.top = 90;
   self.characters_rg.left = 3;
   for character,_ in pairs(trainer.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 = trainer.Data.Stats[index]--i = self.Data.Characters[index] + 1;
                                    heroname = index;
                                    print(i);
                                    --for k,v in pairs (trainer.Data.Characters) do
                                       --if k==index then
                                          --i = v+1);
                                       --end
                                    --end
                                    self.label_2.Text = heroname

Now heroname is set, that gave me lots of nil errors, next two lines added to set prof, print command indicastes correct prof.
Code:

                                      local al=getAddressList()
                                      prof = addresslist_getMemoryRecordByDescription(al, heroname .. " Profession/Sex").Value
                                      self.edit_1.Text = prof
                                      print(prof);
                                    if i==5 then
                                       self.listview.clear();
                                    else
                                    --if i then
                                    --print (i);
                                       --heroname = index;
                                       --local al=getAddressList()
                                       --prof = addresslist_getMemoryRecordByDescription(al, heroname .. " Profession/Sex").Value
                                       --i= tonumber(prof);
                                       --prof = self.edit_1.Text
                                    end;
                                       if tonumber(prof)>16 then
                                         self.label_3.caption = trainer.Data.Profession[tonumber(prof)]
                                         self.listview.clear();
                                       else
                                         self.label_3.caption = trainer.Data.Profession[tonumber(prof)]
                                         self.listview.clear();
                                       for _,__table in pairs(trainer.Data.Stats[tonumber(prof)]) do

This step creates a nil value for table:Error:[string "trainer = {
..."]:639: bad argument #1 to 'pairs' (table expected, got nil)
Code:

                                          local entry = self.listview.getItems().add();
                                          entry.Caption = __table[1];
                                          local subentry = entry.getSubItems().add(__table[2]);
                                       end
                                       end
                                       print("the prof is "..prof)
                                       --print("The index selected is", self.Data.Characters[index]);
                                       --print("The hero selected from index is ", index);
                                       print("The hero name is ", heroname);
                                       --self.listview.clear();
                                       --trainer.Data.Stats[index] = prof+1;
                                       --for _,__table in pairs(trainer.Data.Stats[i]) do
                                          --local entry = self.listview.getItems().add();
                                          --entry.Caption = __table[1];
                                          --local subentry = entry.getSubItems().add(__table[2]);
                                       --end
                                    --end
                                    if expvalue and goldvalue and heroname then
                                       RecalculateAddresses()
                                    end
                                 end

What would be your suggestion?
Back to top
View user's profile Send private message Yahoo Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 35

Joined: 16 Feb 2017
Posts: 1478

PostPosted: Sat Sep 23, 2023 12:05 pm    Post subject: Reply with quote

1) Continue with @DarkByte code.
Copy the code and run it as is.

2) In the form, type numbers 1-17 in the edit1 box and select a hero from the RadioGroup.

3) In this case, "prof" gets the index from edit1 and reflects it in the list box.

What value does the following address give for "prof" in your case?

Code:
addresslist_getMemoryRecordByDescription(al, heroname .. " Profession/Sex").Value


Does your address give a number between 1-17?
Or does the hero give the character name?
I asked above about the value (result) you received from this address and I could not see a clear answer.

There must probably be a problem with the address and prof entries.

_________________
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: 582

PostPosted: Sun Sep 24, 2023 10:34 am    Post subject: Reply with quote

I get no code from the link, so I assume that the code you provided after Db's post is the code.
You indicate copy it and then paste it. Where in my code and does it replace some of my code?
Further your question, what does
Code:

addresslist_getMemoryRecordByDescription(al, heroname .. " Profession/Sex").Value

give me? Answer it gives me an error something like I'm trying to index a nil value. the command probably needs to be:
Code:
tonumber(memoryrecordgetValue(addresslist_getMemoryRecordByDescription(al, heroname .. " Profession/Sex")))

Now concerning typing in a number 1-17 in the edit box and selecting a hero. Why not use the radiogroup to select the 1-8 ( I could not make 1-17 work so I commented 9-17 out) in my case and let that selection to obtain the prof?
I'm not on the pc that contains the table. I'll wait for an answer before attempting to proceed.
Back to top
View user's profile Send private message Yahoo Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 35

Joined: 16 Feb 2017
Posts: 1478

PostPosted: Sun Sep 24, 2023 1:10 pm    Post subject: Reply with quote

Code:
tonumber(memoryrecordgetValue(addresslist_getMemoryRecordByDescription(al, heroname .. " Profession/Sex")))


This is an answer showing that "prof" is a number. Ok.

I remind you of this again;
Run and test the code example I gave, independently of your own code and .CT.
Copy the code, open CE, paste it into Lua Script and run it.
In the opened form, change the number of edit boxes and click on a row from the radiogroup, see the result.

If the table interactions give the result you want, check the codes in it and compare them with your own .CT code.

Since your question title is "table", we commented the codes related to table synchronization.
We don't know how you interpret this in your CT code.
We only refer to the "table" interaction.

_________________
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: 582

PostPosted: Sun Sep 24, 2023 5:36 pm    Post subject: Reply with quote

The title was loading the correct table values. However, that might be accomplished.
I'm sure that the code you presented works. Thanks for your input.
ETA
One more error
Code:
self.characters_rg.onClick =    function (sender)
                                    local AL = getAddressList();
                                    local index = strings_getString(sender.getItems(), sender.ItemIndex); -- I'm bit lazy, so sender == trainer.characters_rg
                                    local i = nil;
                                    i = trainer.Data.Characters[index] + 1; -- If the character does not hold the value,, i remains nil.
                                    -- for k,v in pairs (self.Data.Characters) do
                                       -- if k==index then
                                          -- i = v+1 -- We placed a value from 0 to 7 into the Characters name in the table.. but our stats is placed from 1 to 8 (alternative we could force the index in the table);
                                       -- end
                                    -- end
                                    if i then
                                       heroname = index;
                                       --print("The hero name selected " .. heroname);
                                       heroexpaddr = addresslist_getMemoryRecordByDescription(AL, heroname .. ' Exp');
                                       heroexpaddrex = addresslist_getMemoryRecordByDescription(AL, heroname .. ' Exp 16^6');
                                       --print("The index selected is", self.Data.Characters[index]);
                                       --print("The hero selected from index is ", index);
                                       --print("The hero name is ", heroname);
                                       local al = getAddressList();
                                       --print(heroname .. " combined Profession/Sex")
                                       profession = tonumber(memoryrecord_getValue(addresslist_getMemoryRecordByDescription(al, heroname .. " Profession/Sex")))
                                       --print(profession)
                                       print("the profession is " .. profession)
                                       self.listview.clear();
                                       for _,__table in pairs(trainer.Data.Stats[profession]) do
                                          local entry = trainer.listview.getItems().add();
                                          entry.Caption = __table[1];
                                          local subentry = entry.getSubItems().add(__table[2]);
                                       end;
                                    end;
                                    if expvalue and goldvalue and heroname then
                                       RecalculateAddresses();
                                    end;
                                 end;

the print statement immediately prior to works, but I get the same type of error "bad argument #1 to 'pairs' (table expected, got nil)". So, profession is properly selected but the table values aren't loaded.

ETA2
Code:

                                       self.listview.OnData=function(sender, listitem)
                                       listitem.caption=trainer.Data.Stats[profession][listitem.Index+1][1]
                                       listitem.subItems.add(trainer.Data.Stats[profession][listitem.Index+1][2])
                                       end
                                       self.listview.Items.Count=0;
                                       self.listview.Items.Count=#trainer.Data.Stats[tonumber(profession+1)];
                                       --self.listview.refresh()

No dat is displayed in the listt view. The last line commented out because of error:" attempt to call a nil value (field 'refresh')"
Back to top
View user's profile Send private message Yahoo 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
Goto page 1, 2  Next
Page 1 of 2

 
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