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 


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

PostPosted: Mon Feb 28, 2022 4:10 pm    Post subject: Naming convention Reply with quote

I have a number of not visible listviews stacked on each other. The names are listviewx, listviwx+1, listviewn. Now I have a radiogroup that will point to the correct listview. How do I code in the correct listview?
For example lets say that the radio group points to 5 this would be listview5. I have set a variable x=5, but when I try "istview" .. x = var, then var.Visible = true I get an error attempting to index a var. Same error if "listview" .. x.Visible = true I get a smilar error.

So, what would be the correcr code?
Back to top
View user's profile Send private message Yahoo Messenger
YoucefHam
Cheater
Reputation: 5

Joined: 19 Mar 2015
Posts: 39
Location: Algeria

PostPosted: Mon Feb 28, 2022 8:00 pm    Post subject: Re: Naming convention Reply with quote

bknight2602 wrote:
I have a number of not visible listviews stacked on each other. The names are listviewx, listviwx+1, listviewn. Now I have a radiogroup that will point to the correct listview. How do I code in the correct listview?
...........


here try this

Code:

for i = 1, UDF1.CERadioGroup1.Items.Count do
    if i == UDF1.CERadioGroup1.ItemIndex + 1 then
        if UDF1['CEListView'..i] then
           UDF1['CEListView'..i].Visible = true
        end
    else
        if UDF1['CEListView'..i] then
           UDF1['CEListView'..i].Visible = false
        end
    end
end
Back to top
View user's profile Send private message Send e-mail
Frouk
Grandmaster Cheater
Reputation: 5

Joined: 22 Jun 2021
Posts: 510

PostPosted: Tue Mar 01, 2022 1:34 am    Post subject: Reply with quote

It will give error since you need to give exact table or userdata etc.
Accessing table is:
Code:
local Player = CPed:New{base = ...}
Player.Health = 100
function setCharHealth(char,health)
char.Health = health
end
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1532

PostPosted: Tue Mar 01, 2022 1:54 am    Post subject: Reply with quote

In your code the situation would be like this:

Code:
self = {}

   self.form = createForm(false); -- self = trainer since it's a function inside of a table...
   setProperty(self.form , "BiDiMode", "bdLeftToRight");
   self.form.Caption = 'Cheat Panel';
   self.form.Width = 350;
   self.form.Height = 410;
   self.form.Left = 470;
   self.form.Top =5;

      self.set_exp = createButton(self.form);
   self.set_exp.Caption = 'Enter Exp';
   self.set_exp.height = 35;
   self.set_exp.left = 135;
   self.set_exp.top = 5;
   self.set_exp.width = 100;
   self.set_exp.onClick =    function (sender)
                              local value = tonumber(self.exp_value.Text);
                              if value then
                                 expvalue = value;
                                 print("The experience entered " .. expvalue);
                                 if expvalue and goldvalue and heroname then
                                    RecalculateAddresses()
                                 end
                              end
                           end

  for i=0, 13 do --1-14 = for i=1, 14 do
   self["listview"..i] = createListView(self.form)
   setProperty(self["listview"..i], 'ViewStyle', 'vsReport')
   setProperty(self["listview"..i], 'RowSelect', 'True')
   setProperty(self["listview"..i], 'ReadOnly', 'True')
   setProperty(self["listview"..i], 'HideSelection', 'False')
   self["listview"..i].top = 90;
   self["listview"..i].width = 110;
   self["listview"..i].left = 225;
   self["listview"..i].height = 300;
   name=self["listview"..i].getColumns().add()
   name.Width = 45;
   name.caption="Lvl" .. i
   name1=self["listview"..i].getColumns().add()
   name1.Width = 55;
   name1.caption="Exp" .. i
   self["listview"..i].Visible = false;
  end
  local function listVfalse()
    for i=0, 13 do
     self["listview"..i].Visible = false;
    end
   end

   self.profession_rg = createRadioGroup(self.form);
   self.profession_rg.height = 300;
   self.profession_rg.width = 85;
   self.profession_rg.top = 90;
   self.profession_rg.left = 110;

  for i=0, 13 do
   self.profession_rg.getItems().add("Hero" .. i)
  end
   self.profession_rg.onClick =    function (sender)
                                     listVfalse() --all list.visible=false
                                    index = strings_getString(sender.getItems(), sender.ItemIndex); --heroprof
                                    i = nil;
                                    listInd=sender.ItemIndex
                                    --i = self.Data.Stats[index] --+ 1; -- If the character does not hold the value,, i remains nil.
                                    print(index,listInd)
                                    self["listview"..tonumber(listInd)].Visible = true
                                     --for k,v in pairs (self.Data.Stats) 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
                                     end
self.form.show()

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

Joined: 08 Oct 2012
Posts: 586

PostPosted: Tue Mar 01, 2022 9:25 am    Post subject: Reply with quote

Before I start redoing the code, I have a question. How can properties be set without a period after self in:
Code:

  for i=0, 13 do --1-14 = for i=1, 14 do
   self["listview"..i] = createListView(self.form)
   setProperty(self["listview"..i], 'ViewStyle', 'vsReport')
   setProperty(self["listview"..i], 'RowSelect', 'True')
   setProperty(self["listview"..i], 'ReadOnly', 'True')
   setProperty(self["listview"..i], 'HideSelection', 'False')
   self["listview"..i].top = 90;
   self["listview"..i].width = 110;
   self["listview"..i].left = 225;
   self["listview"..i].height = 300;
   name=self["listview"..i].getColumns().add()
   name.Width = 45;
   name.caption="Lvl" .. i
   name1=self["listview"..i].getColumns().add()
   name1.Width = 55;
   name1.caption="Exp" .. i
   self["listview"..i].Visible = false;
  end
  local function listVfalse()
    for i=0, 13 do
     self["listview"..i].Visible = false;
    end
   end


ETA: Besides all the fourteen listviews are present created by form design, not code, but if this will address all of them, that is a good deal.

ETA2: The experience is not linked to a Hero, but it is linked to a profession. The Hero would be used to edit a hero exp in 1st Exp, 2nd Exp --6th Exp.



2022-03-01_10-30-44.png
 Description:
 Filesize:  50.32 KB
 Viewed:  2789 Time(s)

2022-03-01_10-30-44.png




Last edited by bknight2602 on Tue Mar 01, 2022 10:31 am; edited 1 time in total
Back to top
View user's profile Send private message Yahoo Messenger
TheyCallMeTim13
Wiki Contributor
Reputation: 51

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Tue Mar 01, 2022 10:12 am    Post subject: Reply with quote

You can index tables in lua with a period or square brackets.

If you run this it will just print "test2" twice because the same key is set twice.
Code:
local tbl = {
   somekey = 'test',
   ['somekey'] = 'test2',
}

print(tbl.somekey)
print(tbl['somekey'])

_________________
Back to top
View user's profile Send private message Visit poster's website
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1532

PostPosted: Tue Mar 01, 2022 11:00 am    Post subject: Reply with quote

A "self" coverage table or whatever you like.
Here is a "self" that will appeal to the "Form Designer"

Code:
   local self = UDF1
local listview = "CEListView"


  for i=1, 14 do --no i=0  (CEListView0 ?)
   --self["listview"..i] = createListView(self.form)
   setProperty(self[listview..i], 'ViewStyle', 'vsReport')
   setProperty(self[listview..i], 'RowSelect', 'True')
   setProperty(self[listview..i], 'ReadOnly', 'True')
   setProperty(self[listview..i], 'HideSelection', 'False')
   self["CEListView"..i].top = 90; -- >> "CEListView"
   UDF1["CEListView"..i].width = 110;
   UDF1[listview..i].left = 225; -->> UDF1
   self[listview..i].height = 300;
   name=self[listview..i].getColumns().add()
   name.Width = 45;
   name.caption="Lvl" .. i
   name1=self[listview..i].getColumns().add()
   name1.Width = 55;
   name1.caption="Exp" .. i
   self[listview..i].Visible = false;
  end
  local function listVfalse()
    for i=0, 13 do
     self[listview..i].Visible = false;
    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: 586

PostPosted: Tue Mar 01, 2022 11:30 am    Post subject: Reply with quote

This is my CheatPanel in design mode. To accept the code, I would need to redesign the whole scheme. At this point I'm at a standstill as the exp is linked/related to profession, not Hero.


2022-03-01_11-24-57.png
 Description:
 Filesize:  81.93 KB
 Viewed:  2778 Time(s)

2022-03-01_11-24-57.png


Back to top
View user's profile Send private message Yahoo Messenger
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 586

PostPosted: Wed Mar 02, 2022 9:59 am    Post subject: Reply with quote

witching to all code instead of creating/modifying a UDF;
I have
Code:

   self.profession_rg = createRadioGroup(self.form);
   self.profession_rg.height = 300;
   self.profession_rg.width = 85;
   self.profession_rg.top = 90;
   self.profession_rg.left = 110;
   for profession,_ in pairs(self.Data.Profession) do
      if tonumber(profession) then
         self.profession_rg.getItems().add(_);
      end
   end
   self.profession_rg.onClick =    function (sender)
                                    index = strings_getString(sender.getItems(), sender.ItemIndex); --heroprof
                                    i = nil;
                                    i = self.Data.Profession[index]+ 1;

I get an error at this line 267: attempt to perform arithmetic on a nil value (field '?'). That is after a button, how to fix this?
Code:

                                    print(i)
                                     for k,v in pairs (self.Data.Stats) 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
                                       heroprof = index;
                                       print("The index selected is", self.Data.Stats[index]);
                                       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
                                 end

I get no errors in a similar line in the character_rg.
Back to top
View user's profile Send private message Yahoo Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1532

PostPosted: Wed Mar 02, 2022 10:24 am    Post subject: Reply with quote

Yes, there was a similar error.
Pay attention to this detail:
If the index you are using is "0" and the object in the table starts at "1", you will get an error trying to use an index that does not exist.

To fix:
Put "No One" at the zero "0" index in groups. So you get around it by adding an "if index~=0 then" check in "OnClick". "else" No One is active.

Also, don't give "nil" a value to the object you're going to reuse, give it a null ("") or zero "0".

Note: No one will do the calculation cycle in your code for you. Sorry for not being able to help with this.
But if you ask about the places where you hang out in sections, whoever is on the watch will try to offer you a solution.

Good luck with. Wink

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

Joined: 08 Oct 2012
Posts: 586

PostPosted: Wed Mar 02, 2022 11:58 am    Post subject: Reply with quote

Let's step back one more step code not executing and loading cheatpanel.
I did download a LUA error finding routine, from another thread. The last line executed 51.

Code:

