Script modification : any idea what I screwed up?

Started by Monsieur OUXX, Wed 04/07/2018 15:08:43

Previous topic - Next topic

Monsieur OUXX

EDIT: as expected it was a ridiculous copy and paste mistake
 

Crimson Wizard

#1
I know this is not what you are asking about, and TBH I am not using that module so that's just a passer-by's opinion, but using arrays with enums instead of distinct variables look so inconvenient... You are loosing explicit variable types that way and prevent possibility of adding a setting of non-integer type (among other less important things).

For example, "text_align" variable could have type of Alignment, declaring its meaning and possible range of values, and also you get autocomplete hints when setting it. With all-ints arrays you cannot do that.

Could I suggest to instead split these variables into several structs? Like CustomDialogTextParams, CustomDialogLayoutParams etc.
You may even implement these as managed structs, then store their pointers inside bigger CustomDialogGui, if that's desired, and perform similar operations with applying and returning settings too.

Monsieur OUXX

#2
EDIT : as expected it was some ridiculous copy and paste mistake.

Spoiler

Quote from: Crimson Wizard on Wed 04/07/2018 15:41:23
I know this is not what you are asking about, and TBH I am not using that module so that's just a passer-by's opinion, but using arrays with enums instead of distinct variables look so inconvenient...

Yup, but there's something that you don't know because I didn't explain my plan: These arrays can then be manipulated in an abstract manner through Ultravariables (or similar module), and each value can be given a name which can be displayed on screen at any time. More settings can be added without having to duplicate accessors many times. Simply think of it as a poor man's XML settings file, except it's flat (array). Since AGS script is not reflexive, that's my way of manipulating objects members in a weakly-typed manner, and add some dynamically, as you would do in Javascript or Powershell. I'm not going over the top though : I'm only doing it for settings, not for critical, internal values.
[close]
 

SMF spam blocked by CleanTalk