PASTE BIN : /* @Author Kyodia * NPC for : DRAZELMS * Purpose : Event Trophy Trade-I - Pastebin.com
or
THE CODE
Spoiler:
Thanks,
-Jonathan
PASTE BIN : /* @Author Kyodia * NPC for : DRAZELMS * Purpose : Event Trophy Trade-I - Pastebin.com
or
THE CODE
Spoiler:
Thanks,
-Jonathan
Here you are...
PHP Code:/*
@Author Kyodia
* NPC for : DRAZELMS
* Purpose : Event Trophy Trade-In
*/
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
^ That won't work.
PHP Code:/*
@Author Kyodia
* NPC for : DRAZELMS
* Purpose : Event Trophy Trade-In
*/
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
}
}
Last edited by Lapje; 21-01-13 at 11:43 AM. Reason: BB tag typo