Ryan wrote:veryalien wrote:Is there any way to force a particular group entry without it being a random result? My brain says that Instead of just using Animal; to always get a random entry from the Animal group, a simple extension would be Animal; to always access entry 2 in the group. Sorry if that's already possible, if it is I didn't find it yet. Maybe this is already possible using other methods?
This isn't currently possible as a built-in function - the way to achieve the effect, if desired, would probably be to add numbered labels to each entry in a group and then use a label reference to return the desired result.
I have to admit that I'm not sure I can think of any obvious use for this type of functionality, though? If you already know the result you want to return, would it not be easier to simply include it as text, rather than via a reference?
I was looking for a way to consistently use a reference to the same text, but be able to use the group entries randomly when needed. Preferably without hard-coding any of the texts.
For example days of the week, months of the year and signs of the zodiac. They all have a particular order within their 'groupings', but you can refer to each individual instance of an element in a random order. You might want to generate a weekly plan running exactly from Monday, Tuesday, Wednesday ... through to Sunday. But somewhere else a random day of the week is used. Or a yearly almanac running exactly from January, February ... to December and then referring to random days within random months. I was actually thinking of automatically generating the groups from some other data and it would be more convenient and elegant to re-use the texts instead of hard-coding anything.
Ryan wrote:veryalien wrote:Automatically stepping through all group entries in an ordered sequence each time a group is accessed would also be a nice feature. Regnus keeps an index of which entry was last accessed and returns the next one in the sequence.
Again, I'm not sure I can think of an obvious use for this, since you're achieving a non-random result? It's already possible to ensure the return of every entry in a group in a random order, but if the object is to return the entries in a set order, would it not be simpler to just add those entries directly to the content, rather than via a reference?
If the aim is to ensure that three selected entries remain in the same order once generated, you could do something like this:
Code: Select all
ENTRY <Repeat Three Names In The Same Order>#>(0):(#&Names;, #&Names; and #&Names;); always referred to themselves in the same order: ##;.
Like the examples above, regarding order in a group, even 'Tom, Dick and Harry' has soon kind of order to it. Harry, Tom and Dick (even when consistent) isn't really what I was looking for. But, as you mentioned, you might as well just write every Tom, Dick and Harry as plain text as there isn't anything random or dynamic there. However, thanks for your eyample, I did one tweak on that to put each name in a separate store. You could then consistently refer to the initially generated order by using the stores ##;, ##; and ##; together or individually. If you had some lists containing various aspects of Dick, Harry and Tom you could separately, but consistently, refer to the Tom list, Harry list and Dick list, just by using the individual stores.
Code: Select all
ENTRY <Repeat Three Names In The Same Order>#>(0):(#&Names;);, #>(1):(#&Names;); and #>(2):(#&Names;); always referred to themselves in the same order: ##;, ##; and ##;.