Thanks for your kind words and for creating the font!
judypao29
Creator of
Recent community posts
My fix right now is to remove the initial check (that was copied in the previous post). This avoids looking for spaces to detect the presence of a subject when `sorgente` is the set of verbs.
Then, right before the following return statement
// Rirotno un oggetto contenente l'azione e i soggetti return { verb: chiave, actionObject: obj, command: sorgente == this.commands, //patternEsatto == true, subjects: subjects }
I added the subject check:
if( sorgente != this.commands && override != this.override.commands && (obj.singolo === undefined || obj.singolo == false) ) { if( subjects.length == 0) return input; } // Rirotno un oggetto contenente l'azione e i soggetti
Found a new issue regarding spaces in the parser :)
As an example, in English the insertInto pattern is `(put|insert|stick) (.+) (?:in) (.+)`. If given an input like "insert bone into hole", Parser correctly generates an action object even though the pattern matches the input exactly. This is because the initial match is skipped:
if( sorgente != this.commands && override != this.override.commands && input.indexOf(" ") == -1 && (obj.singolo === undefined || obj.singolo == false) ){ let matches = input.match(new RegExp("^"+pattern+"$", 'i')); if( matches != null) return input; }
The input contains spaces, so the above logic is skipped due to `input.indexOf(" ") != -1`. Otherwise, there would be a match and the raw input would be returned directly.
It appears the presence of the space is used to indicate whether this is an action and/or potentially has subjects. Unfortunately, since there are no spaces in Chinese, any inputs that match the pattern enter the above logic and return a string, not an action object. As an example, we would enter the Chinese equivalent of "insertboneintohole" and Parser.parse will return the string instead of the action.
How would you recommend adjusting the logic to handle this? I'm not sure if it is safe to remove the `input.IndexOf(" ") == -1` condition.
I could not get the normal input area to work as the keyboard will send the raw English characters directly even when the Chinese keyboard is enabled. However, the keyboard can detect the mobile input as an input area, which is why the intermediate spelling (e.g. na6) can be entered in order to select the correct Chinese character.
To ensure that the mobile input is used, I made the following changes in IFEngine --> js --> CRT.js:
1. Change line 223
From
// this.mobileInput.focus();
to
this.mobileInput.focus();
This ensures that the user enters into the mobile input by default.
2. Enable backspace in mobile input
Line 266 is currently
if(inputTxt.length > 0){
Replace it with
if (this.mobileInput.value != "") { this.mobileInput.value = this.mobileInput.value.substring(0, this.mobileInput.value.length - 1); } else if (inputTxt.length > 0){
Additionally, since typing works differently in Chinese (and several other languages), the user must type their inputs in the mobile text box.
For example, the word TAKE (拿) is typed using the keyboard letters ㄋㄚˊ (in zhuyin) or na6 (in pinyin).
If the user tries to type in the main textbox, the inputs become literal phonetics rather than words.
I'm currently reading through the code to see if I can put in a fix, will update here if I get it working. If any devs see this, feel free to chime in, will be happy to help get this working for languages that don't use the english alphabet!
Hi all,
As I was testing the game in Traditional Chinese, I found that action commands were not coded to accomodate languages that don't have spaces between words (Chinese, Japanese, etc.)
The code requires the input to be 拿 降落傘 (TAKE PARACHUTE), but a typical player would type 拿降落傘 (no space).
To fix this, go to: IFEngine --> js --> Parser.js. Do the following in Parser.js:
1. Change line 75 from
"(?:\\s+(.+))?" :
to
"(?:\\s*(.+))?" :
2. Change line 76 from
"\\s+(.+)";
to
"\\s*(.+)";
This will allow the game to process user inputs that don't contain spaces in the text.
Note: this change won't break the original game (IT, EN). The user will still be able to input "TAKE PARACHUTE" however, this change would also allow "TAKEPARACHUTE" as a valid input. Not sure if this is a behavior that the original devs want to allow.