Lemmings Forums

NeoLemmix => Bugs & Suggestions => Closed => Topic started by: namida on September 05, 2019, 09:02:03 PM

Title: [SUG][PLAYER] Hotkey placeholders in pre/post texts.
Post by: namida on September 05, 2019, 09:02:03 PM
This is mostly for the sake of the NeoLemmix Introduction Pack, and is supported for postview texts purely on the basis of "it would be extra work to specifically not allow it there, compared to just allowing it on both sides".

But yeah - IchoTolot wants to mention what hotkeys are in the intro texts. Fair enough - but the issue is that there are multiple default hotkey setups one can choose from, as well as the possibility of custom hotkeys. This means that any hard-written text is not guaranteed to be correct.

Therefore, here's a feature that will help with that!

As an example, I can have the following in an NXLV file:

Code: [Select]
$PRETEXT
   LINE Back skip: [HOTKEY:SKIP-]
   LINE Forward skip: [HOTKEY:SKIP+]
   LINE Pause: [HOTKEY:PAUSE]
   LINE Fart: [HOTKEY:FART]
   LINE Back One: [HOTKEY:SKIP:-1]
   LINE To Shrugger: [HOTKEY:SPECIAL_SKIP:NEXTSHRUG]
 $END

"SKIP-" and "SKIP+" are special values that will list any fixed-duration (ie: not the "to next shrugger" etc) backwards or forwards skip key respectively, regardless of duration. Aside from those two special cases, the key words are exactly the same as in the hotkey INI file in the "Settings" directory. The text outside of the [ ] brackets is just interpreted as normal text, just like it currently is.

The result of the above is as shown in the attached screenshot. Obviously - intended use case would be similar to this, with a dedicated line to list hotkeys. The actual text body would simply mention "hotkeys exist" or something. This avoids the need to either write text that can adapt to any number of hotkeys, or write code that somehow determines just a single one of the various options to display.

Not shown in screenshot: If a function has no hotkey assigned, the placeholder will be replaced with {No Hotkey Assigned}.
Title: Re: [SUG][PLAYER] Hotkey placeholders in pre/post texts.
Post by: namida on September 06, 2019, 05:06:07 AM
For the record: I wrote this in a way that can fairly easily be expanded, if there's ever a need to support other similar tags in preview / postview texts. So if you've got other suggestions - with actual good use cases for them, not just "this would be a cool feature" - feel free to make them.
Title: Re: [SUG][PLAYER] Hotkey placeholders in pre/post texts.
Post by: namida on September 09, 2019, 12:46:59 AM
V12.6.5 includes this feature, although there's no reason it can't be further improved if ideas arise so I'll leave this topic open for now.
Title: Re: [SUG][PLAYER] Hotkey placeholders in pre/post texts.
Post by: Proxima on September 15, 2019, 03:06:45 PM
Already mentioned in discord, but I wanted to leave a permanent note: I suggest "None" rather than "No Hotkey Assigned". Just in case. :P
Title: Re: [SUG][PLAYER] Hotkey placeholders in pre/post texts.
Post by: namida on September 26, 2019, 12:58:31 AM
I wondered if "None" might not be clear enough. If no one feels that's a concern, I can definitely change it.

EDIT: Changed in commit 12186F7. I can change it back if anyone does have concerns re: above.
Title: Re: [SUG][PLAYER] Hotkey placeholders in pre/post texts.
Post by: namida on December 14, 2019, 10:38:23 PM
Seems there's no further input on this, so closing this topic now. If anyone does want to make further requests / suggestions relating to this feature, please open a new topic.