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 


For each, TypeOf and toInt16 in CE Lua

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Fri Jan 10, 2020 9:59 pm    Post subject: For each, TypeOf and toInt16 in CE Lua Reply with quote

Let say I have 8 combo boxes in a form, each CB contains item 0 and 1, with each index start as default -1. Not created using table.

Now, I want to check if each CB index position is 0 (or the item is 1). I can use the traditional way by :

Code:
if cb1.itemIndex == 0 or cb2.itemIndex == 0.....'till cb8  then
 -- do something
end


But I want like this in VB :

Code:
For Each ctl As Control In Me.Controls
            If TypeOf ctl Is ComboBox Then
                If ctl.Text = "1" Then
                    total += Convert.ToInt16(ctl.Tag)
                End If
                binary.Text += ctl.Text
            End If
        Next


Questions:
1. How to check if components is a CB using typeOf iin CE Lua?
2. Which CE Lua function to convert string/num to Int16?
3. What 'Tag' usefor in form designer?.

Thank you

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL


Last edited by Corroder on Sat Jan 11, 2020 4:18 am; edited 1 time in total
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Sat Jan 11, 2020 3:34 am    Post subject: Reply with quote

1: if xxx.ClassName=='TCEComboBox' then ...

2: tonumber('string') & 0xffff

3: tag is a number that you can use for whatever. E
g an index in an array table

_________________
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
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Sat Jan 11, 2020 4:16 am    Post subject: Reply with quote

Thanks, DB, I will try. Meanwhile I use something like this:

Code:
function Check()
 labelBin.Caption = 'Binary -'      -- a label for binary value
 labelDen.Caption = 'Denary -'   -- a label for denary value

 for i=1,8,1 do
  local x = 'cb'..i    --- combobox name are cb1, cb2..cb8
  local t = x.Tag    --- each cb have tag (number 2,4,8,16,32,64,128)
  if x.itemIndex == 0 then
   total = total + tonumber(t,16)   -- convert tag to int16, is it true?
  end
  labelBin.Caption = x.Item  -- need make math addition for value from each combobox
 end
end


My goal is to create a game for a math course and the project name is Binary Calculation Game (I did it in VBNet script).
I just want to try re-make it using CE Lua.



Capture.JPG
 Description:
Binary Calculation Game
 Filesize:  33.15 KB
 Viewed:  1358 Time(s)

Capture.JPG



_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
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