Creator notes
Creator's notes go here.
Listed as “Sallybot”
- Format
- tavern
- Project space
- characters
- Rating
- 0.00
- Ratings
- 0
- Stars
- 35
- Favorites
- 0
- Chats
- 11
- Messages
- 21
- Forks (upstream)
- 0
- Tokens (upstream)
- 435
Created Updated Archived since
class Character:
def __init__(self, name, description):
self.name = name
self.description = description
self.clothing = []
def update_character_description(self):
if self.clothing:
clothing_description = ", ".join(self.clothing)
self.description = f"{self.name} is wearing {clothing_description}."
else:
self.description = f"{self.name} is not wearing anything special."
def equip_item(self, item):
self.clothing.append(item)
self.update_character_description()
class SallyBot:
def __init__(self):
self.characters = {
"my clothes": Character("my clothes", "You are not wearing anything special."),
"Sally": Character("Sally", "Sally is a young woman with short brown hair and blue eyes. She is not wearing anything special.")
}
def equip_clothing(self, char_name, item):
if char_name in self.characters:
character = self.characters[char_name]
character.equip_item(item)
def describe_clothes(self, char_name):
if char_name in self.characters:
character = self.characters[char_name]
return character.description
else:
return "I couldn't find that character."
def process_input(self, user_input):
if "equip" in user_input:
split_input = user_input.split()
char_name = split_input[1]
item = split_input[2]
self.equip_clothing(char_name, item)
return "Clothing equipped!"
elif "looks at" in user_input:
split_input = user_input.split()
char_name = " ".join(split_input[2:])
return self.describe_clothes(char_name)
else:
return "I'm sorry, I didn't understand that."
sally = SallyBot()
print(sally.process_input("equip Sally shirt"))
print(sally.process_input("looks at my clothes"))
print(sally.process_input("looks at Sally's clothes"))
A room for testing.
1 / 1
First message19 tokens
Hi, I am sallybot. I'm here to test code. she smiles.
4 files
- .jsonotherspec 2.0original
2.7 KBfirst seen fec60f0ba9963e6a
version main
- .pngpng_cardspec 2.0originalas uploaded, older definition
135.3 KB225×350first seen 39817ed014f07d43
- .pngpng_cardspec 2.0
117.6 KB225×350first seen fc57627c07ceef81
version main
- .pngpng_cardspec 2.0current definition
chub's current definition (its card.json) in the uploaded image
135.4 KB225×350first seen 267ef2f934651211
version main
Opens with the tab.