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 


How do I create a combo box dropdown list trainer?

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

Joined: 10 Oct 2015
Posts: 38

PostPosted: Wed Mar 15, 2017 9:02 pm    Post subject: How do I create a combo box dropdown list trainer? Reply with quote

Hello

I'm rather new to the whole concept of LUA scripting, and haven't had much dedication towards learning C# lately, but I'd like to be able to create a combo box dropdown list (multiple combo boxes) that allows one to open a list of moves - (fighting moves in Dragon Ball Xenoverse 2), so it would serve the purpose of allowing the user to select a move they want from the list, and as soon as they have selected that move, it would automatically update the "pointer address" that I have assigned to it, along with the 2 byte code that I'd like for it to replace, eg: "0015", "3E8B" in each of the individual options on the dropdown list assosiated with their respective pointer addresses.

For an example, I have all of the (pointers) in Cheat Engine already, so all I need to know is how to script up a working combo box with the trainer creator, as I would prefer this to a hotkey trainer; considering the hotkey trainer requires 0 LUA knowledge, and is not suitable for this project.

Here are the pointers I have currently, and this is what I'd like to create, but as a trainer exe program, instead:

Please can I embarrassingly ask to be spoonfed on exactly how to go about proceeding with this..
Hope this isn't in the wrong section.

Much appreciated!
Back to top
View user's profile Send private message
Corroder
Master Cheater
Reputation: 8

Joined: 10 Apr 2015
Posts: 414

PostPosted: Wed Mar 15, 2017 11:07 pm    Post subject: Reply with quote

Maybe something like this :

Code:
local Mform = createForm()
Mform.Width = 250
Mform.Height = 150
Mform.Position = 'poScreenCenter'
Mform.Caption = 'Dragon Ball'
Mform.Name = 'Mform'

local MoveType = createComboBox(Mform)
MoveType.Top = 20
MoveType.Left = 10
MoveType.Width = Mform.Width - MoveType.Left - 10
MoveType.Style = 'csDropDown'
MoveType.Text = 'Choose a move..'
MoveType.Name = 'MoveType'

local Clabel = createLabel(Mform)
Clabel.Left = 20
Clabel.Top = 60
Clabel.Caption = 'Waiting..'

items = combobox_getItems(MoveType)
strings_add(items, "Choose a move..")
MoveType.ItemIndex = 0

MoveTable = {
{MvName = 'Kamehameha', MvValue = '08 00', MvAdrs = 'blabla1'},
{MvName = 'Bending Kamehameha', MvValue = '3E 00', MvAdrs = 'bla2bla2'},
{MvName = 'Super GF Goku', MvValue = '35 00', MvAdrs = 'blabla3'}
}

for i,v in ipairs(MoveTable) do
 strings_add(items, v.MvName)
end

function MoveTypeOnChange()
 index = getProperty(MoveType, "ItemIndex")
 index = MoveTable[index]

 if index == nil or index == -1 then return end
 if index == 0 then
    writeBytes(index.adrs + wtf, index.MvValue + wtf2) -- doing something here for Kamehamena
    Clabel.Caption = 'Active Move Type - '..index.MvName
 elseif index == 1 then
    writeBytes(index.adrs + wtf, index.MvValue + wtf2)  -- doing something here for Bending Kamehamena
    Clabel.Caption = 'Active Move Type - '..index.MvName
 elseif index == 2 then
    writeBytes(index.adrs + wtf, index.MvValue + wtf2) -- doing something here for Super GF Goku
    Clabel.Caption = 'Active Move Type - '..index.MvName
 end
end

MoveType.onChange = MoveTypeOnChange

Mform.show()


Last edited by Corroder on Thu Mar 16, 2017 1:02 am; edited 1 time in total
Back to top
View user's profile Send private message
CPUzX
Cheater
Reputation: 0

Joined: 10 Oct 2015
Posts: 38

PostPosted: Thu Mar 16, 2017 12:31 am    Post subject: Reply with quote

Thanks for the help!
Would this be the correct way to reference the pointers towards the values "0000" "0100" and "0200"?

Code:
MoveTable = {
{MvName = 'Kamehameha', MvValue = '0000', MvAdrs = 'DBXV2.exe+01087D80+30B8'},
{MvName = 'Bending Kamehameha', MvValue = '0100', MvAdrs = 'DBXV2.exe+01087D80+30B8'},
{MvName = 'Super GF Goku', MvValue = '0200', MvAdrs = 'DBXV2.exe+01087D80+30B8'}
}


As with the limited understanding of this topic, may I ask what is required after doing this in order to proceed, or is it necessary to replace "MvValue" with "1" or "2", due to the 'elseif'

Code:
if index == nil or index == -1 then return end
 if index == 0


Also, is it required to put ] on the end of an offset like this(?)
Code:
'DBXV2.exe+01087D80]+30B8'}

Hopefully this makes sense. Thanks again
Back to top
View user's profile Send private message
Corroder
Master Cheater
Reputation: 8

Joined: 10 Apr 2015
Posts: 414

PostPosted: Thu Mar 16, 2017 1:02 am    Post subject: Reply with quote

Quote:
if index == nil or index == -1 then return end
if index == 0



It's come from : index = getProperty(MoveType, "ItemIndex")


By default a comboBox will have several items and each items will listing by an index. By default first items on comboBox list will have index as integer -1 (except you change that index number to 0 or what ever).

In this case, comboBox we give name as/with "MoveType".
In the list for that comboBox we added from a table we provided and give name to table as "MoveTable" and comboBox list will show like this :

Code:
Choose a move..  --- starting index, initial as -1
Kamehameha   ---- index 0
Bending Kamehameha  ---- index 1
Super GF Goku  --- index 2
..
..
-- till the last index


And the table "MoveTable" also have index number starting from 0, so then we lookup to the table by selected index on comboBox "MoveType" use a function.

Code:
if index == nil or index == -1 then return end  -- doing nothing here
if index == 0  then   -- 2nd item on comboBox list = Kamehamena = index 0 on MoveTable
  -- doing something here for Kamehamena
  writeBytes(.............)  -- direct input or lookup from MoveTable
elseif index = 1 then  -- 3rd item on comboBox list = Bending Kamehamena = index 1 on MoveTable
   -- doing something here for Bending Kamehamena
  writeBytes(.............)  -- direct input or lookup from MoveTable
..
.. -- doing same thing till the last item on the comboBox
end



For writeBytes or add hacks syntax, I am not sure. Let waiting for other members correcting the script.
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