Fixed an issue where nonstandard statement 'step 0' before standard statement 'step 0' would cause an error

This commit is contained in:
shijian 2023-06-06 13:42:45 +08:00
parent 9d2d950a96
commit 88f0e373d4
1 changed files with 15 additions and 16 deletions

View File

@ -9537,13 +9537,13 @@
//正则表达式
var reg=new RegExp(`['"]step ${k}['"]`);
var result=str.slice(skip).match(reg);
if(result == null) break;
if(result==null) break;
var insertStr;
if(k==0){
var insertStr=`switch(step){case 0:`;
str=str.slice(0, result.index)+insertStr+str.slice(result.index+result[0].length);
skip+=result.index+insertStr.length;
insertStr=`switch(step){case 0:`;
}else{
var insertStr=`break;case ${k}:`;
insertStr=`break;case ${k}:`;
}
var copy=str;
copy=copy.slice(0,skip+result.index)+insertStr+copy.slice(skip+result.index+result[0].length);
//测试是否有错误
@ -9556,7 +9556,6 @@
skip+=result.index+result[0].length;
}
}
}
str=`if(event.step==${k}){event.finish();return;}`+str;
}
return (new Function('event','step','source','player','target','targets',