print("start")
trainer =    {
            Data =    {
                        Characters =    {
                                          [0] = "No One";
                                          [1] = "1st";
                                          [2] = "2nd";
                                          [3] = "3rd";
                                          [4] = "4th";
                                          [5] = "5th";
                                          [6] = "6th";

                                          ["No One"] = 0; -- Index of radiogroup
                                          ["1st"] = 1;
                                          ["2nd"] = 2;
                                          ["3rd"] = 3;
                                          ["4th"] = 4;
                                          ["5th"] = 5;
                                          ["6th"] = 6;
                                       };--Characters
                        Stats =   { -- Exp and level
                                           {{1,999};{2,1999};{3,3999};{4,7999};{5,15999};{6,31999};{7,63999};{8,127999};{9,255999};{10,511999};{11,767999};{12,1167999};{13,1567999};{14,1967999};{15,2367999};{16,2967999};{17,3567999};{18,4167999};{19,4767999};{20,5367999};{21,5967999};{22,6567999};{23,7167999};{24,7767999};{25,8367999};{26,8967999};{27,9567999};{28,10167999};{29,10767999};{30,11367999};{31,11967999};{32,12567999};{33,13167999};{34,13767999};{35,14367999};{36,14967999};{37,15567999};{38,16167999};{39,16767999};{40,17367999};{41,17967999};{42,18567999};{43,19167999};{44,19767999};{45,20367999};{46,20967999};{47,21567999};{48,22167999};{49,22767999};{50,23367999};{51,23967999};{52,24567999};{53,25167999};{54,25767999};{55,26367999};{56,26967999};{57,27567999};{58,28167999};{59,28767999};{60,29367999};{61,29967999};{62,30567999};{63,31167999};{64,31767999};{65,32367999};{66,32967999};{67,33567999};{68,34167999};{69,34767999};{70,35367999};{71,35967999};{72,36567999};{73,37167999};{74,37767999};{75,38367999};{76,38967999};{77,39567999};{78,40167999};{79,40767999};{80,41367999};{81,41967999};{82,42567999};{83,43167999};{84,43767999};{85,44367999};{86,44967999};{87,45567999};{88,46167999};{89,46767999};{90,47367999};{91,47967999};{92,48567999};{93,49167999};{94,49767999};{95,50367999};{96,50967999};{97,51567999};{98,52167999};{99,52767999};{100,53367999};{101,53967999};{102,54567999};{103,55167999};{104,55767999};{105,56367999};{106,56967999};{107,57567999};{108,58167999};{109,58767999};{110,59367999};};
                                           {{1,1249};{2,2499};{3,4999};{4,9999};{5,19999};{6,39999};{7,79999};{8,159999};{9,319999};{10,639999};{11,1014999};{12,1414999};{13,1814999};{14,2214999};{15,2614999};{16,3214999};{17,3814999};{18,4414999};{19,5014999};{20,5614999};{21,6214999};{22,6814999};{23,7414999};{24,8014999};{25,8614999};{26,9214999};{27,9814999};{28,10414999};{29,11044999};{30,11614999};{31,12214999};{32,12814999};{33,13414999};{34,14014999};{35,14614999};{36,15214999};{37,15814999};{38,16414999};{39,17014999};{40,17614999};{41,18214999};{42,18814999};{43,19414999};{44,20014999};{45,20614999};{46,21214999};{47,21814999};{48,22414999};{49,23014999};{50,23614999};{51,24214999};{52,24814999};{53,25414999};{54,26014999};{55,26614999};{56,27214999};{57,27814999};{58,28414999};{59,29014999};{60,29614999};{61,30214999};{62,30814999};{63,31414999};{64,32014999};{65,32614999};{66,33214999};{67,33814999};{68,34414999};{69,35014999};{70,35614999};{71,36214999};{72,36814999};{73,37414999};{74,38014999};{75,38614999};{76,39214999};{77,39814999};{78,40414999};{79,41014999};{80,41614999};{81,42214999};{82,42814999};{83,43414999};{84,44014999};{85,44614999};{86,45214999};{87,45814999};{88,46414999};{89,47014999};{90,47614999};{91,48214999};{92,48814999};{93,49414999};{94,50014999};{95,50614999};{96,51214999};{97,51814999};{98,52414999};{99,53014999};{100,53614999};{101,54214999};{102,54814999};{103,55414999};{104,56014999};{105,56614999};{106,57214999};{107,57814999};{108,58414999};{109,59014999};{110,59614999};};
                                           {{1,1099};{2,2199};{3,4399};{4,8799};{5,17599};{6,35199};{7,70399};{8,140799};{9,281599};{10,563199};{11,875199};{12,1275199};{13,1675199};{14,2075199};{15,2475199};{16,3075199};{17,3675199};{18,4275199};{19,4875199};{20,5475199};{21,6075199};{22,6675199};{23,7275199};{24,7875199};{25,8475199};{26,9075199};{27,9675199};{28,10275199};{29,10875199};{30,11475199};{31,12075199};{32,12675199};{33,13275199};{34,13875199};{35,14475199};{36,15075199};{37,15675199};{38,16275199};{39,16875199};{40,17475199};{41,18075199};{42,18675199};{43,19275199};{44,19875199};{45,20475199};{46,21075199};{47,21675199};{48,22275199};{49,22875199};{50,23475199};{51,24075199};{52,24675199};{53,25275199};{54,25875199};{55,26475199};{56,27075199};{57,27675199};{58,28275199};{59,28875199};{60,29475199};{61,30075199};{62,30675199};{63,31275199};{64,31875199};{65,32475199};{66,33075199};{67,33675199};{68,34275199};{69,34875199};{70,35475199};{71,36075199};{72,36675199};{73,37275199};{74,37875199};{75,38475199};{76,39075199};{77,39675199};{78,40275199};{79,40875199};{80,41475199};{81,42075199};{82,42675199};{83,43275199};{84,43875199};{85,44475199};{86,45075199};{87,45675199};{88,46275199};{89,46875199};{90,47475199};{91,48075199};{92,48675199};{93,49275199};{94,49875199};{95,50475199};{96,51075199};{97,51675199};{98,52275199};{99,52875199};{100,53475199};{101,54075199};{102,54675199};{103,55275199};{104,55875199};{105,56475199};{106,57075199};{107,57675199};{108,58275199};{109,58875199};{110,59475199};};
                                           {{1,899};{2,1799};{3,3599};{4,7199};{5,14399};{6,28799};{7,57599};{8,115199};{9,230399};{10,460799};{11,685799};{12,1085799};{13,1485799};{14,1885799};{15,2285799};{16,2885799};{17,3485799};{18,4085799};{19,4685799};{20,5285799};{21,5885799};{22,6485799};{23,7085799};{24,7685799};{25,8285799};{26,8885799};{27,9485799};{28,10085799};{29,10685799};{30,11285799};{31,11885799};{32,12485799};{33,13085799};{34,13685799};{35,14285799};{36,14885799};{37,15485799};{38,16085799};{39,16685799};{40,17285799};{41,17885799};{42,18485799};{43,19085799};{44,19685799};{45,20285799};{46,20885799};{47,21485799};{48,22085799};{49,22685799};{50,23285799};{51,23885799};{52,24485799};{53,25085799};{54,25685799};{55,26285799};{56,26885799};{57,27485799};{58,28085799};{59,28685799};{60,29285799};{61,29885799};{62,30485799};{63,31085799};{64,31685799};{65,32285799};{66,32885799};{67,33485799};{68,34085799};{69,34685799};{70,35285799};{71,35885799};{72,36485799};{73,37085799};{74,37685799};{75,38285799};{76,38885799};{77,39485799};{78,40085799};{79,40685799};{80,41285799};{81,41885799};{82,42485799};{83,43085799};{84,43685799};{85,44285799};{86,44885799};{87,45485799};{88,46085799};{89,46685799};{90,47285799};{91,47885799};{92,48485799};{93,49085799};{94,49685799};{95,50285799};{96,50885799};{97,51485799};{98,52085799};{99,52685799};{100,53285799};{101,53885799};{102,54485799};{103,55085799};{104,55685799};{105,56285799};{106,56885799};{107,57485799};{108,58085799};{109,58685799};{110,59285799};};
                                           {{1,1299};{2,2599};{3,5199};{4,10399};{5,20799};{6,41599};{7,83199};{8,166399};{9,332799};{10,665599};{11,1065599};{12,1465599};{13,1865599};{14,2265599};{15,2665599};{16,3265599};{17,3865599};{18,4465599};{19,5065599};{20,5665599};{21,6265599};{22,6865599};{23,7465599};{24,8065599};{25,8665599};{26,9265599};{27,9865599};{28,10465599};{29,11065599};{30,11665599};{31,12265599};{32,12865599};{33,13465599};{34,14065599};{35,14665599};{36,15265599};{37,15865599};{38,16465599};{39,17065599};{40,17665599};{41,18265599};{42,18865599};{43,19465599};{44,20065599};{45,20665599};{46,21265599};{47,21865599};{48,22465599};{49,23065599};{50,23665599};{51,24265599};{52,24865599};{53,25465599};{54,26065599};{55,26665599};{56,27265599};{57,27865599};{58,28465599};{59,29065599};{60,29665599};{61,30265599};{62,30865599};{63,31465599};{64,32065599};{65,32665599};{66,33265599};{67,33865599};{68,34465599};{69,35065599};{70,35665599};{71,36265599};{72,36865599};{73,37465599};{74,38065599};{75,38665599};{76,39265599};{77,39865599};{78,40465599};{79,41065599};{80,41665599};{81,42265599};{82,42865599};{83,43465599};{84,44065599};{85,44665599};{86,45265599};{87,45865599};{88,46465599};{89,47065599};{90,47665599};{91,48265599};{92,48865599};{93,49465599};{94,50065599};{95,50665599};{96,51265599};{97,51865599};{98,52465599};{99,53065599};{100,53665599};{101,54265599};{102,54865599};{103,55465599};{104,56065599};{105,56665599};{106,57265599};{107,57865599};{108,58465599};{109,59065599};{110,59665599};};
                                           {{1,1149};{2,2299};{3,4599};{4,9199};{5,18399};{6,36799};{7,73599};{8,147199};{9,294399};{10,588799};{11,913799};{12,1313799};{13,1713799};{14,2113799};{15,2513799};{16,3113799};{17,3713799};{18,4313799};{19,4913799};{20,5513799};{21,6113799};{22,6713799};{23,7313799};{24,7913799};{25,8513799};{26,9113799};{27,9713799};{28,10313799};{29,10913799};{30,11513799};{31,12113799};{32,12713799};{33,13313799};{34,13913799};{35,14513799};{36,15113799};{37,15713799};{38,16313799};{39,16913799};{40,17513799};{41,18113799};{42,18713799};{43,19313799};{44,19913799};{45,20513799};{46,21113799};{47,21713799};{48,22313799};{49,22913799};{50,23513799};{51,24113799};{52,24713799};{53,25313799};{54,25913799};{55,26513799};{56,27113799};{57,27713799};{58,28313799};{59,28913799};{60,29513799};{61,30113799};{62,30713799};{63,31313799};{64,31913799};{65,32513799};{66,33113799};{67,33713799};{68,34313799};{69,34913799};{70,35513799};{71,36113799};{72,36713799};{73,37313799};{74,37913799};{75,38513799};{76,39113799};{77,39713799};{78,40313799};{79,40913799};{80,41513799};{81,42113799};{82,42713799};{83,43313799};{84,43913799};{85,44513799};{86,45113799};{87,45713799};{88,46313799};{89,46913799};{90,47513799};{91,48113799};{92,48713799};{93,49313799};{94,49913799};{95,50513799};{96,51113799};{97,51713799};{98,52313799};{99,52913799};{100,53513799};{101,54113799};{102,54713799};{103,55313799};{104,55913799};{105,56513799};{106,57113799};{107,57713799};{108,58313799};{109,58913799};{110,59513799};};
                                           {{1,1249};{2,2499};{3,4999};{4,9999};{5,19999};{6,39999};{7,79999};{8,159999};{9,319999};{10,639999};{11,1014999};{12,1414999};{13,1814999};{14,2214999};{15,2614999};{16,3214999};{17,3814999};{18,4414999};{19,5014999};{20,5614999};{21,6214999};{22,6814999};{23,7414999};{24,8014999};{25,8614999};{26,9214999};{27,9814999};{28,10414999};{29,11044999};{30,11614999};{31,12214999};{32,12814999};{33,13414999};{34,14014999};{35,14614999};{36,15214999};{37,15814999};{38,16414999};{39,17014999};{40,17614999};{41,18214999};{42,18814999};{43,19414999};{44,20014999};{45,20614999};{46,21214999};{47,21814999};{48,22414999};{49,23014999};{50,23614999};{51,24214999};{52,24814999};{53,25414999};{54,26014999};{55,26614999};{56,27214999};{57,27814999};{58,28414999};{59,29014999};{60,29614999};{61,30214999};{62,30814999};{63,31414999};{64,32014999};{65,32614999};{66,33214999};{67,33814999};{68,34414999};{69,35014999};{70,35614999};{71,36214999};{72,36814999};{73,37414999};{74,38014999};{75,38614999};{76,39214999};{77,39814999};{78,40414999};{79,41014999};{80,41614999};{81,42214999};{82,42814999};{83,43414999};{84,44014999};{85,44614999};{86,45214999};{87,45814999};{88,46414999};{89,47014999};{90,47614999};{91,48214999};{92,48814999};{93,49414999};{94,50014999};{95,50614999};{96,51214999};{97,51814999};{98,52414999};{99,53014999};{100,53614999};{101,54214999};{102,54814999};{103,55414999};{104,56014999};{105,56614999};{106,57214999};{107,57814999};{108,58414999};{109,59014999};{110,59614999};};
                                           {{1,1249};{2,2499};{3,4999};{4,9999};{5,19999};{6,39999};{7,79999};{8,159999};{9,319999};{10,639999};{11,1014999};{12,1414999};{13,1814999};{14,2214999};{15,2614999};{16,3214999};{17,3814999};{18,4414999};{19,5014999};{20,5614999};{21,6214999};{22,6814999};{23,7414999};{24,8014999};{25,8614999};{26,9214999};{27,9814999};{28,10414999};{29,11044999};{30,11614999};{31,12214999};{32,12814999};{33,13414999};{34,14014999};{35,14614999};{36,15214999};{37,15814999};{38,16414999};{39,17014999};{40,17614999};{41,18214999};{42,18814999};{43,19414999};{44,20014999};{45,20614999};{46,21214999};{47,21814999};{48,22414999};{49,23014999};{50,23614999};{51,24214999};{52,24814999};{53,25414999};{54,26014999};{55,26614999};{56,27214999};{57,27814999};{58,28414999};{59,29014999};{60,29614999};{61,30214999};{62,30814999};{63,31414999};{64,32014999};{65,32614999};{66,33214999};{67,33814999};{68,34414999};{69,35014999};{70,35614999};{71,36214999};{72,36814999};{73,37414999};{74,38014999};{75,38614999};{76,39214999};{77,39814999};{78,40414999};{79,41014999};{80,41614999};{81,42214999};{82,42814999};{83,43414999};{84,44014999};{85,44614999};{86,45214999};{87,45814999};{88,46414999};{89,47014999};{90,47614999};{91,48214999};{92,48814999};{93,49414999};{94,50014999};{95,50614999};{96,51214999};{97,51814999};{98,52414999};{99,53014999};{100,53614999};{101,54214999};{102,54814999};{103,55414999};{104,56014999};{105,56614999};{106,57214999};{107,57814999};{108,58414999};{109,59014999};{110,59614999};};
                                           {{1,1149};{2,2299};{3,4599};{4,9199};{5,18399};{6,36799};{7,73599};{8,147199};{9,294399};{10,588799};{11,913799};{12,1313799};{13,1713799};{14,2113799};{15,2513799};{16,3113799};{17,3713799};{18,4313799};{19,4913799};{20,5513799};{21,6113799};{22,6713799};{23,7313799};{24,7913799};{25,8513799};{26,9113799};{27,9713799};{28,10313799};{29,10913799};{30,11513799};{31,12113799};{32,12713799};{33,13313799};{34,13913799};{35,14513799};{36,15113799};{37,15713799};{38,16313799};{39,16913799};{40,17513799};{41,18113799};{42,18713799};{43,19313799};{44,19913799};{45,20513799};{46,21113799};{47,21713799};{48,22313799};{49,22913799};{50,23513799};{51,24113799};{52,24713799};{53,25313799};{54,25913799};{55,26513799};{56,27113799};{57,27713799};{58,28313799};{59,28913799};{60,29513799};{61,30113799};{62,30713799};{63,31313799};{64,31913799};{65,32513799};{66,33113799};{67,33713799};{68,34313799};{69,34913799};{70,35513799};{71,36113799};{72,36713799};{73,37313799};{74,37913799};{75,38513799};{76,39113799};{77,39713799};{78,40313799};{79,40913799};{80,41513799};{81,42113799};{82,42713799};{83,43313799};{84,43913799};{85,44513799};{86,45113799};{87,45713799};{88,46313799};{89,46913799};{90,47513799};{91,48113799};{92,48713799};{93,49313799};{94,49913799};{95,50513799};{96,51113799};{97,51713799};{98,52313799};{99,52913799};{100,53513799};{101,54113799};{102,54713799};{103,55313799};{104,55913799};{105,56513799};{106,57113799};{107,57713799};{108,58313799};{109,58913799};{110,59513799};};
                                           {{1,1499};{2,2999};{3,5999};{4,11999};{5,23999};{6,47999};{7,95999};{8,191999};{9,383999};{10,767999};{11,1212999};{12,1612999};{13,2012999};{14,2412999};{15,2812999};{16,3412999};{17,4012999};{18,4612999};{19,5212999};{20,5812999};{21,6412999};{22,7012999};{23,7612999};{24,8212999};{25,8812999};{26,9412999};{27,10012999};{28,10612999};{29,11212999};{30,11812999};{31,12412999};{32,13012999};{33,13612999};{34,14212999};{35,14812999};{36,15412999};{37,16012999};{38,16612999};{39,17212999};{40,17812999};{41,18412999};{42,19012999};{43,19612999};{44,20212999};{45,20812999};{46,21412999};{47,22012999};{48,22612999};{49,23212999};{50,23812999};{51,24412999};{52,25012999};{53,25612999};{54,26212999};{55,26812999};{56,27412999};{57,28012999};{58,28612999};{59,29212999};{60,29812999};{61,30412999};{62,31012999};{63,31612999};{64,32212999};{65,32812999};{66,33412999};{67,34012999};{68,34612999};{69,35212999};{70,35812999};{71,36412999};{72,37012999};{73,37612999};{74,38212999};{75,38812999};{76,39412999};{77,40012999};{78,40612999};{79,41212999};{80,41812999};{81,42412999};{82,43012999};{83,43612999};{84,44212999};{85,44812999};{86,45412999};{87,46012999};{88,46612999};{89,47212999};{90,47812999};{91,48412999};{92,49012999};{93,49612999};{94,50212999};{95,50812999};{96,51412999};{97,52012999};{98,52612999};{99,53212999};{100,53812999};{101,54412999};{102,55012999};{103,55612999};{104,56212999};{105,56812999};{106,57412999};{107,58012999};{108,58612999};{109,59212999};{110,59812999};};
                                           {{1,1299};{2,2599};{3,5199};{4,10399};{5,20799};{6,41599};{7,83199};{8,166399};{9,332799};{10,665599};{11,1065599};{12,1465599};{13,1865599};{14,2265599};{15,2665599};{16,3265599};{17,3865599};{18,4465599};{19,5065599};{20,5665599};{21,6265599};{22,6865599};{23,7465599};{24,8065599};{25,8665599};{26,9265599};{27,9865599};{28,10465599};{29,11065599};{30,11665599};{31,12265599};{32,12865599};{33,13465599};{34,14065599};{35,14665599};{36,15265599};{37,15865599};{38,16465599};{39,17065599};{40,17665599};{41,18265599};{42,18865599};{43,19465599};{44,20065599};{45,20665599};{46,21265599};{47,21865599};{48,22465599};{49,23065599};{50,23665599};{51,24265599};{52,24865599};{53,25465599};{54,26065599};{55,26665599};{56,27265599};{57,27865599};{58,28465599};{59,29065599};{60,29665599};{61,30265599};{62,30865599};{63,31465599};{64,32065599};{65,32665599};{66,33265599};{67,33865599};{68,34465599};{69,35065599};{70,35665599};{71,36265599};{72,36865599};{73,37465599};{74,38065599};{75,38665599};{76,39265599};{77,39865599};{78,40465599};{79,41065599};{80,41665599};{81,42265599};{82,42865599};{83,43465599};{84,44065599};{85,44665599};{86,45265599};{87,45865599};{88,46465599};{89,47065599};{90,47665599};{91,48265599};{92,48865599};{93,49465599};{94,50065599};{95,50665599};{96,51265599};{97,51865599};{98,52465599};{99,53065599};{100,53665599};{101,54265599};{102,54865599};{103,55465599};{104,56065599};{105,56665599};{106,57265599};{107,57865599};{108,58465599};{109,59065599};{110,59665599};};
                                           {{1,1399};{2,2799};{3,5599};{4,11199};{5,22399};{6,44799};{7,89599};{8,179199};{9,358399};{10,716799};{11,1131799};{12,1531799};{13,1931799};{14,2331799};{15,2731799};{16,3331799};{17,3931799};{18,4531799};{19,5131799};{20,5731799};{21,6331799};{22,6931799};{23,7531799};{24,8131799};{25,8731799};{26,9331799};{27,9931799};{28,10531799};{29,11131799};{30,11731799};{31,12331799};{32,12931799};{33,13531799};{34,14131799};{35,14731799};{36,15331799};{37,15931799};{38,16531799};{39,17131799};{40,17731799};{41,18331799};{42,18931799};{43,19531799};{44,20131799};{45,20731799};{46,21331799};{47,21931799};{48,22531799};{49,23131799};{50,23731799};{51,24331799};{52,24931799};{53,25531799};{54,26131799};{55,26731799};{56,27331799};{57,27931799};{58,28531799};{59,29131799};{60,29731799};{61,30331799};{62,30931799};{63,31531799};{64,32131799};{65,32731799};{66,33331799};{67,33931799};{68,34531799};{69,35131799};{70,35731799};{71,36331799};{72,36931799};{73,37531799};{74,38131799};{75,38731799};{76,39331799};{77,39931799};{78,40531799};{79,41131799};{80,41731799};{81,42331799};{82,42931799};{83,43531799};{84,44131799};{85,44731799};{86,45331799};{87,45931799};{88,46531799};{89,47131799};{90,47731799};{91,48331799};{92,48931799};{93,49531799};{94,50131799};{95,50731799};{96,51331799};{97,51931799};{98,52531799};{99,53131799};{100,53731799};{101,54331799};{102,54931799};{103,55531799};{104,56131799};{105,56731799};{106,57331799};{107,57931799};{108,58531799};{109,59131799};{110,59731799};};
                                           {{1,1399};{2,2799};{3,5599};{4,11199};{5,22399};{6,44799};{7,89599};{8,179199};{9,358399};{10,716799};{11,1131799};{12,1531799};{13,1931799};{14,2331799};{15,2731799};{16,3331799};{17,3931799};{18,4531799};{19,5131799};{20,5731799};{21,6331799};{22,6931799};{23,7531799};{24,8131799};{25,8731799};{26,9331799};{27,9931799};{28,10531799};{29,11131799};{30,11731799};{31,12331799};{32,12931799};{33,13531799};{34,14131799};{35,14731799};{36,15331799};{37,15931799};{38,16531799};{39,17131799};{40,17731799};{41,18331799};{42,18931799};{43,19531799};{44,20131799};{45,20731799};{46,21331799};{47,21931799};{48,22531799};{49,23131799};{50,23731799};{51,24331799};{52,24931799};{53,25531799};{54,26131799};{55,26731799};{56,27331799};{57,27931799};{58,28531799};{59,29131799};{60,29731799};{61,30331799};{62,30931799};{63,31531799};{64,32131799};{65,32731799};{66,33331799};{67,33931799};{68,34531799};{69,35131799};{70,35731799};{71,36331799};{72,36931799};{73,37531799};{74,38131799};{75,38731799};{76,39331799};{77,39931799};{78,40531799};{79,41131799};{80,41731799};{81,42331799};{82,42931799};{83,43531799};{84,44131799};{85,44731799};{86,45331799};{87,45931799};{88,46531799};{89,47131799};{90,47731799};{91,48331799};{92,48931799};{93,49531799};{94,50131799};{95,50731799};{96,51331799};{97,51931799};{98,52531799};{99,53131799};{100,53731799};{101,54331799};{102,54931799};{103,55531799};{104,56131799};{105,56731799};{106,57331799};{107,57931799};{108,58531799};{109,59131799};{110,59731799};};
                                           {{1,1499};{2,2999};{3,5999};{4,11999};{5,23999};{6,47999};{7,95999};{8,191999};{9,383999};{10,767999};{11,1212999};{12,1612999};{13,2012999};{14,2412999};{15,2812999};{16,3412999};{17,4012999};{18,4612999};{19,5212999};{20,5812999};{21,6412999};{22,7012999};{23,7612999};{24,8212999};{25,8812999};{26,9412999};{27,10012999};{28,10612999};{29,11212999};{30,11812999};{31,12412999};{32,13012999};{33,13612999};{34,14212999};{35,14812999};{36,15412999};{37,16012999};{38,16612999};{39,17212999};{40,17812999};{41,18412999};{42,19012999};{43,19612999};{44,20212999};{45,20812999};{46,21412999};{47,22012999};{48,22612999};{49,23212999};{50,23812999};{51,24412999};{52,25012999};{53,25612999};{54,26212999};{55,26812999};{56,27412999};{57,28012999};{58,28612999};{59,29212999};{60,29812999};{61,30412999};{62,31012999};{63,31612999};{64,32212999};{65,32812999};{66,33412999};{67,34012999};{68,34612999};{69,35212999};{70,35812999};{71,36412999};{72,37012999};{73,37612999};{74,38212999};{75,38812999};{76,39412999};{77,40012999};{78,40612999};{79,41212999};{80,41812999};{81,42412999};{82,43012999};{83,43612999};{84,44212999};{85,44812999};{86,45412999};{87,46012999};{88,46612999};{89,47212999};{90,47812999};{91,48412999};{92,49012999};{93,49612999};{94,50212999};{95,50812999};{96,51412999};{97,52012999};{98,52612999};{99,53212999};{100,53812999};{101,54412999};{102,55012999};{103,55612999};{104,56212999};{105,56812999};{106,57412999};{107,58012999};{108,58612999};{109,59212999};{110,59812999};};
                                   };-- Stats Exp and level
                        Profession =  {
                                           [0] = "None";
                                           [1] = "Fighter";
                                           [2] = "Mage";
                                           [3] = "Priest";
                                           [4] = "Thief";
                                           [5] = "Ranger";
                                           [6] = "Alchemist";
                                           [7] = "Bard";
                                           [8] = "Psionic";
                                           [9] = "Valkyrie";
                                           [10] = "Bishop";
                                           [11] = "Lord";
                                           [12] = "Samuri";
                                           [13] = "Monk";

This is line 51
Code:

                                           [14] = "Ninja";
                                      };--Profession
                     };--Data
            };--Trainer

