File size: 2,897 Bytes
beed96a
 
571e8a6
beed96a
 
 
571e8a6
beed96a
 
571e8a6
 
beed96a
571e8a6
 
 
beed96a
571e8a6
 
 
beed96a
571e8a6
 
 
beed96a
571e8a6
 
 
 
 
 
 
 
 
 
 
beed96a
571e8a6
 
beed96a
 
571e8a6
 
beed96a
 
 
 
 
 
 
 
 
 
571e8a6
beed96a
 
571e8a6
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import streamlit as st

# Expanded story content with directions
story_content = [
    {"id": "start",
     "text": "Essie grows fascinated with faeries and leprechauns, following her grandmother's tales. 🧚",
     "choices": [("Explore", "choice_a")]
    },
    {"id": "choice_a",
     "text": "Which direction does Essie explore? 🧭",
     "choices": [("North", "north_discovery"), ("South", "south_discovery"), ("East", "east_discovery"), ("West", "west_discovery")]
    },
    {"id": "north_discovery",
     "text": "Essie discovers a hidden glen, alive with faerie lights. 🌌",
     "choices": [("Perform a ritual", "ritual_outcome"), ("Explore cautiously", "explore_outcome")]
    },
    {"id": "south_discovery",
     "text": "Essie finds a mystical lake reflecting the moon's glow. πŸŒ•",
     "choices": [("Perform a ritual", "ritual_outcome"), ("Explore cautiously", "explore_outcome")]
    },
    {"id": "east_discovery",
     "text": "Essie encounters a grove with a mysterious faerie circle. πŸ„",
     "choices": [("Perform a ritual", "ritual_outcome"), ("Explore cautiously", "explore_outcome")]
    },
    {"id": "west_discovery",
     "text": "Essie stumbles upon an ancient tree, rumored to be a portal to the Otherworld. 🌳",
     "choices": [("Perform a ritual", "ritual_outcome"), ("Explore cautiously", "explore_outcome")]
    },
    {"id": "ritual_outcome",
     "text": "The ritual connects Essie with the faerie realm, leading to a magical encounter. ✨",
     "choices": [("Use knowledge to preserve tradition", "preserve_tradition"), ("Use gift for personal gain", "personal_gain")]
    },
    {"id": "explore_outcome",
     "text": "Cautious exploration reveals hidden truths of the mystical world. πŸ”",
     "choices": [("Use knowledge to preserve tradition", "preserve_tradition"), ("Use gift for personal gain", "personal_gain")]
    },
    {"id": "preserve_tradition",
     "text": "Essie returns home, enriched with stories and traditions to pass down. πŸ“š",
     "choices": [("Restart", "start")]
    },
    {"id": "personal_gain",
     "text": "Using her new-found knowledge/gift, Essie seeks to benefit herself, changing her destiny. πŸ’°",
     "choices": [("Restart", "start")]
    }
]

def render_story_point(story_id):
    story_point = next((item for item in story_content if item["id"] == story_id), None)
    if story_point:
        st.write(story_point["text"])
        for choice_text, next_id in story_point["choices"]:
            if st.button(choice_text):
                st.session_state['current_id'] = next_id  # Update the current story ID in session state
                break

st.title("Choose Your Own Adventure: Essie's Journey")

# Initialize or update current story ID in session state
if 'current_id' not in st.session_state:
    st.session_state['current_id'] = "start"

render_story_point(st.session_state['current_id'])