Hints: MenuOrder, TopicOrder and sourceTextOrder

I came up empty in my documentation search for sourceTextOrder implementation in adv3. (Suspiciously, even grep’ing the code!) I am trying to order my hint system with it by

modify HintMenuObject
    // Should propagate to Goals, Hint Menus and HintLongTopicItems
	topicOrder = (sourceTextOrder) // to better control narrative flow
;

This mod appears to be ignored or at best unevenly applied. Usually it is just the alphabetical default. Behavior does not change if I set directly in the children.

Anyone played with this have some insights? Just cleared several PUNISHING deep dive debugs, and figured I’d ask first this time. As a change of pace.

EDIT: should have mentioned, based on debug prints, the orders seem to be getting set just fine. Just not always sorted according to them for whatever reason

2 Likes

So you’re saying, the HintMenuObjects are getting correctly assigned their sourceTextOrder values, but they’re not displayed in a sorted fashion even so?

1 Like

The sourceTextOrder property is added to each instantiated object by the compiler, with the counter being reset for each separate source module… is that what you were wondering?

1 Like

All of the wished-to-be-sorted objects in question are definitely contained in a HintMenu? That seems to be the only class that sorts its contents by topicOrder, as opposed to menuOrder or something else…

1 Like

I went ahead and set both, but you’re right, I could only find methods that worked on topicOrder for hints. There is a nuance worth mentioning. Because of the… eclectic… nature of my hint menu, I do not assign them to HintMenus directly, but use a preInit function to assign them.

class MenuClass1 : HintMenu  // identical classes to preprocess
    // this was an attempt to force sorting, did not work
	updateContents() { initializeContents(); inherited; }
;
class MenuClass2 : HintMenu
    // this was an attempt to force sorting, did not work
	updateContents() { initializeContents(); inherited; }
;
allDaHints : TopHintMenu 'All Da Hints';
+ class1Hints : HintMenu 'One Type of Hint'
	allContents = [] // filled by preInit
;
+ class2Hints : HintMenu 'The Other Type of Hint'
	allContents = [] // filled by preInit
;
hMenuPreinit: PreinitObject
    execute() {
        forEachInstance(MenuClass1, {um:  class1Hints.allContents += um });
        forEachInstance(MenuClass2, {am:  class2Hints.allContents += am });
    }
;

This should (and does) club all subordinate hint menus and their trees to the appropriate top level menus. Subordinate menus defined as

c1startRoomHints : MenuClass1 'Start Room Hints';
+ HintLongTopicItem 'Specific Hint 1'
	'Kinda vague prod in the right direction.   ' 
;
c2startRoomHints : MenuClass2 'Alternate Start Room Hints';
+ Goal 'Alternate Specific Hint 1'
  [ 'Vague Hint',
    'Less subtle Hint',
    'Just spellin\' it out.'
  ]
;

Within those top level menus however, they do not seem to be ordered according to topicOrder = (sourceTextOrder)

Tried a few shots-in-the-dark including above to force ordering. Will play with not using preInit as a test case next.

1 Like

Yes, correct.

1 Like

Ok, I am embarrassed. This addressed it, and def should have been my first try:

hMenuPreinit: PreinitObject
    execute() {
        forEachInstance(UserMenu, {um:  userHints.allContents += um });
        forEachInstance(AlphaMenu, {am:  alphaHints.allContents += am });

    //seriously bruh, just initialize them here
		userHints.initializeContents();
		alphaHints.initializeContents();
    }
;

Sorry for wasting your time :confused:

3 Likes