Notice I have reordered as you suggested.

Why would it stop at a somewhat unlikely(to me) line? Most likely when the code stops there the rest of the code is not executed and the self.form.show currently located on line 66 is not executed. I realize that code line would be better placed after all the objects have ben created, but in my defense I put it in line with the creation of CheatPanel to get it to pop up, not knowing the code execution stop at line 41.

Saved, closed and reloaded, still no pop up, however, after entering the LUA checking code, still stops at line 41. I then entered trainer:start() and entered, CheatPanel pops up. Then after hitting the execute script button again, the last line read was the last line of code, how interesting.


Last edited by bknight2602 on Wed Mar 02, 2022 12:46 pm; edited 4 times in total
Back to top
View user's profile Send private message Yahoo Messenger
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Wed Mar 02, 2022 12:13 pm    Post subject: Reply with quote

offtopic, but just a suggestion for in the future: Use a pagecontrol

rightclick and choose "add tab" each time until you got all the different views.
Then in the code when you show the form to the user, add pagecontrolname.ShowTabs to false, and you can use pagecontrol.TabIndex to change between views

_________________
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
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 586

PostPosted: Wed Mar 02, 2022 12:16 pm    Post subject: Reply with quote

Dark Byte wrote:
offtopic, but just a suggestion for in the future: Use a pagecontrol

