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 


Flshing controls

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

PostPosted: Wed May 23, 2018 5:58 pm    Post subject: Flshing controls Reply with quote

I coded in some edit boxes that I want to display a character's level.

I won't go in the whole code, but they all show up on the screen.
Now when they were coded I did so thusly
Code:

   self.Squall_Edit = createEdit(self.form);--Squall Level;
   self.Squall_Edit.Caption = 'Squall', --this was a set of quotations originally
   self.Squall_Edit.Top = 115;
   self.Squall_Edit.Left = 100;
   self.Squall_Edit.Height = 25;
   self.Squall_Edit.Width = 30;

Further down in the code I have a timer
Code:

   ted = createTimer(nil, false);
   ted.Interval = 3000;
   ted.Enabled = true;
   ted.onTimer = function(DisplayLevels)
                    local AL = getAddressList();
                          Squall = memoryrecord_getValue(addresslist_getMemoryRecordByDescription(AL, "Squall Level"));
                          Quistis = memoryrecord_getValue(addresslist_getMemoryRecordByDescription(AL, "Quistis Level"));
                          Zell = memoryrecord_getValue(addresslist_getMemoryRecordByDescription(AL, "Zell Level"));
                          Irvine = memoryrecord_getValue(addresslist_getMemoryRecordByDescription(AL, "Irvine Level"));
                          Rinoa = memoryrecord_getValue(addresslist_getMemoryRecordByDescription(AL, "Rinoa Level"));
                          Selphie = memoryrecord_getValue(addresslist_getMemoryRecordByDescription(AL, "Selphie Level"));
                          Seifer = memoryrecord_getValue(addresslist_getMemoryRecordByDescription(AL, "Seifer Level"));
                          Edea = memoryrecord_getValue(addresslist_getMemoryRecordByDescription(AL, "Edea Level"));
                          trainer.Squall_Edit.Caption = Squall;
                          trainer.Quistis_Edit.Caption = Quistis;
                          trainer.Zell_Edit.Caption = Zell;
                          trainer.Irvine_Edit.Caption = Irvine;
                          trainer.Rinoa_Edit.Caption = Rinoa;
                          trainer.Selphie_Edit.Caption = Selphie;
                          trainer.Seifer_Edit.Caption = Seifer;
                          trainer.Edea_Edit.Caption = Edea;
                 end--function(DisplayLevels)
--


Now all this works sort of. The levels will display and then go blank, then reappear in cycles. It seems that it might be the timer, so I change the caption to what I displayed earlier. Same result flashes on/off. Could anyone suggest a work around to keep the level on at all times(that is when the timer is enabled.
Back to top
View user's profile Send private message Yahoo Messenger
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Thu May 24, 2018 6:35 am    Post subject: Reply with quote

trainer.Squall_Edit.Caption = Squall; is trying to set a string to an entire memory record... it doesn't make sense. Use 'Squall' or "Squall". Kind of seems like you tried that so you probably have some other problem (though as far as the name goes you shouldn't have to update it at all if it never changes, you should be able to set the name once and never think about them again).

Though, I'd do something slightly more complicated that results in less code:
Code:
local names = {'Squall', 'Quistis', 'Zell', 'Irvine', 'Rinoa', 'Selphie', 'Seifer', 'Edea'}

ted = createTimer(nil, false)
ted.Interval = 3000
ted.Enabled = true
ted.onTimer = function(DisplayLevels)
  local AL = getAddressList()
  -- loop over all the names and do whatever for each
  for _,name in ipairs(names) do
    --local mr = memoryrecord_getValue(addresslist_getMemoryRecordByDescription(AL, name .. ' Level')) -- not used
    trainer[name..'_Edit'].Caption = name
  end
end

_________________
https://github.com/FreeER/ has a few CE related repos
Back to top
View user's profile Send private message
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