Lorebook Template with Complex Randomization Options

Lorebook Template with Complex Randomization Options

34

90

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:

26/03/09: Entry registration automated, no longer needs manual registration commands
25/10/18: Added maxMessages variable (defaults to 0 which is "unlimited")

proxy allowed

Published chats

0

comments

Leave a comment or feedback for the creator ❤️