Junior Spellweaver
- Joined
- Jul 21, 2008
- Messages
- 124
- Reaction score
- 47
Re: [Guide] Learning NPC scripts (beginner's guide)
@nCloud
the cm.haveitem part didn't have ( , ) , or { which you needed
Forgot a semi colon ( at the end of the sendSimple
Forgot to use \r\n#L0#text#l to show the selection. (I just changed it to YesNo)
\r\n = skip one line
#L0# = selection 0 (also #L1# would be selection 1, #L2# would be selection 2, etc.
#l = ends selection
@nCloud
the cm.haveitem part didn't have ( , ) , or { which you needed
Forgot a semi colon ( at the end of the sendSimple
Forgot to use \r\n#L0#text#l to show the selection. (I just changed it to YesNo)
\r\n = skip one line
#L0# = selection 0 (also #L1# would be selection 1, #L2# would be selection 2, etc.
#l = ends selection
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("Goodbye");
cm.dispose();
return;
}
if (mode == 1) {
status++;
}
else {
status--;
}
if (status == 0) {
cm.sendNext("Why, hello there my fellow ninja. It seems you may be in need of some throwing stars...");
}
else if (status == 1) {
if (cm.haveItem(ILBI ID HERE,1)) {
cm.sendYesNo("Ah, it seems you already have some. Shame. Do you want some more?");
}
else {
cm.sendOk("Ummm, seems you could use some. Here, take these.");
cm.gainItem(ILBI ID HERE, 5);
cm.dispose();
}
}
else if (status == 2) {
cm.sendOk("These should help you with your hunting");
cm.gainItem(ILBI ID HERE, 5);
cm.dispose();
}
}
}