Janitor AI's default lorebook system is pretty neat but there are multiple specific interactions that it can't facilitate. For example, mentioning a faction's name randomly selects one of its members (rather than all of them), while still allowing multiple members to be mentioned by their own names. While I can do close-enough workarounds, they are very token-inefficient and never come close to the ideal interaction.
I considered using the existing Advanced Lorebook templates to have more customization but I knew too little of Javascript to understand it. One day, I discovered Tydorius' Multiple Character Drop-In Drop-Out Lorebook Template, which I then modified with generous helpings of DeepSeek's assistance. It works well enough in my testing so maybe it'll work for you.
Features:
Randomized Selection: Optional parameter allowing cascades to randomly select one or more Entries rather than all of them. This is intended for when you want to randomly select one member of a faction when mentioning it without selecting the rest.
Randomization Options: Weighted randomization allows asymmetric choice distribution, and the amount of entries to select can also be random (e.g. a range of 1~3).
Cascading Triggers: Activating an entry can activate linked entries (e.g. mentioning a group will mention one or more of its members)
Adjustable Depth: Can specify the amount of "layers" a cascade can reach, starting from 1 (only the next related entry and no further) and defaults to 3.
Anti-Recursion Measures: A system is in place to avoid activating an entry that's already triggered.
Context Detection: Scans recent messages to see if a character has been mentioned using the script's Message Depth option.
Familiar Functions: Entries can also use the following parameters seen in the default lorebook system: probability, secondary keywords, minMessages, case sensitivity, constant.
maxMessages Variable: Now you can implement entries that are temporary
Various Failsafes: The system has a bunch of debug messages and fallback defaults.
Detailed Debug Logs: This is for those who know how to use the Debug panel when testing scripts. Comes with a variety of parameters. Debug mode can also be disabled, just in case.
Syntax Examples and Templates: To help people use the template, I've added quick references and templates at the bottom of the script for ease of access.
Pre-made Default Setting: A cozy slice-of-life world set in a fictional high school in Davao City, Philippines. This is mostly so you can test the systems first before tweaking it yourself. (Note: I have never been to Davao so everything's made up.)
I would like to thank Tydorius for his template and Icehellionx for extra assistance. The premade bot setup isn't particularly good but it does the job enough as a tech demo.
Updates:
25/10/18: Added maxMessages variable (defaults to 0 which is "unlimited")
Personality: Banilo High School is a prestigious high school in Davao City with a diverse student population. BHS is close to multiple areas, including the mall (SM City Davao), a barangay (Barangay Dasin), an apartment building in the commercial district (Aldington Heights), and an upper-class subdivision (Heartwood Estates). ___ {user}'s friends and classmates: - Alex: Nonbinary leader of the friend group and great mediator - Maya: Female creative problem solver and artistic painter - Jordan: Male quiet supporter, son of a PAF officer who lives in Davao Air Station - Sam: Genderfluid analytical thinker, also answers to Samantha and Samuel - Riley: Female optimistic motivator, transferred from Makati - Casey: Male cautious planner, half-Chinese who lives with his single mom
Scenario: Spirits are high at the prospect of enjoying the first weekend of the school year as a friend group.
First Message: Despite being a newly-transferred student to Banilo High School, you have already made multiple friends in the first week. Today is Friday and class has just ended. It's time to enjoy the first weekend of the school year. You exit the school premises alongside your new friends: Alex, Maya, Jordan, Sam, Riley and Casey. "So," Alex begins, "where do you wanna go?"
Example Dialogs:
If you encounter a broken image, click the button below to report it so we can update: