 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
mordax Expert Cheater
Reputation: 1
Joined: 16 Apr 2010 Posts: 138
|
Posted: Tue Jun 04, 2013 9:49 am Post subject: how to use combobox and convert my lua to combo |
|
|
hi. i have a trainer for one racing game and i keep adding stuff, trainer gets so huge that i have no room for stuff anymore, so i want to make sets (like super acceleration) or (super high speed) and put them into a combobox, so people can click on the dropdown menu and select a preset they want
but i don't understand how combobox works, can someone please give me an example based on my current lua?
I have attached a screenshot of my current setup.
what i want to do is this
=get all gear ratios into dropdown box (combobox) with preset values
= so instead of my editbox at end i would have a preset value, i assume its the "Text" part right? i just replace it with value?
Description: |
|
Filesize: |
24.22 KB |
Viewed: |
21576 Time(s) |

|
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25778 Location: The netherlands
|
Posted: Tue Jun 04, 2013 10:18 am Post subject: |
|
|
Set the style of the comboboxes to csDropDownList
Click on the items field in the property editor and click on the ... button
Fill in all the options in the items box that shows
When done, set the ItemIndex to 0 (first item in the list)
To get the selection you can get the text, or the ItemIndex to get which option is selected. (I recommend itemindex)
_________________
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 |
|
 |
mordax Expert Cheater
Reputation: 1
Joined: 16 Apr 2010 Posts: 138
|
Posted: Tue Jun 04, 2013 10:36 am Post subject: |
|
|
thanks for quick reply, however im still bit confused.
do you mean "OnGetItems" and then press ... ?
if i do that, i get this in lua
Code: | function CEComboBox1GetItems(sender)
end |
you mean put my pointers into that function now?
my main problem is that i don't understand all the syntaxes in CE, how they are used, if i see fully working example its np for me to understand why and how it works.
can you plz include 1 example with the pointer that i have in screenshot? (so that it would appear in list and when clicking it would set some random value to that address where my pointer points to)
|
|
Back to top |
|
 |
Drakon3 How do I cheat?
Reputation: 0
Joined: 26 May 2013 Posts: 3
|
Posted: Tue Jun 04, 2013 10:40 am Post subject: |
|
|
Code: |
function CEButton7Click(sender)
CEComboBox1=findComponentByName(CEComboBox1)
Vibor=getProperty(CEComboBox1,'ItemIndex')
if Vibor == '-1' then
messageDialog('Choose to activate the cheat',1 ,2)
return end
if Vibor == '0' then
writeInteger(address ,value)
showMessage('Cheat №1 aktiv!')
return end
if Vibor == '1' then
writeInteger(address ,value)
showMessage('Cheat №2 aktiv!')
return end
if Vibor == '2' then
writeInteger(address ,value)
showMessage('Cheat №3 aktiv!')
return end
end
|
Last edited by Drakon3 on Tue Jun 04, 2013 10:44 am; edited 1 time in total |
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25778 Location: The netherlands
|
Posted: Tue Jun 04, 2013 10:43 am Post subject: |
|
|
the onSelect event is recommended, but i think that you want to only do something when you press a button
e.g:
[combobox] [activate]
to get the itemindex (the selected item) use combobox_getItemIndex
e.g:
Code: |
index=combobox_getItemIndex(UDF1_CEComboBox1)
|
and then have that code inside a button that checks if index==0 then do action0, if index==1 do action1, etc...
_________________
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 |
|
 |
daspamer Grandmaster Cheater Supreme
Reputation: 54
Joined: 13 Sep 2011 Posts: 1588
|
Posted: Tue Jun 04, 2013 11:12 am Post subject: |
|
|
Code: | --[[
Make sure you got,
ComboBox
1 Edit box
Button (or do on SelectionChange in the combo box).
--]]
function ComboHacks ()
index = combobox_getItemIndex(CEComboBox1);
if index == -1 then return end;
-- just edit the address
if index == 0 then
writeInteger("...", control_getCaption(UDF1_CEEdit))
elseif index == 1 then
writeInteger("...", control_getCaption(UDF1_CEEdit))
elseif index == 2 then
writeInteger("...", control_getCaption(UDF1_CEEdit))
elseif index == 3 then
writeInteger("...", control_getCaption(UDF1_CEEdit))
-- (...)
elseif index == 10 then
writeInteger("...", control_getCaption(UDF1_CEEdit))
end
end |
_________________
I'm rusty and getting older, help me re-learn lua. |
|
Back to top |
|
 |
mordax Expert Cheater
Reputation: 1
Joined: 16 Apr 2010 Posts: 138
|
Posted: Tue Jun 04, 2013 11:55 am Post subject: |
|
|
ah thanks guys, im sure i can work something out from these examples.
what im trying to do, is just set a value whenever you select something from the list. no need to show a message or anything else.
i click on the dropdown list and as soon as i select something, that value gets written to my address. thats all.
I will test these and post back whatever i got it working or not.
EDIT:
hmm nope, im getting errors.
i want the cheat to activate as soon as i choose it from dropdown menu (can be on button press too).
but again im stuck with syntaxes.
here's what i tried:
Code: | function CEButton1Click(sender)
CEComboBox1=findComponentByName(CEComboBox1)
Vibor=getProperty(CEComboBox1,'ItemIndex')
if Vibor == '-1' then
messageDialog('Choose to activate the cheat',1 ,2)
return end
if Vibor == '0' then
writeInteger("[[game2.exe+00D82DCC]+175c1]+31", 2147816224)
return end
end |
and when i click on the dropdown box i get this error:
Quote: | Error:[string "function CEComboBox1GetItems(sender)..."]:2: attempt to index global 'Combobox1' (a nil value) |
and when i click on button i get this:
Quote: | Error:[string "function CEButton1Click(sender)..."]:2: attempt to call global 'findComponentByName' (a nil value) |
sry im not too good in writing lua out of scratch, i understand how it should work, that if value is 0 then write this and if value is 1 then write that and then i specify that 0=value1 and 1=value2 ..etc and then i choose it and when i press button it writes the value1 or value2, but im just horrible when it comes to writing it out of nowhere.
Whenever i write a trainer i always take pieces from my previous code and modify to match, but im new to combobox.
EDIT2:
also i want it to show an item/cheat name in dropdown menu, not value, where would i put the name?
EDIT3:
earlier i found 1 example on CE forum, it is closest to what i need, but code looks messed up and not what i need (visually it looks like what i need)
i have attached the example.ct that i found on CE forum.
Description: |
|
 Download |
