status = -1;
var itemList = Array(
5000018,5000221,5000191,5000382,5000345,5000017,5000368,5000274,5000095,5000094,5000096,5000324,5000284,5000285,5000206,5000215,5000225,5000216,5000264,5000267,5000081,5000433,5000434,5000435,5000415,5000416,5000417,5000402,5000403,5000404,5000342,5000343,5000344,5000330,5000331,5000332,5000271,5000272,5000273,5000320,5000321,5000322,5000249,5000250,5000251,5000203,5000204,5000205,5000093,5000092,5000091,5000287,5000288,5000289,5000228,5000229,5000230,5000237,5000243,5000244,5000245,5000247,5000252,5000290,5000292,5000291,5000293,5000294,5000295,5000296,5000297,5000298,5000370,5000369,5000371,5000352,5000353,5000354,5000375,5000376,5000377,5000366,5000367,5000365
);
function start() {
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == 1) {
status++;
} else {
if (mode == 0 && status == 0) {
im.dispose();
return;
}
status--;
}
if (status == 0) {
var text = "";
for(var i=0; i<itemList.length; i++) {
text+="#L"+i+"##v"+itemList+"##z"+itemList+"##l\r\n";
}
im.sendSimple("請選擇你要換取的寵物:\r\n#r"+text);
} else if(status == 1) {
var itemid = itemList[selection];
var itemnum = Math.floor(Math.random()*1+1);
im.gainItem(2430046, -1);
im.gainItem(itemid, itemnum, 3);
im.sendOk("恭喜您,獲得"+itemnum+"個#b#z"+itemid+"#");
im.safeDispose();
}
}
=========================================================
選取自己要的寵物之後會發送到背包
可是滑鼠移動到寵物上就會出現
error code:5
請問小弟哪個環節出錯呢作者: danssun 時間: 2018-4-4 18:16
其實可以不用這樣寫
可以寫成
status = -1;
var itemList = Array(
您要的id,
您要的id,
您要的id,
您要的id,
最後一個要空格
);
function start() {
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == 1) {
status++;
} else {
if (mode == 0 && status == 0) {
im.dispose();
return;
}
status--;
}
if (status == 0) {
var text = "";
for(var i=0; i<itemList.length; i++) {
text+="#L"+i+"##v"+itemList[i]+"##z"+itemList[i]+"##l\r\n";
}
im.sendSimple("请选择你要换取的新手寵物:\r\n#rPS:注意要所有背包格子都要大于1格空位,否则会消失.\r\n#r"+text);
} else if(status == 1) {
var itemid = itemList[selection];
var itemnum = Math.floor(Math.random()*1+1);
if (!im.canHold()) {
im.sendOk("获取失败,包裹空间不足!请确保所有的背包空格都有一格以上。");
im.dispose();
return;
}
var item = im.gainGachaponItem(itemid, itemnum, "新手寵物自選箱(自选)", 3);
im.gainItem(2430894, -1);
im.sendOk("恭喜您,获得了"+itemnum+"个#b#z"+itemid+"#");
im.safeDispose();
}
}作者: 蔡松成 時間: 2018-4-4 18:19 本帖最後由 蔡松成 於 2018-4-4 18:23 編輯
danssun 發表於 2018-4-4 18:16
其實可以不用這樣寫
可以寫成
status = -1;