work in progress game
This commit is contained in:
parent
b8921858f2
commit
a8618649ba
2 changed files with 231 additions and 31 deletions
199
games/underground_potions.toml
Normal file
199
games/underground_potions.toml
Normal file
|
@ -0,0 +1,199 @@
|
|||
[meta]
|
||||
version = 2.0
|
||||
title = "Underground Potions"
|
||||
author = "Arthur Beck"
|
||||
beginning = "title"
|
||||
default_voice = "UgBBYS2sOqTuMpoF3BR0"
|
||||
|
||||
[track.title]
|
||||
text = "Underground Potions: A compact adventure about potions"
|
||||
[[track.title.options]]
|
||||
text = "Begin"
|
||||
to = "start"
|
||||
|
||||
[track.start]
|
||||
text = "You are Flebulous the Red, a relatively unknown potion seller trying to make a living. Unfortunately potions are heavily regulated, and you've turned to selling potions underground for money. As you get ready for the day you feel a slight vibration from your phone and you see a request for a love potion. They make a starting offer of 1500 gold."
|
||||
[[track.start.options]]
|
||||
text = "make a counter offer"
|
||||
to = "love1-counter"
|
||||
[[track.start.options]]
|
||||
text = "accept the deal"
|
||||
to = "love1-accept"
|
||||
|
||||
[track.love1-counter]
|
||||
text = "How much?"
|
||||
[[track.love1-counter.options]]
|
||||
text = "make an offer of 1700 gold"
|
||||
to = "love1-counter1700"
|
||||
[[track.love1-counter.options]]
|
||||
text = "make an offer of 1900 gold"
|
||||
to = "love1-counter1900"
|
||||
[[track.love1-counter.options]]
|
||||
text = "make an offer of 2100 gold"
|
||||
to = "love1-counter2100"
|
||||
|
||||
[track.love1-counter1700]
|
||||
text = "After a brief pause, the buyer agrees. Time to make the potion."
|
||||
[[track.love1-counter1700.options]]
|
||||
text = "continue"
|
||||
to = "love1-accept"
|
||||
|
||||
[track.love1-counter1900]
|
||||
text = "After a long pause, the buyer makes a offer of 1700 gold and says that's the highest they'll go. Accept?"
|
||||
[[track.love1-counter1900.options]]
|
||||
text = "accept"
|
||||
to = "love1-accept"
|
||||
[[track.love1-counter1900.options]]
|
||||
text = "decline"
|
||||
to = "love1-decline"
|
||||
|
||||
[track.love1-counter2100]
|
||||
text = "After a long pause, the buyer makes a offer of 1700 gold and says that's the highest they'll go. Accept?"
|
||||
[[track.love1-counter2100.options]]
|
||||
text = "accept"
|
||||
to = "love1-accept"
|
||||
[[track.love1-counter2100.options]]
|
||||
text = "decline"
|
||||
to = "love1-decline"
|
||||
|
||||
[track.love1-decline]
|
||||
text = "Okay, c'mon. That's a good deal. You got to accept!"
|
||||
[[track.love1-decline.options]]
|
||||
text = "Accept"
|
||||
to = "love1-accept"
|
||||
|
||||
[track.love1-accept]
|
||||
text = "You check your big book o recipes and find the page on love potions. You need a unicorn hair, Grandma Gray's potion base number 5, an onion, and love spices. And five pounds of sugar. No, seriously. You already have the onion, the potion base, and two pounds of sugar, but you need to go out to get the other items. Before leaving, you check for what love spices are and find it's a mix of nutmeg and rhubarb. Now with that knowledge, you leave your house."
|
||||
[[track.love1-accept.options]]
|
||||
text = "Go to Mister John's"
|
||||
to = "love1-johns1"
|
||||
[[track.love1-accept.options]]
|
||||
text = "Go to The Gray and White Wizard"
|
||||
to = "love1-gandalf1"
|
||||
|
||||
[track.love1-johns1]
|
||||
text = "You enter Mister John's and immediately spot everything except for the unicorn hair that you need. You realize this is a really specific set of items and consider getting some other items to make it look less suspicious."
|
||||
[[track.love1-johns1.options]]
|
||||
text = "get other items"
|
||||
to = "love1-johns1-checkout2"
|
||||
[[track.love1-johns1.options]]
|
||||
text = "not get other items"
|
||||
to = "love1-johns1-checkout"
|
||||
|
||||
[track.love1-johns1-checkout]
|
||||
text = "You decide against it and hope the cashier doesn't notice. Thankfully(and unsurprisingly, thinking about it) the cashier doesn't notice and just checks you out. You still need that unicorn hair, though."
|
||||
[[track.love1-johns1-checkout.options]]
|
||||
text = "Go to The Gray and White Wizard"
|
||||
to = "love1-gandalf2"
|
||||
|
||||
[track.love1-johns1-checkout2]
|
||||
text = "You decide to get a few other items, including flour and salt and garlic. The cashier looks at you and says, \"Vampires?\" You nod. After leaving Mister John's, you still need the unicorn hair."
|
||||
[[track.love1-johns1-checkout.options]]
|
||||
text = "Go to The Gray and White Wizard"
|
||||
to = "love1-gandalf2"
|
||||
|
||||
[track.love1-gandalf1]
|
||||
text = "Entering The Gray and White Wizard(sometimes called Gandalf's by the locals because of how much it annoys him), you see the unicorn hair after wandering about for fifteen minutes. You quickly check out and head back home, dropping off the hair. You need the other stuff, though."
|
||||
[[track.love1-gandalf1.options]]
|
||||
text = "head to Mister John's"
|
||||
to = "love1-johns2"
|
||||
|
||||
[track.love1-johns2]
|
||||
text = "You enter Mister John's and immediately spot everything you need. You realize this is a really specific set of items and consider getting some other items to make it look less suspicious."
|
||||
[[track.love1-johns2.options]]
|
||||
text = "get other items"
|
||||
to = "love1-johns2-checkout2"
|
||||
[[track.love1-johns2.options]]
|
||||
text = "not get other items"
|
||||
to = "love1-johns2-checkout"
|
||||
|
||||
[track.love1-johns2-checkout]
|
||||
text = "You decide against it and hope the cashier doesn't notice. Thankfully(and unsurprisingly, thinking about it) the cashier doesn't notice and just checks you out."
|
||||
[[track.love1-johns2-checkout.options]]
|
||||
text = "Go back home to brew"
|
||||
to = "love1-home1"
|
||||
|
||||
[track.love1-johns2-checkout2]
|
||||
text = "You decide to get a few other items, including flour and salt and garlic. The cashier looks at you and says, \"Vampires?\" You nod."
|
||||
[[track.love1-johns2-checkout.options]]
|
||||
text = "Go back home to brew"
|
||||
to = "love1-home1"
|
||||
|
||||
[track.love1-gandalf2]
|
||||
text = "Entering The Gray and White Wizard(sometimes called Gandalf's by the locals because of how much it annoys him), you see the unicorn hair after wandering about for fifteen minutes. You quickly check out."
|
||||
[[track.love1-gandalf2.options]]
|
||||
text = "Go back home to brew"
|
||||
to = "love1-home1"
|
||||
|
||||
|
||||
[track.love1-home1]
|
||||
text = "Now that you are 700 gold lighter and have everything, you head back home to brew. You read the instructions. What do you do?"
|
||||
[[track.love1-home1.options]]
|
||||
text = "Add potion mix and bring to a boil"
|
||||
to = "love1-home1-correct1"
|
||||
[[track.love1-home1.options]]
|
||||
text = "Bring 3 gallons of water to a boil and add sugar"
|
||||
to = "love1-home1-incorrect1"
|
||||
[[track.love1-home1.options]]
|
||||
text = "Mix love spices and sugar"
|
||||
to = "love1-home1-incorrect2"
|
||||
|
||||
[track.love1-home1-incorrect1]
|
||||
text = "As you whirl away, mixing and boiling and adding stuff, you eventually get a pungent, slightly goopy liquid that you don't think is correct."
|
||||
[[track.love1-home1-incorrect1.options]]
|
||||
text = "Try to pass it off as correct anyway"
|
||||
to = "love1-sell-incorrect1"
|
||||
[[track.love1-home1-incorrect1.options]]
|
||||
text = "Remake it at your own expense"
|
||||
to = "love1-home1"
|
||||
|
||||
[track.love1-home1-incorrect2]
|
||||
text = "As you whirl away, mixing and boiling and adding stuff, you eventually get a golden, beautiful liquid that smells like rotten eggs that you don't think is correct."
|
||||
[[track.love1-home1-incorrect2.options]]
|
||||
text = "Try to pass it off as correct anyway"
|
||||
to = "love1-sell-incorrect2"
|
||||
[[track.love1-home1-incorrect2.options]]
|
||||
text = "Remake it at your own expense"
|
||||
to = "love1-home1"
|
||||
|
||||
[track.love1-home1-correct1]
|
||||
text = "Great. What next?"
|
||||
[[track.love1-home1-correct1.options]]
|
||||
text = "Add the sugar and onion and mix for 30 seconds"
|
||||
to = "love1-home1-correct2"
|
||||
[[track.love1-home1-correct1.options]]
|
||||
text = "Add the love spices and unicorn hair and mix for 15 seconds"
|
||||
to = "love1-home1-incorrect1"
|
||||
|
||||
[track.love1-home1-incorrect3]
|
||||
text = "You stop mixing, having mixed for forty seconds. Eww, it's turned neon red! I doubt this is correct."
|
||||
[[track.love1-home1-incorrect3-arms.options]]
|
||||
text = "Try to pass it off as correct anyway"
|
||||
to = "love1-sell-incorrect3"
|
||||
[[track.love1-home1-incorrect3-arms.options]]
|
||||
text = "Remake it at your own expense"
|
||||
to = "love1-home1"
|
||||
|
||||
[track.love1-home1-correct2]
|
||||
text = "You add the sugar and onion(ewww!) and begin mixing(skip backwards six times to stop mixing)..."
|
||||
|
||||
[track.love1-home1-correct2-ten]
|
||||
text = "You've mixed for ten seconds"
|
||||
|
||||
[track.love1-home1-correct2-twenty]
|
||||
text = "You've mixed for twenty seconds"
|
||||
|
||||
[track.love1-home1-correct2-thirty]
|
||||
text = "You've mixed for thirty seconds"
|
||||
|
||||
[track.love1-home1-correct2-forty]
|
||||
text = "You've mixed for forty seconds"
|
||||
|
||||
[track.love1-home1-correct2-arms]
|
||||
text = "Your arms are tired. You stop mixing. Eww, it's turned neon green! I doubt this is correct."
|
||||
[[track.love1-home1-correct2-arms.options]]
|
||||
text = "Try to pass it off as correct anyway"
|
||||
to = "love1-sell-incorrect3"
|
||||
[[track.love1-home1-correct2-arms.options]]
|
||||
text = "Remake it at your own expense"
|
||||
to = "love1-home1"
|
63
src/main.rs
63
src/main.rs
|
@ -1,6 +1,5 @@
|
|||
//! Create choose-your-own-adventures for CDDAs
|
||||
#![warn(missing_docs, clippy::missing_docs_in_private_items)]
|
||||
#![feature(random)]
|
||||
#![feature(path_file_prefix)]
|
||||
|
||||
use elevenlabs_rs::endpoints::genai::tts::{TextToSpeech, TextToSpeechBody};
|
||||
|
@ -93,14 +92,14 @@ async fn main() -> elevenlabs_rs::Result<()> {
|
|||
})
|
||||
.collect::<Vec<Track>>();
|
||||
|
||||
tracks.sort_by(|v1, v2| {
|
||||
tracks.sort_by(|v1, v2| { // move beginning to first and keep everything else the same
|
||||
if v1.id == game.meta.beginning {
|
||||
return std::cmp::Ordering::Less;
|
||||
}
|
||||
if v2.id == game.meta.beginning {
|
||||
return std::cmp::Ordering::Greater;
|
||||
}
|
||||
v1.id.cmp(&v2.id)
|
||||
return std::cmp::Ordering::Equal;
|
||||
});
|
||||
|
||||
let base_out_dir = std::env::current_dir()
|
||||
|
@ -113,42 +112,44 @@ async fn main() -> elevenlabs_rs::Result<()> {
|
|||
for track in tracks.clone() {
|
||||
println!("Working on track {}...", track.id);
|
||||
let mut text = track.text;
|
||||
text += "\n\nYou can ";
|
||||
for option in track.options {
|
||||
text += &option.text;
|
||||
text += " by pressing the ";
|
||||
let mut i2 = -1isize;
|
||||
for track2 in &tracks {
|
||||
if track2.id == option.to {
|
||||
if track.options.len() > 0 {
|
||||
text += "\n\nYou can ";
|
||||
for option in track.options {
|
||||
text += &option.text;
|
||||
text += " by pressing the ";
|
||||
let mut i2 = -1isize;
|
||||
for track2 in &tracks {
|
||||
if track2.id == option.to {
|
||||
i2 += 1;
|
||||
break;
|
||||
}
|
||||
i2 += 1;
|
||||
break;
|
||||
}
|
||||
if i2 == -1 {
|
||||
panic!("Cannot find option reference {}!", option.to);
|
||||
}
|
||||
i2 += 1;
|
||||
}
|
||||
if i2 == -1 {
|
||||
panic!("Cannot find option reference {}!", option.to);
|
||||
}
|
||||
i2 += 1;
|
||||
|
||||
let offset = i2 - (i + 1) as isize;
|
||||
if offset.is_negative() {
|
||||
if offset == -1 {
|
||||
let offset = i2 - (i + 1) as isize;
|
||||
if offset.is_negative() {
|
||||
if offset == -1 {
|
||||
text += &format!("skip backward button 1 time.");
|
||||
} else {
|
||||
text += &format!("skip backward button {} times.", -offset - 1);
|
||||
}
|
||||
} else if offset.is_positive() {
|
||||
if offset == 1 {
|
||||
text += &format!("skip forward button 1 time.");
|
||||
} else {
|
||||
text += &format!("skip forward button {} times.", offset);
|
||||
}
|
||||
} else {
|
||||
text += &format!("skip backward button 1 time.");
|
||||
} else {
|
||||
text += &format!("skip backward button {} times.", -offset - 1);
|
||||
}
|
||||
} else if offset.is_positive() {
|
||||
if offset == 1 {
|
||||
text += &format!("skip forward button 1 time.");
|
||||
} else {
|
||||
text += &format!("skip forward button {} times.", offset);
|
||||
}
|
||||
} else {
|
||||
text += &format!("skip backward button 1 time.");
|
||||
text += "You can also ";
|
||||
}
|
||||
text += "You can also ";
|
||||
text = text.trim_end_matches("You can also ").to_string();
|
||||
}
|
||||
text = text.trim_end_matches("You can also ").to_string();
|
||||
std::fs::write(
|
||||
base_out_dir.join(track.id.clone() + ".mp3"),
|
||||
speak_text(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue