-
Notifications
You must be signed in to change notification settings - Fork 164
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
Add hud-set-xstr sexp #6406
base: master
Are you sure you want to change the base?
Add hud-set-xstr sexp #6406
Conversation
@@ -682,6 +682,7 @@ SCP_vector<sexp_oper> Operators = { | |||
{ "hud-set-custom-gauge-active", OP_HUD_SET_CUSTOM_GAUGE_ACTIVE, 2, INT_MAX, SEXP_ACTION_OPERATOR, }, | |||
{ "hud-set-builtin-gauge-active", OP_HUD_SET_BUILTIN_GAUGE_ACTIVE, 2, INT_MAX, SEXP_ACTION_OPERATOR, }, | |||
{ "hud-set-text", OP_HUD_SET_TEXT, 2, 2, SEXP_ACTION_OPERATOR, }, //WMCoolmon | |||
{ "hud-set-xstr", OP_HUD_SET_XSTR, 3, 3, SEXP_ACTION_OPERATOR, }, //MjnMixael |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick fix! Just one last thing I was pondering, it looked like all the other -xstr
related sexps have -xstr
appended to the end of the original name, so I was just wondering what your thoughts on doing the same here (ie
having the name be hud-set-text-xstr
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll be honest, my reasons are entirely selfish... using hud-set-xstr will in-place replace all of BtA's Lua hud-set-xstr
SEXPs that turned out to be buggy which is why an in-engine solution was preferred.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:D :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just as a potential thought another way is to use the deprecation string replace in get_sexp()
(like remove-weapons
and clear-weapons
)
Anyhow, I'm always a sucker for internal consistency such as using hud-set-text-xstr
but certainly won't hold up the PR over it :D
There is precedent in the sexp system for xstr specific sexps with modify-variable-xstr, tech-add-intel-xstr, tech-remove-intel-xstr, etc. This adds hud-set-xstr, a version of hud-set-text, allowing to assign a string and id to a hud gauge while also performing key token and variable translation.
I also took the liberty of adding key token translation to hud-set-message because it really probably should be, but I'm not hard set on that... but I think anyone using$alt-j$ in their message text probably really expects that to be translated to the bound key.