rightclick and choose "add tab" each time until you got all the different views.
Then in the code when you show the form to the user, add pagecontrolname.ShowTabs to false, and you can use pagecontrol.TabIndex to change between views


Where, how do I use a pagecontrol?
You are never off topic. IMO
Back to top
View user's profile Send private message Yahoo Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1532

PostPosted: Wed Mar 02, 2022 1:08 pm    Post subject: Reply with quote

bknight2602 wrote:
..




This code works correctly in my case.
If I misunderstood, please repeat the question and continue.

Code:

function concate(tblname,ind)
 if ind==true then
  aa=0
  for k,v in ipairs(tblname) do
   print(aa .. " - " .. tblname[aa]) -- or add()
   aa=tonumber(aa) + 1
  end
  else
  for k,v in ipairs(tblname) do
   print(k .. " - " .. v) --or add()
  end
 end
end

concate(trainer.Data.Profession,true)

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

Joined: 08 Oct 2012
Posts: 586

PostPosted: Wed Mar 02, 2022 1:37 pm    Post subject: Reply with quote

AylinCE wrote:
bknight2602 wrote:
..




This code works correctly in my case.
If I misunderstood, please repeat the question and continue.

Code:

function concate(tblname,ind)
 if ind==true then
  aa=0
  for k,v in ipairs(tblname) do
   print(aa .. " - " .. tblname[aa]) -- or add()
   aa=tonumber(aa) + 1
  end
  else
  for k,v in ipairs(tblname) do
   print(k .. " - " .. v) --or add()
  end
 end
