@@ -6,10 +6,10 @@ import { DEBUG } from "./debug.js";
6
6
const EOL = "\n\r" ;
7
7
8
8
// type interval
9
- const _1t = 16 ;
9
+ const _1t = 15 ;
10
10
11
11
// wait intervals
12
- const _1s = 1000 ;
12
+ const _1s = 1024 ;
13
13
const _hs = _1s / 2 ;
14
14
const _2s = _1s * 2 ;
15
15
const _3s = _1s * 3 ;
@@ -150,8 +150,13 @@ async function typeln(s, typeDelay) {
150
150
}
151
151
}
152
152
153
- async function type ( s , typeDelay = _1t ) {
153
+ async function type ( s , typeDelay = - 1 ) {
154
154
155
+ // longer type delay for longer strings
156
+ if ( typeDelay < 0 ) {
157
+ typeDelay = s . length * 0.025 + _1t ;
158
+ }
159
+
155
160
s = s . replace ( "\\b" , "\b" ) ;
156
161
157
162
// bold
@@ -331,12 +336,12 @@ async function puzzle1() {
331
336
await typeln ( ) ;
332
337
333
338
const optionSomething = {
334
- text : `I ${ randomMsg ( [ " feel" , "*feel*" , "_feel_" ] ) } ${ randomMsg ( [ "something" , "*something*" , "_something_" ] ) } !` ,
339
+ text : `I feel ${ randomMsg ( [ "something" , "*something*" , "_something_" ] ) } !` ,
335
340
choice : "something"
336
341
} ;
337
342
338
343
const optionAnything = {
339
- text : `I do ${ randomMsg ( [ " feel" , "*feel*" , "_feel_" ] ) } ${ randomMsg ( [ "anything" , "*anything*" , "anything" ] ) } .` ,
344
+ text : `I do feel ${ randomMsg ( [ "anything" , "*anything*" , "anything" ] ) } .` ,
340
345
choice : "anything"
341
346
} ;
342
347
@@ -581,16 +586,26 @@ async function scene4_world(note) {
581
586
}
582
587
583
588
// TODO: Positive/negative switch: "Don't follow"
584
- const choice = await menu ( [
589
+ let choices = [
585
590
{ text : "" , choice : "showMenu" } ,
586
591
{ text : "Follow author." , choice : "followAuthor" } ,
587
592
{ text : "Follow color." , choice : "followColor" } ,
588
593
{ text : "Follow language." , choice : "followLanguage" } ,
589
594
// TODO: Move utilities to submenu or review mode?
590
595
{ text : "Request hint." , choice : "hint" } ,
591
596
{ text : "Copy the note." , choice : "copy" } ,
597
+ { text : "Repeat." , choice : "repeat" } ,
592
598
{ text : "Leave..." , choice : "leave" } ,
593
- ] , showMenu ) ;
599
+ ] ;
600
+
601
+ if ( note . id . includes ( "-" ) ) {
602
+ choices = choices . toSpliced ( 4 , 0 , {
603
+ text : "In English, please!" ,
604
+ choice : "inEnglish"
605
+ } ) ;
606
+ }
607
+
608
+ const choice = await menu ( choices , showMenu ) ;
594
609
showMenu = false ;
595
610
596
611
game . decrementActionCounter ( ) ;
@@ -606,6 +621,12 @@ async function scene4_world(note) {
606
621
showMenu = true ;
607
622
}
608
623
624
+ if ( choice === "repeat" ) {
625
+ await typeln ( ) ;
626
+ showNote = true ;
627
+ showMenu = true ;
628
+ }
629
+
609
630
if ( choice === "followAuthor" ) {
610
631
const nextNote = game . notes . find ( n => {
611
632
if ( n . meta . author == note . meta . author && ! game . state . breadCrumbs . includes ( n . id ) ) {
@@ -669,6 +690,29 @@ async function scene4_world(note) {
669
690
showNote = true ;
670
691
showMenu = true ;
671
692
}
693
+
694
+ if ( choice === "inEnglish" ) {
695
+ const baseId = note . id . replace ( / - .* / g, "" ) ;
696
+ const nextNote = game . notes . find ( n => {
697
+ // count breadcrumbs or not?
698
+ if ( n . id === baseId ) {
699
+ return true ;
700
+ }
701
+ return false ;
702
+ } ) ;
703
+
704
+ if ( nextNote ) {
705
+ note = nextNote ;
706
+ game . state . breadCrumbs . push ( note . id ) ;
707
+ game . saveState ( ) ;
708
+ }
709
+ else {
710
+ await reachedEOW ( ) ;
711
+ noteColor = randomNoteColor ( note ) ;
712
+ }
713
+ showNote = true ;
714
+ showMenu = true ;
715
+ }
672
716
673
717
if ( choice === "copy" ) {
674
718
const wasCopied = await copyToClipboard ( note . original ) ;
0 commit comments