Where is the “adv3Utils” repo? I don’t see it at diegesisandmimesis. You’ve clearly been doing some advanced work, so thanks for any pointers to this repo! (And my apologies if I simply failed to spot it at your GitHub space.)
Well crap. I thought I’d made it public around the same time I made adv3Patches public (which I just doublechecked to make sure I actually had).
Should be visible now:
Summary (it doesn’t have full documentation, but there should be an information block at the top of the individual source files, and they should be fairly verbosely internally commented):
actionTypeAdds anactionTypeprop toAction, used elsewhere for grouping actions (in this case sense actions and travel actions get tagged)_debugObject()A function that enumerates an object’s properties. Only enabled in debugging buildsDeadboltandDoorPair, recently described abovefindMaxValue()A function that tries to find the largest number of something (like objects in a room) that the VM can handle without throwing an exceptiongTurnA macro returning the current turninterruptImplicitA macro for interrupting implicit actionsiobjScopeLogic implementing object scoping rules for indirect objects similar to the existing ones for direct object. Described fairly recently in this threadmessageTokensLogic for declaring arbitrary message parameter substitution tokens that are resolved by callbackOrdinalThingMixin forThingto add ordinal vocabulary (“first pebble”, “second pebble”, and so on)ResourceandResourceFactoryClasses for dispensing equivalent objects (harvestable plants and that kind of thing)roomAdds a couple methods onRoomthat test for room adjacency and list a room’s exits and destinations.roomVocabTweaksRoomto make it easier to refer to rooms in commandssearchContentsAdds methods toThing:searchContents(fn)which returns the subset ofcontentsthat satisfiesfn;contains(fn)that returns booleantrueif any object incontentssatisfiesfn, andmatchContents(fn)that returns the first object in contents that matchesfnornilif nonethingStateDesc,thingStateMulti, andthingStateRoomExtensions toThingStatethat add, respectively, astateDescproperty, the ability to have multiple active states, and room-specific tweakstitleCase()A function that returns a string formatted in title case.vocabTweaks toVocabObjectto make it easier to add words and specifically convenience methods for adding weak tokens
If you have any questions or notice any bugs pragmatically the best way to ping me is here; reporting issues on git works but I’m not very diligent about checking (because the main consumers of my repos appear to be me and AI scrapers).
Many thanks for making the repo public and for all your brilliant contributions!
Another fairly minor tweak, this time some code to allow toggling some kinds of object announcements on Thing.
First we declare a few flags. These correspond one-to-one with library messages that we want the ability to toggle. This mechanism could in theory be extended to other kinds of object announcement, but this tweak targets a specific set of them unified by identical calling semantics. Anyway, the flags should probably go in some header file, adv3Utils.h in the module:
#define ANNOUNCE_MULTI (1 << 0)
#define ANNOUNCE_AMBIG (1 << 1)
#define ANNOUNCE_DEFAULT (1 << 2)
Then we add a property on Thing that by default has all three of these flags set (so the default behavior will be the same as in stock adv3: always show all the object announcements):
modify Thing
announcementFlag =
( ANNOUNCE_MULTI | ANNOUNCE_AMBIG | ANNOUNCE_DEFAULT )
;
Then finally we tweak the corresponding message methods on libMessages to check the new property:
modify libMessages
announceMultiActionObject(obj, whichObj, action) {
if(obj.announcementFlag & ANNOUNCE_MULTI)
return(inherited(obj, whichObj, action));
else
return('');
}
announceAmbigActionObject(obj, whichObj, action) {
if(obj.announcementFlag & ANNOUNCE_AMBIG)
return(inherited(obj, whichObj, action));
else
return('');
}
announceDefaultObject(obj, whichObj, action, resolvedAllObjects) {
if(obj.announcementFlag & ANNOUNCE_DEFAULT)
return(inherited(obj, whichObj, action,
resolvedAllObjects));
else
return('');
}
;
This means that each of the announcement methods fall through via inherited() if the flag is set, and an empty string is returned if it isn’t (effectively suppressing the announcement).
The specific use case I have for this is some furniture-related code that provides an instanceable TableWithChairs class and additional actions such that >SIT AT TABLE is understood to mean the player wants to sit on one of the chairs at the table. But by default that produces something like:
Table and Chair Room 02
This room contains a TableWithChairs.
>sit at table
(the table)
Okay, you're now sitting on the first chair.
…where I think the (the table) announcement is ugly.
Yeah, I did some suppressing of ambig announcements too…
… which I stole, eh, appropriated, hrm, HOMAGED into my WIP! (so this becomes yet ANOTHER post-WIP tweak to adv3_jjmcc. I better start a list…)