have hosts talk when no answer

pull/1/head
vilmibm 2023-02-10 20:05:06 +00:00
parent 4dbeb6984f
commit ea484671ed
1 changed files with 27 additions and 6 deletions

View File

@ -112,6 +112,7 @@ func cli(s *streams) error {
Description string Description string
InBuff io.ReadWriter InBuff io.ReadWriter
InLength int InLength int
Host *character
} }
scenes := map[string]*scene{ scenes := map[string]*scene{
@ -132,6 +133,7 @@ func cli(s *streams) error {
just say it out loud. as many times as you need. to get it right. just say it out loud. as many times as you need. to get it right.
when you're ready to move on, [-:-:b]/nod[-:-:-] when you're ready to move on, [-:-:b]/nod[-:-:-]
`), `),
Host: newCharacter("wire guy", "a lil homonculus made of discarded computer cables"),
InBuff: bytes.NewBuffer([]byte{}), InBuff: bytes.NewBuffer([]byte{}),
}, },
"nodded": { "nodded": {
@ -154,6 +156,7 @@ func cli(s *streams) error {
against a tree. against a tree.
`), `),
InBuff: bytes.NewBuffer([]byte{}), InBuff: bytes.NewBuffer([]byte{}),
Host: newCharacter("the shrike", "a little grey bird. it has a pretty song."),
}, },
"leaned": { "leaned": {
Description: heredoc.Doc(` Description: heredoc.Doc(`
@ -171,6 +174,7 @@ func cli(s *streams) error {
around in this void. around in this void.
`), `),
InBuff: bytes.NewBuffer([]byte{}), InBuff: bytes.NewBuffer([]byte{}),
Host: newCharacter("the vcr", "a black and grey VCR from 1991"),
}, },
"spun": { "spun": {
Description: heredoc.Doc(` Description: heredoc.Doc(`
@ -193,6 +197,7 @@ func cli(s *streams) error {
store. just [-:-:b]/open[-:-:-] the door. store. just [-:-:b]/open[-:-:-] the door.
`), `),
InBuff: bytes.NewBuffer([]byte{}), InBuff: bytes.NewBuffer([]byte{}),
Host: newCharacter("the mop", "a greying mop with a wooden handle."),
}, },
"done": { "done": {
Description: heredoc.Doc(` Description: heredoc.Doc(`
@ -220,7 +225,7 @@ func cli(s *streams) error {
} }
switch strings.TrimPrefix(trimmed, "/") { switch strings.TrimPrefix(trimmed, "/") {
case "quit": case "quit":
os.Exit(0) app.Stop()
case "look": case "look":
fmt.Fprintln(msgScroll, "") fmt.Fprintln(msgScroll, "")
fmt.Fprintln(msgScroll, scenes[currentScene].Description) fmt.Fprintln(msgScroll, scenes[currentScene].Description)
@ -229,28 +234,44 @@ func cli(s *streams) error {
if currentScene != "start" { if currentScene != "start" {
return return
} }
if scenes[currentScene].InLength > 0 { if scenes[currentScene].InLength == 0 {
fmt.Fprintln(msgScroll,
scenes[currentScene].Host.Say("i'm sorry, before going further could you share an email with me?"))
return
}
currentScene = "nodded" currentScene = "nodded"
sceneTransition(scenes[currentScene].Description) sceneTransition(scenes[currentScene].Description)
} else {
// say sorry, ask for input
}
case "lean": case "lean":
if currentScene != "nodded" { if currentScene != "nodded" {
return return
} }
if scenes[currentScene].InLength == 0 {
fmt.Fprintln(msgScroll,
scenes[currentScene].Host.Say("phweeturpff"))
return
}
currentScene = "leaned" currentScene = "leaned"
sceneTransition(scenes[currentScene].Description) sceneTransition(scenes[currentScene].Description)
case "spin": case "spin":
if currentScene != "leaned" { if currentScene != "leaned" {
return return
} }
if scenes[currentScene].InLength == 0 {
fmt.Fprintln(msgScroll,
scenes[currentScene].Host.Say("hmm did you say something?"))
return
}
currentScene = "spun" currentScene = "spun"
sceneTransition(scenes[currentScene].Description) sceneTransition(scenes[currentScene].Description)
case "open": case "open":
if currentScene != "spun" { if currentScene != "spun" {
return return
} }
if scenes[currentScene].InLength == 0 {
fmt.Fprintln(msgScroll,
scenes[currentScene].Host.Say("just the one last thing please"))
return
}
currentScene = "done" currentScene = "done"
sceneTransition(scenes[currentScene].Description) sceneTransition(scenes[currentScene].Description)
} }