Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

MjnMixael
Copy link
Contributor

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.

@MjnMixael MjnMixael added the Requested by Active Mod A feature request that has been requested by a mod that is actively in development. label Oct 29, 2024
@@ -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
Copy link
Member

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)?

Copy link
Contributor Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:D :D

Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Requested by Active Mod A feature request that has been requested by a mod that is actively in development.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants