Articles on: Scripts

How to Use Scripts - Your Beginner Friendly Step-by-Step Guide

How to Use Scripts: Your Friendly Step-by-Step Guide


Ready to give your character their first invisible assistant? Let's start super simple and build up to amazing!


Baby Steps: Your First Script in 10 Minutes


Step 1: Create Your Character's First Helper

  1. Open up your main menu.
  • On PC: Click your profile picture in the top right corner.
  • On Mobile: Tap your profile picture in the bottom right corner.
  1. Select Scripts (looks like </> Scripts).
  2. Click the big Create New Script button.
  3. Choose Lorebook (this is the friendly, beginner option).
  4. Pick a pretty color theme — it's like picking the cover of your magic book.
  5. Give it a name like "Cafe Life."
  6. Write a little description if you want (totally optional!).
  7. Click Create Script.


What just happened: You just created an empty magic book. Now let's add your first page!


Step 2: Add Your First Magic Page

  1. Click Add Entry — this creates a new page in your book.
  2. Fill out the form (don't worry, it's easier than it looks):
  • Category: Pick "Background Info" from the dropdown (this is just for organization).
  • Entry Name: Type "Coffee Shop Atmosphere" (this is your personal label).
  • Keys: Type coffee, cafe, latte, espresso (these are the wake-up words).
  • Content: Type something like: The rich aroma of freshly ground coffee beans fills the air, mixing with quiet conversations and the gentle hum of the espresso machine.
    • Tip: Keep entries short — 1–3 sentences usually works best.
  • Probability: Set this to 50 (means "speak about this, half the time").
  1. Leave everything else alone for now — the defaults are perfect for beginners.
  2. Click Save.


What just happened: You created a page that wakes up when someone mentions coffee, and sometimes adds a cozy atmosphere note.


Step 3: Give Your Assistant to Your Character

  1. Look for the Assign to your Characters section on the right side.
  2. Find your character and click to select them.
  3. Click Assign to Script.


What just happened: You just hired this assistant to help that specific character!


