-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Command 2054 - Get ID By Name #3214
base: master
Are you sure you want to change the base?
Conversation
Through it you can store the ID of a database asset through by searching for its name. Syntax (Maniacs): ```js @raw 2054, "", // name to search 0, 11, // type of database Asset 0, 5, // variable where it will be stored 0, 0, // Min Range 0, 0, // maxRange 1, 1 // use stringVar `` New Command 2054 - Get ID By Name Through it you can store the ID of a database asset through by searching for its name. Syntax (Maniacs): ```js @raw 2054, "", // name to search 0, 11, // type of database Asset 0, 5, // variable where it will be stored 0, 0, // Min Range 0, 0, // maxRange 1, 1 // use stringVar ``
It mirrors ManiacPatch::GetLcfName structure. Update game_interpreter.cpp
7cc2164
to
e04a433
Compare
How do you plan to handle translatable strings? Some of them will require a search via the translated string when a translation is loaded and others are not translatable (not exposed by lcftrans). A string translation must happen here and we actually have a problem: We rewrite all strings on load. Here the string has different meanings based on the context so is the first time where this cannot be used. 🤔 |
I forgot about those... Would be hard to have an extra entry called |
There is no simple way to get the original because we really overwrite them completely. You must translate your string and do the lookup. Have to check if we have an API already for this... |
Yes this is solvable, just needs a few more Getters. What is also interesting (?) is that the command can use String Vars and String Vars are only active when Maniac Patch is on. I will encounter the same issue soon with my "Language Config" event command which allows altering the active translation and... needs string vars for the getter part 😅 |
question: would be better to move here the code from this pr: #3124 ? Seems better fitted than editing control variables. |
This command allows you to store the ID of a database asset by searching for its name.
The syntax always comes in pairs. The first parameter of each pair indicates whether you are using a direct value or a variable/indirect variable, through ValueOrVariable().
Syntax (TPC):
@Ghabry and @carstene1ns commented about hashing the data for better searching and retrieving data by name.
https://github.com/greg7mdp/parallel-hashmap
But this may look good enough for a first version (it's fast enough with the 9999 variables limit from vanilla).