javascript - 在 Passage.render() 中使用 _.template(): SyntaxError: missing ) 在参数列表之后
问题描述
我在玩雪人(Twine 2),并试图让一些 if/else 语句根据一个人之前所做的事情来做某事(特别是根据一个人按下“等待”的时间长短)。我尝试的第一件事没有问题:
<%
if(s.wait == 3){
print('"Well, it appears that we did it correctly after all." His voice sounds deep and gutteral, with a hint of annoyance. "For being some prophesied being, you sure like to keep people waiting. Even my patience has limits."');
s.ichor = 4;
} else if(s.wait < 3){
print('"So this is the prophesied being?" His voice is deep and gutteral, practically beastial. "While I cannot say I had any expectations, you just seem... a little plain."');
s.ichor = 5;
}
%>
这里的段落运行没有问题,但是一旦到达下一个,它总是给出以下错误:
在 Passage.render() 中使用 _.template(): SyntaxError: missing ) 在参数列表之后
下一段:
<%
if(s.wait == 3) {
print('"How exciting that it worked!" His voice is filled with excitement, like a child looking a gift he just opened. "I'll admit, I was worried for a moment there, though that we had messed it up, that it was all for naught? Glad it wasn't!"');
s.sturm = 5;
}
if(s.wait < 3 && s.wait > 0){
print('"How exciting that it worked!" His voice is filled with excitment, like a child looking a gift he just opened. "So this is what you look like- I look forward to working with you!"');
s.sturm = 6;
} else {
print('"How exciting that it worked!" His voice is filled with excitement, like a child looking a gift he just opened. "So this is what you look like- I look forward to working with you!"');
s.sturm = 5;
}
%>
我是java脚本的新手,所以我不知道问题是什么。任何帮助将不胜感激!
解决方案
改变这个
<%
if(s.wait == 3) {
print('"How exciting that it worked!" His voice is filled with excitement, like a child looking a gift he just opened. "I'll admit, I was worried for a moment there, though that we had messed it up, that it was all for naught? Glad it wasn't!"');
s.sturm = 5;
}
if(s.wait < 3 && s.wait > 0){
print('"How exciting that it worked!" His voice is filled with excitment, like a child looking a gift he just opened. "So this is what you look like- I look forward to working with you!"');
s.sturm = 6;
} else {
print('"How exciting that it worked!" His voice is filled with excitement, like a child looking a gift he just opened. "So this is what you look like- I look forward to working with you!"');
s.sturm = 5;
}
%>
至
<%
if(s.wait == 3) {
print("'How exciting that it worked!' His voice is filled with excitement, like a child looking a gift he just opened. 'I'll admit, I was worried for a moment there, though that we had messed it up, that it was all for naught? Glad it wasn't!'");
s.sturm = 5;
}
if(s.wait < 3 && s.wait > 0){
print('"How exciting that it worked!" His voice is filled with excitment, like a child looking a gift he just opened. "So this is what you look like- I look forward to working with you!"');
s.sturm = 6;
} else {
print('"How exciting that it worked!" His voice is filled with excitement, like a child looking a gift he just opened. "So this is what you look like- I look forward to working with you!"');
s.sturm = 5;
}
%>
您的引号导致语法错误,因为您在外面使用了单曲。
您也可以转义引用:
<%
if(s.wait == 3) {
print('"How exciting that it worked!" His voice is filled with excitement, like a child looking a gift he just opened. "I\'ll admit, I was worried for a moment there, though that we had messed it up, that it was all for naught? Glad it wasn't!"');
s.sturm = 5;
}
if(s.wait < 3 && s.wait > 0){
print('"How exciting that it worked!" His voice is filled with excitment, like a child looking a gift he just opened. "So this is what you look like- I look forward to working with you!"');
s.sturm = 6;
} else {
print('"How exciting that it worked!" His voice is filled with excitement, like a child looking a gift he just opened. "So this is what you look like- I look forward to working with you!"');
s.sturm = 5;
}
%>
推荐阅读
- javascript - 如何在使用 axios-cache-adapter 时获取缓存响应
- sql - 如何从100中获得百分比的薪水
- python - 在已经运行的 webdriver 上进行输入
- c - 在c中从堆栈中读取格式字符串失败
- react-native - React Navigation v5:用于标题屏幕交互的 useEffect()?
- python - 输出尺寸不匹配与 pytorch 中模型摘要报告的内容
- java - 加密或散列
- python - 使用 selenium 优化线程
- javascript - 从 Firebase Firestore 获取图像并将它们添加到“li”
- sql - 我们如何在 oracle 中表示重复的数字?