In rewriting Mazzy the Paladin, I'm thinking about offering different dialogue styles (4th wall breaking and non 4th wall breaking). Also, I'd like to offer also the choice of paladin kit at install time (should mazzy become a Cavalier, Inquisitor, etc.).
Using regular SUBCOMPONENTS, i'd need to use something like this group of subcomponents:
BEGIN ~4th wall breaking dialogues: Trueclass~
SUBCOMPONENT ~Mazzy the Paladin~
COMPILE ~mtp/stupid_dial/truecl~
{other 200 lines of install}
BEGIN ~4th wall breaking dialogues: Cavalier~
SUBCOMPONENT ~Mazzy the Paladin~
COMPILE ~mtp/stupid_dial/cavalier~
{other 200 lines of install}
BEGIN ~roleplaying dialogues: Trueclass~
SUBCOMPONENT ~Mazzy the Paladin~
COMPILE ~mtp/rp_dial/truecl~
{other 200 lines of install}
BEGIN ~roleplaying dialogues: Cavalier~
SUBCOMPONENT ~Mazzy the Paladin~
COMPILE ~mtp/rp_dial/cavalier~
{other 200 lines of install}
Etc.
Of course, this means I'll have to repeat the 200 lines of install over and over. This increases exponentially if I were to add multiple portraits or other stuff.
What I'd like to have is a subcomponent n-array:
BEGIN_ARRAY #2 ~Mazzy the Paladin~
[optional: PROCESS_LAST]
//flags0
//actions0
BEGIN_ARRAY_LEVEL #1 ~Choose the style of your dialogues~
BEGIN_ARRAY_LEVEL #2 ~Choose Mazzy's kit~
BEGIN_ARRAY_ELEMENT #1 ~Old Style dialogues~
//flags1
//actions1
END_ARRAY_ELEMENT
BEGIN_ARRAY_ELEMENT #1 ~New Style Dialogues~
//flags2
//actions2
END_ARRAY_ELEMENT
BEGIN_ARRAY_ELEMENT #2 ~Trueclass~
// flags3
//actions3
END_ARRAY_ELEMENT
BEGIN_ARRAY_ELEMENT #2 ~Cavalier~
// flags4
//actions4
END_ARRAY_ELEMENT
END_ARRAY
BEGIN_ARRAY #a would be the new component, which contains a a-dimensional array of subcomponents. Any instructions following this are common to all elements of the array.
The optional PROCESS_LAST means that the common instructions are to be processed last, instead than first.
BEGIN_ARRAY_LEVEL #b defines the name of the b-th dimension.
BEGIN_ARRAY_ELEMENT #c defines a possible choice for the c-th dimension and the relative instructions.
The components would then be equivalent to:
BEGIN ~Mazzy the Paladin: Old Style Dialogues: Trueclass~
flag0
flag1
flag3
action0
action1
action3
BEGIN ~Mazzy the Paladin: Old Style Dialogues: Cavalier~
flag0
flag1
flag4
action0
action1
action4
BEGIN ~Mazzy the Paladin: New Style Dialogues: Trueclass~
flag0
flag2
flag3
action0
action2
action3
BEGIN ~Mazzy the Paladin: New Style Dialogues: Cavalier~
flag0
flag2
flag4
action0
action2
action4
This is how it should be presented: The user is presented with
Install component: Mazzy the Paladin
[Y]es, [N]o, [Q]uit
If user chooses yes, then he will be presented with
Choose the Style of dialogues:
1] Old Style Dialogues
2] New Style Dialogues
Then there will be the choice
Choose Mazzy's kit:
1] Trueclass
2] Cavalier
After last array's dimension is chosen, the relative component is installed.
Example of use of PROCESS_LAST: a mod to reduce creature's XP by a percent, to the choice of installer (SimDing0's mod, EG)
BEGIN_ARRAY #1 ~Experience Fixer~
PROCESS_LAST
XP = XP * reduction_rate / 100
BEGIN_ARRAY_LEVEL #1 ~Choose reduction level:~
BEGIN_ARRAY_ELEMENT #1 ~50%~
SET reduction_rate = 50
END_ARRAY_ELEMENT
BEGIN_ARRAY_ELEMENT #1 ~10%~
SET reduction_rate = 10
END_ARRAY_ELEMENT
END_ARRAY
the actions in the array element chosen sets reduction_rate, which is then processed by the main component to reduce the XP.
As far as component count goes, this would be a single component, which is then detailed as EG #0.2.1, where 0 is the component number and 2.1 are the coordinates I chose, starting from 1 instead from 0. This way, I can use
REQUIRE_COMPONENT ~Setup-MazzyThePaladin.tp2~ #0.0.1, where the 2nd 0 is a cutoff, to see if, in component 0, dimension 2 = 1 and dimension 1 is ininfluent.
Weidu.log would contain
~Setup-MazzyThePaladin.tp2~ #0 #0.0.1 // ~Mazzy the Paladin: New Style Dialogues: Trueclass~
I hope this wasn't extremely confusing, and that it's possible to code without a complete rewrite
Anyway, thanks in advance