用其他的写法写好了
function PrefixInteger(num, m) {
return (Array(m).join(0) + num).slice(-m);
}
function switchesshow(){//定义函数
var c = ['']
for (var i = 1; i <201; i++) {
if($gameSwitches.value(i) == true){//检查i号开关的状态
var d = "开";
}else{
var d = "关";
}
if(i%8==0){
var b = " " + PrefixInteger(i, 3) + ":" + d + " ";
c.push(b)
c.push("\n")//c数组每8个元素插入一个换行符
}else{
var b = " " + PrefixInteger(i, 3) + ":" + d + " ";
c.push(b)
}
}
alert(c)
}//在显示框里显示1~200号开关的状态
function valueshow(){//定义函数
var c = ['']
for (var i = 1; i <201; i++) {
if(i%6==0){
var b = " " + PrefixInteger(i, 3) + ":" + PrefixInteger($gameVariables.value(i), 3) + " ";
c.push(b);
c.push("\n");
}else{
var b = " " + PrefixInteger(i, 3) + ":" + PrefixInteger($gameVariables.value(i), 3) + " ";
c.push(b);
}
}
alert(c)
}