end

concate(trainer.Data.Profession,true)


Yes, I believe you misunderstood. In a blank table with just the data loaded followed by your suggestion. The code does print out all the professions although I am completely not understanding why that section of the data was selected instead of the character part, but that may have been a function of the how the table was constructed.
Now how would I modify my rg to output a heroprof variable that can be used in the listviews that follows?
Code:

   self.profession_rg = createRadioGroup(self.form);
   self.profession_rg.height = 300;
   self.profession_rg.width = 85;
   self.profession_rg.top = 90;
   self.profession_rg.left = 110;
   for profession,_ in pairs(self.Data.Profession) do
      if tonumber(profession) then
         self.profession_rg.getItems().add(_);
      end
   end
   self.profession_rg.onClick =    function (sender)
                                    index = strings_getString(sender.getItems(), sender.ItemIndex); --heroprof
                                    i = "";
                                    i = self.Data.Profession[index]+ 1; -- If the character does not hold the value,, i remains nil.
                                    print(i)
                                     for k,v in pairs (self.Data.Stats) 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
                                       heroprof = index--;index = heroprof;--heroname = index;
                                       print("The index selected is", self.Data.Stats[index]);
                                       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
                                 end
.
I still am receiving an error message 265: attempt to perform arithmetic on a nil value (field '?')
that line is
Code:

i = self.Data.Profession[index]+ 1;

This is after setting i to "" as suggested. The table has been recalculated and the var recalc =1..
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