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 


[Resolved]Central Dropdown Selection List Possible?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Bosparan
Cheater
Reputation: 1

Joined: 30 Apr 2015
Posts: 36

PostPosted: Mon Jan 02, 2017 9:43 am    Post subject: [Resolved]Central Dropdown Selection List Possible? Reply with quote

Hi,

is there a way in Cheat Engine to create and maintain a central list of Dropdown Selection options?

Example:
A game has a hundred skills. Each of these 100 skill structures have a 4-byte numeric value that represents the Element of the skill (Let's say: Normal, Fire, Water, Earth and Wind). This is a perfect case to use such a Dropdown Selection list, allowing the final table user to select text that means something for him, instead of dealing with numbers.

With my current (non-too-impressive) CE skills, I'd need to manually add that Dropdown List to all Skills. And if I later figured out there also were "Light" and "Dark" elements, I'd need to go back and fix each manually again ...
Is there any way to provide a central list and simply link it to individual values?

Currently, I'm helping myself by generating the table XML using PowerShell, but that adds significant complexity to the development and the final table will be rather ... large (I've produced tables that were more than 5MB big, which makes them troublesome to share on the cheatengine forums. Example: 100 Character slots, each has 5 Equipment slots, each of which has (the same) 400 Options - that's a total of 200,000 lines of options in the XML).

Cheers,
Bosparan


Last edited by Bosparan on Mon Jan 02, 2017 5:09 pm; edited 1 time in total
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 62

Joined: 01 Oct 2008
Posts: 958

PostPosted: Mon Jan 02, 2017 10:14 am    Post subject: Reply with quote

May be related http://forum.cheatengine.org/viewtopic.php?p=5672162#5658788

bye~

_________________
- Retarded.
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Mon Jan 02, 2017 10:41 am    Post subject: This post has 1 review(s) Reply with quote

Unfortunately CE doesn't have global Dropdown List. But, you can use a Lua trick to create something similar. Virtual global dropdown list.

Normally, dropdown list is a collection of "number:description" (e.g. "2:two") pairs.
You can write down there anything you want, e.g.:
Code:
2:two
3:three
4:four
5:five
6:six



But also you can use garbage too:
Code:
loremipsum1
garbage1
garbage2
loremipsum2
loremipsum3


Selecting anything from above will yeld "could not be parsed".
But we can write a unique name of our "virtual global dropdown list" there.

For example "mydropdownlist". Use the same thing for each entry.


Add new entry to the table (AA script), and use this:

Code:
[ENABLE]
{$Lua}
local function addDropDownList(list, listName, ...)
  local DropDownReadOnly,DropDownDescriptionOnly,DisplayAsDropDownListItem=...

  local al=getAddressList()
  for i=0,al.Count-1 do
    if al[i].DropDownList.Text:match(listName) then
       al[i].DropDownList.Text = list
       al[i].DropDownReadOnly=DropDownReadOnly
       al[i].DropDownDescriptionOnly=DropDownDescriptionOnly
       al[i].DisplayAsDropDownListItem=DisplayAsDropDownListItem
    end
  end
end


local aList=[[
1:Normal
2:Fire
3:Water
4:Earth
5:Wind]]

addDropDownList( aList, "mydropdownlist", true, false, true)
{$Asm}

[DISABLE]



The aList contains all lines you normally use in Dropdown List. It's our virtual global dropdown list.

addDropDownList function will set this virtual global dropdown list to all memory records which have dropdown list with line "mydropdownlist"

addDropDownList( aList, "mydropdownlist", true, false, true)

those three last parameters are:
disallow manual user input - set to true
only show the description part - set to false
make the record display values like the dropdown list - set to true



example.ct
 Description:

Download
 Filename:  example.ct
 Filesize:  9.1 KB
 Downloaded:  977 Time(s)


_________________
Back to top
View user's profile Send private message MSN Messenger
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Mon Jan 02, 2017 11:22 am    Post subject: Reply with quote

If your list is really big, you can include a text file with the table so that it gets compressed.
This will populate a list with each line of an included table file called "dropdown.txt".
Code:
local dropdown = findTableFile("dropdown.txt")
local stream = dropdown.Stream
local value = createStringStream()
value.copyFrom(stream, stream.Size)
value = value.DataString

local aList = {}
local function helper(line) table.insert(aList, line) return "" end
helper((value:gsub("(.-)\r?\n", helper)))

-- aList is now populated
Back to top
View user's profile Send private message
Bosparan
Cheater
Reputation: 1

Joined: 30 Apr 2015
Posts: 36

PostPosted: Mon Jan 02, 2017 5:09 pm    Post subject: Reply with quote

@mgr.inz.Player: Thank you for your solution, this looks like a perfect fit, thank you so much for your aid.

@Zanzer: Interesting solution to import from a file, thank you for sharing. I try to maintain all within a single table file, but it really might come in handy for the seriously overblown files (a certain list of 400 items comes to mind ...). Either way, a good technique to add to my knowledgebase, thanks.

Edit:
I ended up building the entire table dynamically in lua, since it was just more economical to add new features (e.g.: Adding a new stat on all characters can be done with adding a single line). Here's the finished table:
http://forum.cheatengine.org/viewtopic.php?p=5712003#5712003
(Grab the latest version)
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 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