 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Razi Expert Cheater
Reputation: 1
Joined: 17 Jan 2018 Posts: 205
|
Posted: Wed Apr 03, 2019 9:04 am Post subject: How to change list in a combobox1 with combobox2? |
|
|
I have three questions:
1) How to change list in a combobox1 with combobox2?How to change combobox1 list? For example,in combobox1, the list consists 90 Items: Item1, Item2, Item3 ... Item90.
if in combobox2 the ItemIndex is 0, then show only: Item1, Item4, Item5 in combobox1.
if in combobox2 the ItemIndex is 1, then show only: item5, item7, item10, item50 in combobox1
2) Is it possible to improve the following code?
Code: | function materiatype()
if UDF1["CEComboBox"..2].ItemIndex == 0 then
UDF1.CEComboBox1.Items.clear()
for k,v in pairs(materialisttbl) do
UDF1.CEComboBox1.Items.Add(v)
end
elseif UDF1["CEComboBox"..2].ItemIndex == 1 then
UDF1.CEComboBox1.Items.clear()
for i = 0x31, 0x49 do
UDF1.CEComboBox1.Items.Add(materialisttbl[i])
end
UDF1.CEComboBox1.Items.Add(materialisttbl[0xFF])
elseif UDF1["CEComboBox"..2].ItemIndex == 2 then
UDF1.CEComboBox1.Items.clear()
for i = 0x17, 0x23 do
UDF1.CEComboBox1.Items.Add(materialisttbl[i])
end
UDF1.CEComboBox1.Items.Add(materialisttbl[0xFF])
elseif UDF1["CEComboBox"..2].ItemIndex == 3 then
UDF1.CEComboBox1.Items.clear()
for i = 0x0E, 0x0F do
UDF1.CEComboBox1.Items.Add(materialisttbl[i])
end
for i = 0x13, 0x15 do
UDF1.CEComboBox1.Items.Add(materialisttbl[i])
end
for i = 0x24, 0x2C do
UDF1.CEComboBox1.Items.Add(materialisttbl[i])
end
UDF1.CEComboBox1.Items.Add(materialisttbl[0x30])
UDF1.CEComboBox1.Items.Add(materialisttbl[0xFF])
elseif UDF1["CEComboBox"..2].ItemIndex == 4 then
UDF1.CEComboBox1.Items.clear()
for i = 0x00, 0x0D do
UDF1.CEComboBox1.Items.Add(materialisttbl[i])
end
for i = 0x10, 0x12 do
UDF1.CEComboBox1.Items.Add(materialisttbl[i])
end
UDF1.CEComboBox1.Items.Add(materialisttbl[0xFF])
elseif UDF1["CEComboBox"..2].ItemIndex == 5 then
UDF1.CEComboBox1.Items.clear()
for i = 0x4A, 0x5A do
UDF1.CEComboBox1.Items.Add(materialisttbl[i])
end
UDF1.CEComboBox1.Items.Add(materialisttbl[0xFF])
end
end |
3) How to get all the numbers in the table?
Example:
Code: | t = { {5, 6, 7}, {8, 9, 10} }
print(t[2][2])
-- result 9 |
How to get in result 8, 9, 10 ?
The following code does not work:
Code: | t = { {5, 6, 7}, {8, 9, 10} }
print(t[2]) |
|
|
Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Wed Apr 03, 2019 11:04 am Post subject: |
|
|
Quote: | 1. if in combobox2 the ItemIndex is 0, then show only: Item1, Item4, Item5 in combobox1.
if in combobox2 the ItemIndex is 1, then show only: item5, item7, item10, item50 in combobox1
|
sample: I use tables but it close to combobox.
Code: | data = {"Item1","Item2","Item3","Item4","Item5","Item6","Item6","Item8","Item9","Item10",
"Item20","Item50","Item90"}
combo1 = {}
combo2 = {0,1} -- since don't know if combo2 items are same with combo1 items or not
index = combo2[0] -- try chane to 1
if index then
table.insert(combo1,{data[1],data[4],data[5]})
else
table.insert(combo1,{data[5],data[10],data[12]})
end
for k, v in ipairs(combo1) do
--print(k)
for i=1, #v do print(v[i]) end
print() -- This will just print a new line
end
|
Remember lua table index start with 0
Quote: | 3. How to get all the numbers in the table?. How to get in result 8, 9, 10 ? |
Code: | t = {{5, 6, 7},{8, 9, 10}}
-- show how much index on table t
print('Index data on table t = '..#t)
print(" ") -- This will just print a new line
-- show all
for k, v in ipairs(t) do
--print(k)
for i=1, #v do print(v[i]) end
print() -- This will just print a new line
end
--for show t.index[2]
print(" ") -- This will just print a new line
for i=1,3 do
print(t[2][i])
end |
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
 |
Razi Expert Cheater
Reputation: 1
Joined: 17 Jan 2018 Posts: 205
|
Posted: Wed Apr 03, 2019 1:38 pm Post subject: |
|
|
Thanks, it helped.
Can we add different pictures to the combobox Items?
|
|
Back to top |
|
 |
|
|
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
|
|