Dictionary ids: explicit vs implicit #175
Closed
exectails
started this conversation in
Discussions
Replies: 3 comments
-
Example: 079db72 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Not much of a con anymore if we do #103. |
Beta Was this translation helpful? Give feedback.
0 replies
-
This discussion has become obsolete with the decision to go with primarily server-sided dialog (#173). |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Here's the current function for Equipment Merchant Dunkel in Klaipeda:
Generally I like what I'm seeing, nselect, the if/else, all looks fine. However, there's the
dicID
s. For the client to recognize the id and convert it to a string from the localization dictionary this code is necessary:@dicID_^*$<id>$*^
This is the case for all dictionary ids, but for NPC names we hide that code, the key is wrapped in it behind the scenes.
ETC_20150317_009196
becomes@dicID_^*$ETC_20150317_009196$*^
when sent to the client.This is a lot of boilerplate that's hard to remember and basically not necessary. We can wrap the options of a select as well. The question is, should we actually hide that completely?
The dictionary ids aren't the only codes, as you can see above.
!@#$Auto_JongLyo#@!
is the code for a localized End or Cancel. (Since it's not a dictionary id I assume Auto does more than that.)Hiding the wrap could result in confusing situations, unless you know every function and its implementation. You can't really be sure which functions convert the strings and which don't, does it convert every id in the string or only the entire string if it looks like an id, is there a shortcut for the other codes as well or not?
An alternative could be to add helper functions in a global script. For example:
This way it's much easier to remember, the implementation and what happens can be looked up without checking the core, and there's no ambiguity. One downside is that you have to concatenate strings if you need more than just the id.
Or, there needs to be another help function.
The advantages of this are explicitness and that it's less likely to make mistakes with all the codes. I can't really think of any actual disadvantages right now.
Beta Was this translation helpful? Give feedback.
All reactions