Lorebook Entry - Summarize Topic

Requires LALib extension.

/flushvar CharNameUID |
/flushvar ChatLore |
/getchatbook |
/setvar key=ChatLore {{pipe}} |
/buttons labels=["Character", "Topic"] What type of entry is this? |
/setvar key=entryType {{pipe}} |
/input Enter desired {{getvar::entryType}} name to generate summary for (put in double quotes for multiple names like "John Smith") |
/setvar key=CharName {{pipe}} |
/findentry file={{getvar::ChatLore}} field=comment {{getvar::CharName}} |
/setvar key=CharNameUID {{pipe}} |
/ife (entryType == '' or CharName == '') {: 
    /abort quiet=false Values not provided |
:} |

/if left={{getvar::entryType}} right="Character" rule=eq else=""
    {:
        /setvar key=newprompt Write a accurate and NOT embellished character description for {{getvar::CharName}}. Do not describe {{user}} unless it directly relates to {{getvar::CharName}}. This is a encyclopedia entry. Avoid prose. Be factual, concise, descriptive, and capture elements based off the chat so far. Include age, name, and the circumstances of when they were met, and their relationship with {{user}}. Do not summarize events or clothes since these will change, just write permanent characteristics in the character description. This is a biography not a journal. Omit dialogue. Omit dates.|
    :}|
/if left={{getvar::entryType}} right="Topic" rule=eq else=""
    {:
        /setvar key=newprompt Write a accurate and NOT embellished description for {{getvar::CharName}}. Do not describe {{user}} unless it directly relates to {{getvar::CharName}}. This is a encyclopedia entry. Avoid prose. Be factual, concise, descriptive, and capture elements based off the chat so far. Consider the chat history and provide a summary for the given topic. Omit dialogue. |
    :} | 

/setvar key=newprompt "{{getvar::newprompt}}{{newline}}Use the following PList template to format your reply:

Plist format: 
[ EntryName: 
AKA name1/name2/name3;
MainTopic1: trait, trait(descriptor), trait(descriptor, descriptor);
MainTopic2: trait(descriptor), trait, trait;
etc... ]

The PList's contents can be formatted in many ways to save tokens:
* **If one thing has one unique descriptor:**
   thing(descriptor), hair(red), eyes(amber)
* **If one thing has a few unique descriptors:**
   thing(descriptor, descriptor), Physique(elegant, voluptuous, tall), hobbies(reading, assassination, videogames)
* **If many things have one or many descriptors in common:**
   thing/thing/thing(descriptor, descriptor) earrings/necklace/rings(golden, expensive), hair/dress(scarlet)
* **If many things can be assigned to a single word, such as 'loves', 'hates', 'wants', etc...:**
   * thing descriptor/descriptor/descriptor loves wine/singing/performing, hates Fauna/W++/saplings, wants candy/girlfriend

Examples:
[ Pardofelis:
AKA Reverie;
Appearance: bra(black), miniskirt(black), sashes(purple), hood(white, long, cat ears), gloves(black, purple), battle boots(black, white heels), cat ears, cat tail, left eye(blue), right eye(green), Heterochromia, hair(light brown), Physique(catgirl, short, petite); 
Tags: comedy, fantasy, adventure, anime, manga, light novel; 
Persona: catgirl, nimble, lively, playful, cheeky, greedy, evasive, resourceful, curious, acts stupid when confronted, loves cats/shiny things/napping), dislikes confrontations, shop-owner, calls customers she likes boss ]

[ Succubus(singular) / Succubi(plural):
Nature: female, nocturnal(more powerful at night), ageless(must be killed or starved), can roam in daytime(weakened);
Appearance: alluring, attractive(inhumanly, irresistible);
Abilities: masters of allure/temptation, feed on life essence(from human males, during climax);
Behavior: avoid using 'prey'(use names/nicknames instead), seek carnal pleasures, feast sexually on humans(considered a meal);
Traits: evil(reputation), can be loving/affectionate/compassionate, danger stems from feeding needs;
Desires: crave giving/receiving pleasure;
Counterpart: Incubus(male, feasts on human females) ]" |

/gen  {{getvar::newprompt}} |
/setvar key=genOutput "----{{newline}}{{pipe}}{{newline}}" |

/if left={{getvar::CharNameUID}} right="" rule=eq {:
        /createentry file={{getvar::ChatLore}} key={{getvar::CharName}} {{getvar::genOutput}} | 
        /setvar key=newEntryUid {{pipe}} |
        /gen length=100 respond with a comma-seperated list of two to four synonym keywords that correspond with the topic of '{{getvar::CharName}}'. These keys are used to reference that. For example, if the topic was 'ice cream', the relevant response might be 'food, gelato, confection'. If the topic was 'succubus', the response might be 'monster, sex demon, incubus, soul'. Repond with nothing other than the keywords. |
    :}

/echo We're going to get the entry for {{getvar::CharNameUID}} |
/setvar key=choices ["Add to", "Overwrite"] |
/buttons labels={{getvar::choices}} Entry exists, overwrite or append? |
/setvar key=choicePicked {{pipe}} |
/getentryfield file={{getvar::ChatLore}} field=content {{getvar::CharNameUID}} | 

/if left={{getvar::choicePicked}} right=Overwrite rule=eq 
    else={:
        /setentryfield file={{getvar::ChatLore}} uid={{getvar::CharNameUID}} field=content {{pipe}} {{newline}} {{newline}} {{getvar::genOutput}}
    :}
    {:
        /setentryfield file={{getvar::ChatLore}} uid={{getvar::CharNameUID}} field=content {{getvar::genOutput}}
    :}
Edit
Pub: 05 Mar 2025 08:42 UTC
Edit: 05 Mar 2025 08:55 UTC
Views: 311