var yes1 = "Enjoy! \r\n #b(#kYou have traded #r1 Event Trophy for 10,000 NX#b)#k"
var yes2 = "Enjoy! \r\n #b(#kYou have traded #r2 Event Trophies for 22,500 NX#b)#k"
var no = "I'm not sure you have the items needed!"
var status;
function start() {
status = -1;
action(1, 0, 0);
}
function action(m, t, s) {
if (mode == 1) {
status++;
}else{
status--;
}
if (status == 0) {
cm.sendSimple("Hey there #h #, need to trade in a #revent trophy#k? \r\n\r\n #L0#Trade #e1#k Event Trophy for #b10,000 NX#k#l \r\n #L1# Trade #e2#k Event Trophies for #b22,500 NX#k #l");
}else if (status == 1) {
if (selection == 0) {
if (cm.haveItem(4000038, 1)) {
cm.sendOk(yes1);
cm.gainNX(10000);
cm.dispose();
}else{
cm.sendOk(no);
cm.dispose();
}else if (selection == 1) {
if (cm.haveItem(4000038, 2)) {
cm.sendOk(yes2);
cm.gainNX(22500);
cm.dispose();
}else{
cm.sendOk(no);
cm.dispose();
}
}
}
}
}
Thanks,
-Jonathan
21-01-13
Nmb1Gamer
Re: Can someone tell me what's wrong with this script?
var yes1 = "Enjoy! \r\n #b(#kYou have traded #r1 Event Trophy for 10,000 NX#b)#k"; // Missing semicolon or ; var yes2 = "Enjoy! \r\n #b(#kYou have traded #r2 Event Trophies for 22,500 NX#b)#k"; // Same as above var no = "I'm not sure you have the items needed!"; // Same as above var status;
function start() { status = -1; action(1, 0, 0); }
function action(m, t, s) { if (mode == 1) { status++; }else{ status--; } if (status == 0) { cm.sendSimple("Hey there #h #, need to trade in a #revent trophy#k? \r\n\r\n #L0#Trade #e1#k Event Trophy for #b10,000 NX#k#l \r\n #L1# Trade #e2#k Event Trophies for #b22,500 NX#k #l"); } else if (status == 1) { if (selection == 0) { if (cm.haveItem(4000038, 1)) { cm.sendOk(yes1); cm.gainItem(4000038, -1); // Just assuming you want it to take away the item cm.gainNX(10000); cm.dispose(); } else { cm.sendOk(no); cm.dispose(); } // Missing closing bracket for else statement } else if (selection == 1) { if (cm.haveItem(4000038, 2)) { cm.sendOk(yes2); cm.gainItem(4000038, -2); // Assuming you want to remove the item cm.gainNX(22500); cm.dispose(); } else { cm.sendOk(no); cm.dispose(); } } } } // } <- Unnecessary or just not correctly placed
21-01-13
Lapje
Re: Can someone tell me what's wrong with this script?
var yes1 = "Enjoy! \r\n #b(#kYou have traded #r1 Event Trophy for 10,000 NX#b)#k"; //idem var yes2 = "Enjoy! \r\n #b(#kYou have traded #r2 Event Trophies for 22,500 NX#b)#k"; var no = "I'm not sure you have the items needed!"; var status;
function start() { status = -1; action(1, 0, 0); }
function action(m, t, s) { //You defined Mode, Type and Selection as m, t and s. status++; if (m != 1) { cm.dispose(); return; } if (status == 0) { cm.sendSimple("Hey there #h #, need to trade in a #revent trophy#k? \r\n\r\n #L0#Trade #e1#k Event Trophy for #b10,000 NX#k#l \r\n #L1# Trade #e2#k Event Trophies for #b22,500 NX#k #l"); } else if (status == 1) { if (s == 0) { if (cm.haveItem(4000038, 1)) { cm.gainItem(4000038, -1); cm.sendOk(yes1); cm.gainNX(10000); } else { cm.sendOk(no); } } else if (s == 1) { if (cm.haveItem(4000038, 2)) { cm.gainItem(4000038, -2); cm.sendOk(yes2); cm.gainNX(22500); } else { cm.sendOk(no); } } cm.dispose(); //One general dispose has the same effect. //Fixed your syntax } }