- Joined
- Apr 30, 2010
- Messages
- 22
- Reaction score
- 0
Re: [Tut] Learning NPC scripts (beginner's guide)
Hello, I have another script problem. This time its not with an error, but It's on how to set something up. I want to make a selection and have different status in it so that each selection will say multiple things instead of only one thing. I have set up a script how you would do it based on what i learned from this tutorial and i wasn't surprised to see that it didn't work. Here is the script i made just so you can possibly see what i mean. Please help if possible, if this doesn't work it would be helpful if someone could possibly tell me an easier way to do something like this. Thanks again.
Hello, I have another script problem. This time its not with an error, but It's on how to set something up. I want to make a selection and have different status in it so that each selection will say multiple things instead of only one thing. I have set up a script how you would do it based on what i learned from this tutorial and i wasn't surprised to see that it didn't work. Here is the script i made just so you can possibly see what i mean. Please help if possible, if this doesn't work it would be helpful if someone could possibly tell me an easier way to do something like this. Thanks again.
PHP:
var status = 0;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
}
else {
if (status >= 2 && mode == 0) {
cm.sendOk("Cya later!");
cm.dispose();
return;
}
if (mode == 1) {
status++;
}
else {
status--;
}
if (status == 0) {
cm.sendYesNo("Hey, can you help me? I seem to have lost my hat.");
}
else if (status == 1) {
cm.sendNext("I've looked all over the place and can't find it!");
}
else if (status == 2) {
cm.sendSimple("So, can you help me find it?\r\n#L0#It's on your head idiot.#l");
}
else if (status == 3) {
if (selection == 0) {
cm.sendNext("What are you talking about? There's no hat on my head..");
}
else if (status == 4) {
cm.sendNext("Ok, so please get me 50 straw hats, that way I wont ever run out. I'll reward you if you do.");
}
else if (status == 5) {
if cm.haveItem(2000005)) {
cm.sendOk("GREAT! You got my straw hats!" Here's your reward as I promised.");
cm.gainItem(2000006);
cm.dispose();
}
}
else {
cm.sendOk("Are you trying to trick me? *Punches you away* GET ME SOME MORE!");
cm.dispose();
}
}
}
}