
1) A "DRAFT" qualifier adding "include" functionality (not to be supported in Regnus 5.5)
A suggestion originally mooted for the 5.4 specification is some form of "include" functionality, which would work in a similar way to other programming and scripting languages, in that it would cause an external script to be included in the current script and treated as a single script.
It is already possible, of course, to use the $ RTC to reference content in external scripts, and this already allows for all of the functionality which an include function would provide. However, the subtle difference is that using a reference creates and additional recursion and returns fully processed parsed content from an external script, as the two individual scripts are effectively "blind" to each other's contents. An include function would actually cause the external script to be loaded into memory as if it was part of the current script, meaning that its groups would be accessible in all the usual ways, without having to create handler labels in the second script to grant access to its content.
The proposed syntax for this function would be:
Code: Select all
DRAFT path/filename.rsf
This would be relatively easy to implement, but might not be desirable as it essentially duplicates (though in a simplified fashion) existing functionality, and also, would potentially cause issues as the included script would not necessarily be complete and valid, and would cause duplicate metadata qualifiers if it were to be a complete valid script. External scripts in this case would be more likely script "fragments" containing only groups of entries with no labels, for instance, so it may be necessary for simplicity of debugging to include new metadata and specify that a particular file is deliberately a fragment rather than a complete script.
Another issue that would be important to consider would be how this new qualifier would behave depending on where placed within a script. One implementation would be that, no matter where placed, the qualifier would append the given fragment to the end of the script, meaning that all groups within the fragment would need to be complete. Another implementation would be to allow fragment files to be inserted directly into certain points within a script, allowing (for example) additional entries to be inserted directly into groups. This would be powerful, but would also be more difficult to implement. A third option would be to allow selective importing of data from an external script. For example, only the external script's groups might be imported (or even specific groups?), with all labels stripped, allowing lists of data to be imported from complete external scripts and thus also solving the issue of the functionality requiring the creation of "fragment" scripts as discussed above.
Another important consideration regarding this proposed functionality is that it would almost certainly add additional loading time to scripts which don't even use drafting, and would add a level of complexity to the language which might be undesirable given that it adds a minor convenience for some authors, but no new functionality.
2) A new type of expression to allow inline entry selection! (implemented!)
Currently, Regnus has three types of expression: the group expression, the literal expression, and the slot expression, each of which can be used in any reference to return text in a particular way. A literal expression (enclosed in parantheses) returns the given text or phrase, parsed, allowing nested references; the slot expression (enclosed in square brackets) returns the content stored in the given slot number (specified as a numeric value, or as a named variable defined by a REFER qualifier); and the group expression (unenclosed) returns an entry selected from the specified group.
This last type of expression is very powerful, and is essentially the core of Regnus' capabilities, but is sometimes heavy-handed for simple selections. When using a reference to choose between only a few short words, the additional work of setting up a separate group to contain these sometimes feels a little arduous for a minor level of randomisation which will only be used once in a script. For example, see the following script:
Code: Select all
GROUP FirstGroup
ENTRY <Example>I have ##SecondGroup; bananas.
GROUP SecondGroup
ENTRY some
ENTRY no
The suggested new expression type would allow the two entries from "SecondGroup" to be included inline in the labelled entry. For example:
Code: Select all
GROUP FirstGroup
ENTRY <Example>I have ##{some¦no}; bananas.
And of course, as this is an expression type, it would be usable with all other RTCs. For example:
Code: Select all
GROUP FirstGroup
ENTRY <Example>I have #>(0):{some¦no}; bananas; ##[0]; bananas have I!
Consideration should be given when implementing this feature as to whether the contained text should itself be parsed; and if so, how this should be allowed, and what additional complications or issues might arise. For example:
Code: Select all
GROUP FirstGroup
ENTRY <Example>I have ##{##SecondGroup;¦##ThirdGroup;¦##FourthGroup;}; bananas.
GROUP SecondGroup
ENTRY some
ENTRY no
GROUP ThirdGroup
ENTRY excellent
ENTRY enormous
ENTRY fantastic
GROUP FourthGroup
ENTRY yellow
ENTRY green
ENTRY pink
Or even:
Code: Select all
GROUP FirstGroup
ENTRY <Example>I have ##{##SecondGroup; ##ThirdGroup;¦##SecondGroup; ##FourthGroup;}; bananas.
GROUP SecondGroup
ENTRY some
ENTRY no
GROUP ThirdGroup
ENTRY excellent
ENTRY enormous
ENTRY fantastic
GROUP FourthGroup
ENTRY yellow
ENTRY green
ENTRY pink
One question is whether an entirely new expression type would be the best approach (as above), or whether it would be more elegant to add this functionality to the existing literal expression type instead? In this case, literal expressions would be treated in the same way as they are currently, but if they contain an unescaped separator character, would be treated as above. Since in the above suggestion, "##{Hello!};" would have the exact same effect as the already-supported "##(Hello!);", this may make more sense. The downsides would be that additional processing overhead would be added to parsing of the existing expression type, and of course, in the unlikely event that the chosen separator character is already used unescaped within literal expressions in existing scripts, these would need to be updated to include escape characters (a very minor point of backwards-compatibility which might not affect a single script).
A further consideration would be whether a mechanism should be implemented to allow entry weighting within these inline groups?
3) A "START" qualifier to extend current labelling capabilities (implemented!)
Currently, parsing of a Regnus script is started from a labelled line within the script, which is very powerful and flexible, but does lead to a certain amount of over-complexity, and often requires the creation of dummy groups in simple scripts. For example:
Code: Select all
GROUP StartGroup
ENTRY <Greeting>##Greetings;! My name is Elvis.
GROUP Greetings
ENTRY Hello
ENTRY Goodbye
This proposal would be for a new qualifier which would allow a start point to be specified without the creation of a containing group, allowing this script to be simplified to:
Code: Select all
START Greeting:##Greetings;! My name is Elvis.
GROUP Greetings
ENTRY Hello
ENTRY Goodbye
Or perhaps instead with the syntax:
Code: Select all
START <Example>Hello world!
4) The ability to use fractional values in entry weighting (implemented!)
This would allow the use of entry weighting to reduce rather than increase the chance of a particular entry being selected. For example:
Code: Select all
GROUP Cats
ENTRY tiger
ENTRY lion
RATIO 2:panther
RATIO 0.5:felis silvestris lybica
Here, the first two entries would each have a selection probability of 2/9, the third would have a probability of 4/9, and the final entry would have a probability of 1/9.
This would be useful in cases where an entry is to be added to an existing large group, for which it is desirable to assign a lower probability without the need to increase the ratios of all other entries in the group.
5) Functionality for simply generating random numerical values (implemented!)
It is currently possible to select random numbers from a group using Regnus, or even to assemble larger numbers from individual digits, but there is currently no simple functionality for generating random numbers within specific ranges or with specific probabilities, which would be useful (particularly when using a Regnus script to generate random encounter charts for RPGs etc.), and make for less complex script structures and therefore more readable code.
The proposal would be to add a new expression type whose contents would be parsed as a form of micro-syntax within Regnus, very possibly based on existing dice notation. So, for example:
Code: Select all
GROUP Examples
ENTRY A single four-sided die: ##{D4};
ENTRY Four six-sided dice: ##{4D6};
ENTRY Store the result of two ten-sided dice plus two in slot number five: #>(5):{2D10+2};
Note: the example above uses the same bracket type as one of the suggested forms for inline selection in suggestion #2, above, but this is just for simplicity of explanation; assuming both are implemented, they will of course need to use different syntax!
6) A way to specify entries whose content is entirely or partially escaped (not to be supported in Regnus 5.5)
Usually, the overstep AGC can be used to escape characters within an entry which would usually be understood (and therefore processed) by the parser as AGCs or other reserved characters. However, in scripts with a large amount of pre-formatted text containing a number of reserved characters, and little need for AGC functionality (particularly when using Regnus to generate (X)HTML, for example), this can be time-consuming and lead to convoluted code. Therefore, this suggestion is for a method of notating that a particular entry should not be parsed.
One possible solution would be to add a modifier to existing qualifiers to notate that they should not be parsed. For example:
Code: Select all
GROUP Examples
ENTRY This entry is parsed, thus *<strong>these instances of markup*</strong> need to be escaped with the ** character.
ENTRY! This entry is not parsed, thus <strong>this markup</strong> does not need to use the * character.
RATIO! 2:This entry has a 50% chance of being selected, and is also not parsed, thus <strong>this markup is <em>also</em></strong> unescaped.
One consideration is whether the effect of this format should be to cause the entry to be completely unparsed (including all references, etc.), or whether only AGCs, labels, or other specific reserved characters should be ignored? Perhaps multiple modifiers could be introduced to attain these results where appropriate?
Another consideration would be whether the overstep character could be used in unparsed entries for the reverse effect of allowing the parsing of a following reserved character?
Perhaps a new RTC could also be added which forces this effect on an entry which isn't otherwise marked as unparsed? Another possibility is that such an RTC could be used instead of specifying at the qualifier level.