Neanka / MCM_0.1_AS3

35 stars 6 forks source link

Define an options list as a standalone json element. #38

Closed Scrivener07 closed 5 years ago

Scrivener07 commented 5 years ago

I have been working on a configuration menu that acts as a sort of preset editor. Almost all my controls use the same few list of options, over and over again. This is highly tedious and error prone to make changes to the option list. May I suggest an enhancement to add an options list as a standalone definable json element. It would be very convenient to define an options list in one place and use it in many others.

Here is my json that demonstrates the challenge well. The bulk of the json document is the same three lists. https://github.com/Scrivener07/FO4_ODST/blob/7c901d239275ae5402c194b3de2906479d47a3ec/Data.Prototype/MCM/Config/ODST/config.json

Decal Foreground

"options":
[
    "Blank",
    "117",
    "Active Rooster",
    "Arrowhead",
    "Assassin",
    "Bulletproof",
    "Cone",
    "Covenant",
    "Cup Of Death",
    "Grenade",
    "Guilty",
    "Headshot",
    "Infected",
    "LASO",
    "Mjolnir",
    "Noble",
    "ONI",
    "On Your Shield",
    "Planetary",
    "Seven",
    "Sinner",
    "Spartan",
    "Spartan Helmet",
    "Splatter",
    "Superintendent",
    "Unicorn",
    "Valkyrie",
    "Wolf",
    "Ying Yang"
]

Decal Background

"options":
[
    "Blank",
    "4 Diamonds",
    "Asterisk",
    "BallOFire",
    "Blank One",
    "Cancel",
    "Chevron",
    "Circle",
    "Cog",
    "Cowboy Hat",
    "Criss Cross",
    "Crown",
    "Diamond",
    "Display",
    "Hexagon",
    "Horizontal Stripes",
    "Limited",
    "Power",
    "Shield",
    "Star",
    "Structure",
    "Vortex"
]

Colors

"options":
[
    "Black",
    "Silver",
    "Steel",
    "White",
    "Mauve",
    "Red",
    "Salmon",
    "Coral",
    "Orange",
    "Peach",
    "Gold",
    "Pale",
    "Yellow",
    "Green",
    "Olive",
    "Sage",
    "Aqua",
    "Cyan",
    "Teal",
    "Blue",
    "Cobalt",
    "Sapphire",
    "Lavendar",
    "Orchid",
    "Violet",
    "Crimson",
    "Pink",
    "Rubine",
    "Brown",
    "Khaki",
    "Tan"
]
Neanka commented 5 years ago

what if it will read from esp? kinda esp have formlist of (any) forms with fullnames? or just one form with fullname in format 1st list option|2nd list option|etc? it could support both variants

Scrivener07 commented 5 years ago

A FormList sounds nice and easy to use. Ultimately I just need a list of string names. If I can fill a FormList with Message form and have the Name of each rendered in MCM, that would be awesome.

DaJay42 commented 5 years ago

In that case, would a String[] Property pulled from a script not be easier and potentially more useful? This would greatly simplify cases where the values are dynamic/not known in advance.

Neanka commented 5 years ago

In that case, would a String[] Property pulled from a script not be easier and potentially more useful? This would greatly simplify cases where the values are dynamic/not known in advance.

i dont like hardcoded strings in scripts tbh

DaJay42 commented 5 years ago

i dont like hardcoded strings in scripts tbh

Having an easy way to access strings that are NOT hardcoded (anywhere) was kinda my point though.

Scrivener07 commented 5 years ago

The problem with Papyrus strings is that they do not support localization. Any text intended to be displayed to the user should be predefined in a Message form when possible. Thats one point about papyrus strings.

DaJay42 commented 5 years ago

Ah, that didn't even occur to me. Still, if I had to chose between localization and being able to dynamically display something like, for example, "the name of the currently equipped weapon" or "the name of the current location", I'd chose the latter in a heartbeat. Though I say that simply because localisation is of no real concern to me, so I'm aware that that is quite selfish...

TanookiSama commented 5 years ago

@DaJay42 well, in a pinch, you could always SetName() the Message Form in question.

DaJay42 commented 5 years ago

If that works, I suppose that's a good enough workaround. That's a lot of overhead to display some strings though, both coding- and performance-wise.

TanookiSama commented 5 years ago

I guess, but its certainly less ridiculously hacky than my current approach, which is to rewrite config.json on-the-fly whenever I need to change a string...

Neanka commented 5 years ago

next update will allow get list from shared json lists, from listform or even fron String[] property