From 619818774ebe2e5cea59995b6b4106af488b081b Mon Sep 17 00:00:00 2001 From: mehbark Date: Mon, 10 Jul 2023 05:51:25 -0400 Subject: [PATCH] coq talk with eggbug --- html/coq.tsx | 257 ++++++++++++++++++++++++++++++++++++++++++++++ html/dialogue.tsx | 17 +-- 2 files changed, 258 insertions(+), 16 deletions(-) create mode 100644 html/coq.tsx diff --git a/html/coq.tsx b/html/coq.tsx new file mode 100644 index 0000000..ccdf536 --- /dev/null +++ b/html/coq.tsx @@ -0,0 +1,257 @@ +import { reify_dialogue } from "./dialogue.tsx"; +import { debug_render } from "./html.ts"; +import { Component } from "./jsx/jsx-runtime.ts"; + +const Option: Component = ({ n }, children) => ( + <> + {`[${n}]`}{" "} + {...children} + +); + +const WaterRitual: Component = () => ( + + [begin water ritual; 1 dram of{" "} + water] + +); + +const End: Component = () => [End]; + +const Name: Component = ({ color }, children) => ( +
+ {...children} +
+); + +const Speech: Component = ( + { name, name_color, portrait = <> }, + children +) => ( +
+
{portrait}
+ {name} + a snazzy horizontal rule with three central spikes, taken from caves of qud +
{...children}
+
+); + +const Website: Component = () => website; + +const Eggbug: Component = ({ emotion }, children) => ( + + } + > + {...children} + +); + +const dialogue = reify_dialogue([ + + hi hey hi what whati +
what is up +
, + [ + , + [ + + oh cool that's neat what stuff like what stuff are you talking + about + , + [ + , + [ + + i really don't know how would i know what ur talking + about lol + , + [ + , + [ + + okay like, okay yeah idon't know still + , + [ + , + [ + what, + [ + , + [ + + oh mehbark is like making the + player like click through a + bunch for comedic effect ok + , + [ + , + [ + + it's taking them a ton + of effort to make this + deep tree though lol + like they're typing it + in and thinking hm maybe + i could abstract this a + bit but they know that + will be more trouble + than it's worth + , + [ + , + + aslo it's 5 in the + morning for + the— oh it's + done +
i still have + no stuff ok +
+ game over i guess + (all of these paths + lead to game over + (except one (this + was definitely + planned and not + decided as this was + being written))) +
, + ], + ], + ], + ], + ], + ], + ], + ], + ], + ], + ], + ], + ], + [ + , + [ + + That my friend, is a long, sad story. There was a time when + people cared to hear it, but I fear that time has passed. + , + [ + , + + you are such a butt you suck your so annoying LEAVE{" "} + + GAME OVER + GAME OVER + GAME OVER + + , + ], + [ + , + [ + + okay, get comfortable, something to eat, something to + drink, heck, maybe even rent a{" "} + + portable bathroom + {" "} + to keep nearby. this is a LONG story + , + [ + , + + it was to hard to get the pixelts to work + , + ], + ], + ], + ], + ], + [ + , + [ + + heck yes i love power words have + at it ( idoubt it will work no offense) + , + [ + , + you win, + ], + ], + ], + [ + , + [ +
+ You don't have any water because this is a .
+ also eggbug probably uses like eggbug juice or something +
, + [ + , + + how wouldi know lol ask like a cohost maker lol + , + ], + ], + ], + [ + , + + uh what +
+ ok +
i guess +
+ every dialogue tree eventually ends anyways so this is just like to + look more coqqy iguess +
, + ], +]); + +debug_render( +
+
{dialogue}
+
+
+); diff --git a/html/dialogue.tsx b/html/dialogue.tsx index 11f012d..14476cd 100644 --- a/html/dialogue.tsx +++ b/html/dialogue.tsx @@ -8,7 +8,7 @@ function not_empty(arr: T[]): arr is [T, ...T[]] { return arr.length > 0; } -function reify_dialogue(d: Dialogue): Html { +export function reify_dialogue(d: Dialogue): Html { if (!Array.isArray(d)) return d; const [r, ...rest] = d; @@ -30,18 +30,3 @@ function reify_dialogue(d: Dialogue): Html { ); } } - -const rd = reify_dialogue([ - "Hi!", - ["Hello!", "How are you!"], - [ - "Bye", - [ - ":(", - ["Sorry", :D], - ["Not sorry", D:], - ], - ], -]); - -debug_render(rd);