Step 4: Watch the Magic Happen

  1. Select the character you want to test.
  2. Go chat with your character using Test Chat.
  • If you do not have a chat with this character, create one using the + New Chat option.
  1. Click Show Debug Panel at the bottom (this lets you peek behind the curtain).
  2. Type something like: "Want to grab some coffee together?"
  3. Look at the Changes tab in the debug panel — you'll see if your coffee assistant spoke up!
  4. Try the same message again — sometimes it'll speak, sometimes it won't (that's the 50% probability doing its job — it rerolls every message).


Quick "Why didn't it fire?" checklist:

  • Do your keys actually appear in the message?
  • Is Probability too low? Try a few times; it rerolls each turn.
  • Is the entry Active (enabled)?
  • Did you set Min Messages higher than your current chat length?
  • Are multiple entries in a group and a different one won?
  • Is Case Sensitive on, and does the casing match exactly?


Congratulations! You just created your first working script. Your character now has a coffee shop expert whispering atmospheric details!


Level Up: Adding Multiple Voices


Let's say you want your coffee expert to have different things to say, but you don't want them ALL talking at once:


Creating a Polite Group of Experts

  1. Add a second coffee entry:
  • Keys: coffee, cafe, latte, espresso (same wake-up words).
  • Content: Steam rises from ceramic cups while soft jazz music creates a perfect backdrop for intimate conversation.
  • Probability: Keep at 100 (we'll control randomness differently now).


  1. Teach them to take turns:
  • Edit both coffee entries.
  • In Group Label(s), type cafe_vibes for both.
  • Group Weight: Give the first one 60, the second one 40.


Tip: For grouped entries, set Probability to 100% and let Group Weight (or Prioritize Inclusion) decide the winner. This avoids double randomness.


What this does: Now when "coffee" comes up, your two experts will politely decide between themselves who gets to speak. The first one wins about 60% of the time, the second one about 40%.


Think of it like: Having two friends who both know about coffee shops, but they're polite enough to let only one person talk at a time.


Making the Smartest Expert Win

Want your most knowledgeable expert to automatically win? Let's add a coffee expert who specializes in fancy drinks:


  1. Create a third coffee entry:
  • Keys: coffee, latte, cappuccino, macchiato, specialty (more specific wake-up words).
  • Content: The barista's skilled hands craft an intricate pattern in the foam, turning your drink into a work of art.
  • Group Label(s): cafe_vibes (same group).
  • Group Weight: 100.
  • Under Group Selection Mode, turn on Use insertion order (this is the "smartest expert wins" button).


Now watch the magic:

  • Say "Let's get coffee" → One of your first two experts speaks (random choice).
  • Say "I'd love a specialty latte" → The fancy drink expert automatically wins (they know the most about THIS specific situation).


Group Selection Mode one-liner: It narrows the group to the best matches first; then the final pick is made by Group Weight (random) or by Order if Key Match Priority is on.


Fine-Tuning: Teaching Your Assistants Better Manners


Secondary Keys: The "Only If" Rules

Sometimes you want an expert to be even more careful about when they speak up.


Quick map:

  • AND ANY: at least one of these extra words can be present.
  • AND ALL: all of these extra words must be present together.
  • NOT ANY: if any of these show up, block this entry.
  • NOT ALL: block only if all of these show up together.


Example:

  • Keys: music (the main wake-up word)
  • Secondary Keys: headphones, earbuds, private
  • Mode: NOT ANY (this means "not if any of these appear")
  • Content: The ambient music floods the room, oppressive in weight.
  • Result: Your music expert shares about ambient music, but stays quiet when someone wants to listen privately


Think of it like: "Talk about music, but read the room — if someone's trying to have private listening time, don't interrupt!"


Min Messages: The Patience Rule

This is like telling your assistant "wait until we've been chatting for a while before bringing this up."

  • Set Min Messages to 10 for deep personal revelations.
  • Set it to 0 for basic environmental stuff.


Think of it like: Saving the good stories until you've warmed up the conversation.


Troubleshooting: When Your Assistant Goes Quiet


"My coffee expert isn't talking!"

  • Check the obvious: Do your messages actually contain the wake-up words?
  • Check the coin flip: If Probability is 50%, try the message a few times — it should work about half the time.
  • Check the switch: Make sure the entry is Active (there's a toggle).
  • Check the patience rule: If you set Min Messages to 10, send at least 10 messages first.
  • Check for pickiness: If you turned on Case Sensitive, make sure "Coffee" and "coffee" match exactly.


"I'm getting too much chatter!"

  • Use the group system: Put similar entries in the same group so only one talks at a time.
  • Adjust the coin flip: Lower the Probability on flavor entries to 30–50%.
  • Use the priority system: Give important stuff high numbers (10) and flavor stuff low numbers (1).


"My specific expert isn't winning!"

  • Turn on the smart system: Enable Use Group Scoring.
  • Check they're in the same group: Both general and specific entries need the same Group Label.
  • Count the keywords: Make sure your specific entry actually has more matching words.


When You're Ready for Advanced Mode


Want to whisper different things to your character's personality versus the scene? Here's the simplest way:


  1. Convert an entry to Advanced: In the entry, choose Advanced (Script).
  2. Use this simple template:


// ES5 style: use var and regular functions (no let/const or arrow functions)

// Make sure your character has the right "pockets" for information
if (!context.character) context.character = {};
if (!context.character.personality) context.character.personality = "";
if (!context.character.scenario) context.character.scenario = "";

// Whisper to personality
context.character.personality += "\n\nbecomes more relaxed around books and reading";

// Whisper to scenario
context.character.scenario += "\n\nSunlight streams through tall windows, illuminating countless book spines.";


Think of it like: Your assistant can now whisper different notes — one about how your character feels, another about what's happening in the scene.



SillyTavern Import: The Fast Lane


Already have lorebooks in SillyTavern? You can bring them over instantly:


  1. Create a new Lorebook script → open the JSON Editor (icon: <>).
  2. Export the contents of your SillyTavern World Info, then open the file.
  3. From your SillyTavern World Info, copy just the contents of the entries array — the stuff after the square brackets, NOT the entries key itself.


Copy this part:

[
{ "keys": ["library"], "content": "Books line every wall...", "enabled": true },
{ "keys": ["garden"], "content": "Flowers bloom in vibrant colors...", "enabled": true }
]


Not this:

{
"entries": [
{ "keys": ["library"], "content": "Books line every wall...", "enabled": true },
{ "keys": ["garden"], "content": "Flowers bloom in vibrant colors...", "enabled": true }
]
}


  1. Paste and save — your entries will appear in the UI with their settings (probability, groups, etc.) intact.
  2. Edit normally — they work just like entries you created from scratch.
  3. Want to upgrade later? Convert specific entries to Advanced (Script) to split content between personality and scenario.


Real-World Example: A Hobby That Develops


Here's how to make a character's interest grow over time:


Early Interest Assistant:

  • Keys: books, reading, novel, story
  • Min Messages: 0 (can talk from the start)
  • Probability: 100
  • Content: They glance curiously at the book in your hands, as if wanting to know more about what you're reading.


Book Enthusiast Assistant:

  • Keys: books, reading, novel, story
  • Min Messages: 20 (waits until you've been chatting a while)
  • Probability: 100
  • Content: Their eyes light up with genuine excitement as they lean forward, eager to discuss literature and share their own favorite stories.


What happens: Early in your chat, mentions of books trigger mild curiosity. After 20 messages, the same topics trigger passionate literary discussions. It feels like natural interest development!


Pro Tips from Friendly Experts


  1. Start tiny: One entry, simple keywords, 100% probability. Get that working first!
  2. Use the debug panel religiously: It's like having X-ray vision into what your assistants are doing.
  3. Think like a librarian: Give your entries clear, descriptive names so you can find them later.
  4. Less is more: 1–2 sentences usually work better than paragraphs.
  5. Steal from yourself: If you have SillyTavern lorebooks, use the Source Code import to save tons of time!
  6. Build connections Specific to Broad: When creating related entries, think like a family tree that goes from detailed to general. Instead of creating a web where everything points to everything else (which floods your character with too much information), build a chain:
    • golden retriever entry mentions → dog
    • dog entry mentions → pet
    • pet entry mentions → animal


Remember: Scripts are like training a team of invisible assistants. Start with one well-behaved assistant, then gradually add more as you get comfortable. Before you know it, your character will feel like they're truly alive in their world!

Updated on: 06/09/2025

Was this article helpful?

Share your feedback

Cancel

Thank you!