Whats Wrong With This Npc Script?
Re: Whats Wrong With This Npc Script?
No errors at all in your batch files?
Re: Whats Wrong With This Npc Script?
There were quite some syntax errors. You might want to check that you have all needed functions in your source. Also, are you aware of the fact that you only have functionality for two or three options? And that the other twelve simply do nothing?
Thank me.
PHP Code:
/**By JarrYD
**/
var status = 0;
var selected = 1;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode < 1)
cm.dispose();
else {
if (mode == 1)
status++;
else
status--;
}
if (status == 0) {
cm.sendYesNo("Welcome to the SRB NPC. You need 30K of each stat (STR, DEX, INT, LUK) to do an SRB. Would you like a description of the SRB System?");
} else if (status == 1) {
cm.sendNext("decription.");
} else if (status == 2) {
cm.sendSimple("What SRB do you want to choose?#k\r\n#bSRB 1:#L0#STR Item#l\r\n#L1#DEX Item#l\r\n#L2#INT Item#l\r\n#L3#LUK Item#l\r\n#gSRB 2:#L4#STR Item#l\r\n#L5#DEX Item#l\r\n#L6#INT Item#l\r\n#L7#LUK Item#l\r\n#dSRB 3:#L8#STR Item#l\r\n#L9#DEX Item#l\r\n#L10#INT Item#l\r\n#L11#LUK Item#l\r\n#rSRB 4:#L12#STR Item#l\r\n#L13#DEX Item#l\r\n#L14#INT Item#l\r\n#L15#LUK Item#l");
} else if (status == 3) {
selected = selection;
if (selection == 0) {
if (cm.getPlayer().getStr() > 29999 && cm.getPlayer().getDex() > 29999 && cm.getPlayer().getInt() > 29999) {
cm.sendSimple("Pick an Item:\r\n\r\n"+cm.EquipList(cm.getC()));
} else {
cm.sendOk("You do not have the required stats or items.");
cm.dispose();
}
} else if (selection == 1) {
if (cm.getPlayer().getStr() > 29999 && cm.getPlayer().getDex() > 29999 && cm.getPlayer().getInt() > 29999) {
cm.sendSimple("Pick an Item:\r\n\r\n"+cm.EquipList(cm.getC()));
} else {
cm.sendOk("You do not have the required stats or items.");
cm.dispose();
}
}
} else if (status == 4) {
if (selection == 0) {
cm.MakeSRB1STR(selected);
cm.getPlayer().setStr(4);
cm.getPlayer().setDex(4);
cm.getPlayer().setInt(4);
cm.getPlayer().setLuk(4);
cm.reloadChar();
cm.dispose();
} else
cm.dispose();
}
}
Re: Whats Wrong With This Npc Script?
Quote:
Originally Posted by
Lapje
There were quite some syntax errors. You might want to check that you have all needed functions in your source. Also, are you aware of the fact that you only have functionality for two or three options? And that the other twelve simply do nothing?
Thank me.
PHP Code:
/**By JarrYD
**/
var status = 0;
var selected = 1;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode < 1)
cm.dispose();
else {
if (mode == 1)
status++;
else
status--;
}
if (status == 0) {
cm.sendYesNo("Welcome to the SRB NPC. You need 30K of each stat (STR, DEX, INT, LUK) to do an SRB. Would you like a description of the SRB System?");
} else if (status == 1) {
cm.sendNext("decription.");
} else if (status == 2) {
cm.sendSimple("What SRB do you want to choose?#k\r\n#bSRB 1:#L0#STR Item#l\r\n#L1#DEX Item#l\r\n#L2#INT Item#l\r\n#L3#LUK Item#l\r\n#gSRB 2:#L4#STR Item#l\r\n#L5#DEX Item#l\r\n#L6#INT Item#l\r\n#L7#LUK Item#l\r\n#dSRB 3:#L8#STR Item#l\r\n#L9#DEX Item#l\r\n#L10#INT Item#l\r\n#L11#LUK Item#l\r\n#rSRB 4:#L12#STR Item#l\r\n#L13#DEX Item#l\r\n#L14#INT Item#l\r\n#L15#LUK Item#l");
} else if (status == 3) {
selected = selection;
if (selection == 0) {
if (cm.getPlayer().getStr() > 29999 && cm.getPlayer().getDex() > 29999 && cm.getPlayer().getInt() > 29999) {
cm.sendSimple("Pick an Item:\r\n\r\n"+cm.EquipList(cm.getC()));
} else {
cm.sendOk("You do not have the required stats or items.");
cm.dispose();
}
} else if (selection == 1) {
if (cm.getPlayer().getStr() > 29999 && cm.getPlayer().getDex() > 29999 && cm.getPlayer().getInt() > 29999) {
cm.sendSimple("Pick an Item:\r\n\r\n"+cm.EquipList(cm.getC()));
} else {
cm.sendOk("You do not have the required stats or items.");
cm.dispose();
}
}
} else if (status == 4) {
if (selection == 0) {
cm.MakeSRB1STR(selected);
cm.getPlayer().setStr(4);
cm.getPlayer().setDex(4);
cm.getPlayer().setInt(4);
cm.getPlayer().setLuk(4);
cm.reloadChar();
cm.dispose();
} else
cm.dispose();
}
}
Awesome! So I cant add more selections under status 3 and 4?
Quote:
Originally Posted by
JarrYDx
Awesome! So I cant add more selections under status 3 and 4?
And also, is it possible to make something like this work then? This one just does all the other things but doesnt let you select the item.
\
Re: Whats Wrong With This Npc Script?
You can add more selections.
Re: Whats Wrong With This Npc Script?
Quote:
Originally Posted by
Xerixe
You can add more selections.
Alright thanks, so how would I do that from the script I have now
Quote:
Originally Posted by
Lapje
There were quite some syntax errors. You might want to check that you have all needed functions in your source. Also, are you aware of the fact that you only have functionality for two or three options? And that the other twelve simply do nothing?
Thank me.
PHP Code:
/**By JarrYD
**/
var status = 0;
var selected = 1;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode < 1)
cm.dispose();
else {
if (mode == 1)
status++;
else
status--;
}
if (status == 0) {
cm.sendYesNo("Welcome to the SRB NPC. You need 30K of each stat (STR, DEX, INT, LUK) to do an SRB. Would you like a description of the SRB System?");
} else if (status == 1) {
cm.sendNext("decription.");
} else if (status == 2) {
cm.sendSimple("What SRB do you want to choose?#k\r\n#bSRB 1:#L0#STR Item#l\r\n#L1#DEX Item#l\r\n#L2#INT Item#l\r\n#L3#LUK Item#l\r\n#gSRB 2:#L4#STR Item#l\r\n#L5#DEX Item#l\r\n#L6#INT Item#l\r\n#L7#LUK Item#l\r\n#dSRB 3:#L8#STR Item#l\r\n#L9#DEX Item#l\r\n#L10#INT Item#l\r\n#L11#LUK Item#l\r\n#rSRB 4:#L12#STR Item#l\r\n#L13#DEX Item#l\r\n#L14#INT Item#l\r\n#L15#LUK Item#l");
} else if (status == 3) {
selected = selection;
if (selection == 0) {
if (cm.getPlayer().getStr() > 29999 && cm.getPlayer().getDex() > 29999 && cm.getPlayer().getInt() > 29999) {
cm.sendSimple("Pick an Item:\r\n\r\n"+cm.EquipList(cm.getC()));
} else {
cm.sendOk("You do not have the required stats or items.");
cm.dispose();
}
} else if (selection == 1) {
if (cm.getPlayer().getStr() > 29999 && cm.getPlayer().getDex() > 29999 && cm.getPlayer().getInt() > 29999) {
cm.sendSimple("Pick an Item:\r\n\r\n"+cm.EquipList(cm.getC()));
} else {
cm.sendOk("You do not have the required stats or items.");
cm.dispose();
}
}
} else if (status == 4) {
if (selection == 0) {
cm.MakeSRB1STR(selected);
cm.getPlayer().setStr(4);
cm.getPlayer().setDex(4);
cm.getPlayer().setInt(4);
cm.getPlayer().setLuk(4);
cm.reloadChar();
cm.dispose();
} else
cm.dispose();
}
}
Tested, same problem as my last one, you select the item and then after you do nothing happens, No bat errors or anything, you just get disposed or something.
Re: Whats Wrong With This Npc Script?
I don't quite get what you're trying to do with the script, but it lacks so much and is so inefficiently written that I wouldn't recommend continuing it. If you tell me what you want to happen and give me all the needed methods then I can write you a working one.
Re: Whats Wrong With This Npc Script?
Quote:
Originally Posted by
Lapje
I don't quite get what you're trying to do with the script, but it lacks so much and is so inefficiently written that I wouldn't recommend continuing it. If you tell me what you want to happen and give me all the needed methods then I can write you a working one.
Edit:
Nevermind finished off my code. Cheers man!