Filename: |
example.ct |
Filesize: |
1.1 KB |
Downloaded: |
1206 Time(s) |
|
|
Back to top |
|
 |
daspamer Grandmaster Cheater Supreme
Reputation: 54
Joined: 13 Sep 2011 Posts: 1588
|
Posted: Tue Jun 04, 2013 12:46 pm Post subject: |
|
|
Sorry my bad,
I forgot to include the UDF1..
Anyway, put this...
Code: | function ComboHacks ()
index = combobox_getItemIndex(UDF1_CEComboBox1);
if index == -1 then return end;
-- just edit the address
if index == 0 then
writeInteger("...", control_getCaption(UDF1_CEEdit))
elseif index == 1 then
writeInteger("...", control_getCaption(UDF1_CEEdit))
elseif index == 2 then
writeInteger("...", control_getCaption(UDF1_CEEdit))
elseif index == 3 then
writeInteger("...", control_getCaption(UDF1_CEEdit))
-- (...)
elseif index == 10 then
writeInteger("...", control_getCaption(UDF1_CEEdit))
end
end
setMethodProperty(UDF1_CEComboBox1, "OnSelect", ComboHacks) |
Here's an example for that .CT you posted.
Description: |
|
 Download |
Filename: |
example.CT |
Filesize: |
1.42 KB |
Downloaded: |
1267 Time(s) |
_________________
I'm rusty and getting older, help me re-learn lua. |
|
Back to top |
|
 |
mordax Expert Cheater
Reputation: 1
Joined: 16 Apr 2010 Posts: 138
|
Posted: Tue Jun 04, 2013 12:57 pm Post subject: |
|
|
@DaSpamer
thanks, at least im not getting errors anymore when clicking on the combobox, but it opens up as empty.
sry im still confused, i filled out addresses, but that's about all i understand right now.
3 things i don't understand:
1. Where do i put the CEEdit and why do i need it? how does it work exactly?
2. where do i write the values that will be written to my address? (each cheat in list will have different value obviously and different title)
3. where can i specify the title of the cheat that is shown in the list? my list will have about 30-50 entries and each needs a name, hiding the value. so when i click on like "Cheat1" then it writes some value to my specified address.
EDIT:
sry if i confused you in my 1st post, i don't want to see editbox at all, i want values to be preset by me, so users cant edit any values, they simply select them from box like so:
>combobox<
cheat1
cheat2
cheat3
cheat4
and each of those, will have a hidden, preset value (hidden as it will not be seen by users).
those values make no sense, so they dont need to see them.
i want to set them and list them as cheat1, cheat2 ..etc
|
|
Back to top |
|
 |
daspamer Grandmaster Cheater Supreme
Reputation: 54
Joined: 13 Sep 2011 Posts: 1588
|
Posted: Tue Jun 04, 2013 1:33 pm Post subject: |
|
|
Hmm so basically you want to have a Cheat list in the ComboBox,
And when user picks for example 'speedhack' write to some address a value.
_________________
I'm rusty and getting older, help me re-learn lua. |
|
Back to top |
|
 |
mordax Expert Cheater
Reputation: 1
Joined: 16 Apr 2010 Posts: 138
|
Posted: Tue Jun 04, 2013 1:39 pm Post subject: |
|
|
yes exactly. i think i was bit confusing in my first post.
game has so many different things to choose from, that making button for each would require a lot bigger resolution than 1920x1080 .. so i was hoping to solve this by using a simple dropdown box with list of cheats in it.
EDIT:
i got it working. friend helped me a little, now i understand the concept of this.
thank you all for giving examples, he managed to get it working thanks to these examples :)
Code: | function ComboHacks()
index = combobox_getItemIndex(UDF1_CEComboBox1);
if index == 0 then writeInteger("[[game.exe+00a82DCa]+175]+31", 2147216016)
elseif index == 1 then writeInteger("[[game.exe+00a82DC3]+17]+34", 2147816116)
elseif index == 2 then print("3rd line: 2")
elseif index == 3 then print("4th line: 3")
end
end
setMethodProperty(UDF1_CEComboBox1, "OnSelect", ComboHacks)
form_show(UDF1)
strings_add(getAutoAttachList(), "game.exe") |
|
|
Back to top |
|
 |
mgr.inz.Player I post too much
Reputation: 222
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Wed Jun 05, 2013 5:23 am Post subject: |
|
|
if you have many options it that list, you can use Lua table (array):
Code: |
addresses = { "[[game.exe+00a82DCa]+175]+31",
"[[game.exe+00a82DC3]+17]+34" }
values = { 2147216016,
2147816116}
function ComboHacks()
index = combobox_getItemIndex(UDF1_CEComboBox1) + 1;
writeInteger(addresses[index], values[index])
end |
Of course there are other methods to make even more easier.
_________________
|
|
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
|
|