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 

List view to list view

Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Master Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 368

PostPosted: Sun Apr 23, 2017 2:03 pm    Post subject: List view to list view Reply with quote

   self.listview2 = createListView(self.form)--Level and Exp
   setProperty(self.listview2, 'ViewStyle', 'vsReport')
   setProperty(self.listview2, 'RowSelect', 'True')
   setProperty(self.listview2, 'ReadOnly', 'True')
   setProperty(self.listview2, 'HideSelection', 'False') = 190;
   self.listview2.width = 140;
   self.listview2.left = 260;
   self.listview2.height = 250;
   self.listview2_colum1 = self.listview2.getColumns().add()
   self.listview2_colum1.Width = 40;
   self.listview2_colum1.Caption = 'Lvl';
   self.listview2_colum2 = self.listview2.getColumns().add()
   self.listview2_colum2.Width = 90;
   self.listview2_colum2.Caption = 'Exp';

      i = 1
      for _,__table in pairs(self.Data.Stats[i]) do
         local entry = self.listview2.getItems().add();
         entry.Caption = __table[1];
         local subentry = entry.getSubItems().add(__table[2]);
   self.listview2.onClick = function (sender)
                              local row_1 = sender.getItems().getItem(sender.getItemIndex()); -- Level
                              local row_2 = strings_getString(row_1.getSubItems(),0) + 0; -- Exp
                              if (heroname and row_1 and row_2) then
                                 local address_1 = addresslist_getMemoryRecordByDescription(getAddressList(), heroname .. ' Exp (+h2E)');
                                 if address_1 then--(address_1 and address_2) then
                                    memoryrecord_setValue(address_1, row_2)
                                 heroname = nil
                                 row_1 = nil
                                 row_2 = nil
                                 address_1 = nil
                                 trainer.hero_selected_panel5.visible = false;
                                 trainer.hero_selected_panel5.Caption = " ";
                                 trainer.listview.visible = true;
                                 i = nil
   self.listview = createListView(self.form)--Character Names
   setProperty(self.listview, 'ViewStyle', 'vsReport')
   setProperty(self.listview, 'RowSelect', 'True')
   setProperty(self.listview, 'ReadOnly', 'True')
   setProperty(self.listview, 'HideSelection', 'False') = 190;
   self.listview.width = 140;
   self.listview.left = 110;
   self.listview.height = 250;
   self.listview_colum1 = self.listview.getColumns().add()
   self.listview_colum2 = self.listview.getColumns().add()
   self.listview_colum1.Width = 0;
   self.listview_colum2.Width = 110;
   self.listview_colum1.Caption = 'Index';
   self.listview_colum2.Caption = 'Character';
                       for _, name in pairs(self.Data.Characters) do
                         local entry = self.listview.getItems().add()
                           entry.Caption = name
                            for _, color in pairs(self.Data.Characters) do
                              local subentry = entry.getSubItems().add(name)
   self.listview.onClick = function(sender)
                              whichRec = nil
                              whichHero = nil
                              local AL = getAddressList()
                              local i = sender.ItemIndex
                              heroname = trainer.Data.Characters[i]
                              print("The Hero selected is " .. heroname .. " index " .. i)
                              for x = 0 , AL.Count - 1 do
                                 if AL.MemoryRecord[x].Description == heroname then
                                    whichHero = AL.MemoryRecord[x]
                                    mrLvlAddr = string.format("%x",tonumber(whichHero.Address,16) + 0x32)
                                    mrLvl = readBytes(mrLvlAddr)
                                    trainer.listview.visible = false;
                                    trainer.hero_selected_panel5.visible = true;
                                    trainer.hero_selected_panel5.Caption = whichHero.Description .. " Level is " .. mrLvl
                                 end;--if AL.MemoryRecord[x].Description == heroname then
                              end;--for x = 0 , AL.Count - 1 do
                              --whichRec = nil
                              --whichHero = nil

I've got two list views populated by data at the beginning of the code. Both load and display the correct data, see top image.
After selecting a name the listview is invisible and the panel is displayed with correct caption is displayed. See bottom image. The intent was to alter the exp. level of the selected hero at the current level to a new exp. level(contained in the right list view).
This worked before using a radio graph(selecting hero) and a list view(like the right one, also using the "old" code. Now the exp. value is not adjusted. Any suggestions to make this work?

 Filesize:  32.56 KB
 Viewed:  2254 Time(s)


 Filesize:  29.18 KB
 Viewed:  2254 Time(s)


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
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum

Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites