Hi,
I'm using these two scripts in conditional branches (with a free input text plugin that store the string inserted by the player in a variable):
1) let text = $gameVariables.value(x).toLowerCase(); text.indexOf("word 1") < text.indexOf("word 2")
2) (function(){ words = ["word"]; for(i=0;i<words.length;i++){if(!RegExp("\\b"+words+"\\b").test($gameVariables.value(x).toLowerCase())){break}};if(words.length===i)return!0})()
1) allows me to check if a given "word 1" occurs in the string before a given "word2"
2) allows me to check if in the string occurs a very specific word: i.e. "head" BUT NOT "headache".
Now...I need to merge these two: I need to check if a very specific "word1" occurs before a given "word2".
Someone more skilled than me in javascript can help? 😢
I'm using these two scripts in conditional branches (with a free input text plugin that store the string inserted by the player in a variable):
1) let text = $gameVariables.value(x).toLowerCase(); text.indexOf("word 1") < text.indexOf("word 2")
2) (function(){ words = ["word"]; for(i=0;i<words.length;i++){if(!RegExp("\\b"+words+"\\b").test($gameVariables.value(x).toLowerCase())){break}};if(words.length===i)return!0})()
1) allows me to check if a given "word 1" occurs in the string before a given "word2"
2) allows me to check if in the string occurs a very specific word: i.e. "head" BUT NOT "headache".
Now...I need to merge these two: I need to check if a very specific "word1" occurs before a given "word2".
Someone more skilled than me in javascript can help? 😢