Lets take your script and explain
I comment it :)
PHP Code:
/****************************************
Done by bendanx3
*****************************************/
importPackage(net.sf.odinms.client);
var status = 0;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection)
{
if (mode == -1) {
cm.dispose();
} else {
if (mode == 0 && status == 0) {
cm.dispose();
return;
} else if (mode == 1) {
status++;
} else {
status--;
} if (status == 0) {
if (cm.getJob().equals(net.sf.odinms.client.MapleJob.PIRATE)) {
cm.sendSimple("Which would you like to become? #b\r\n#L0#gunslinger #l\r\n#L1#infighter#l#k");
} else {
cm.sendOk(" You are not a pirate! ");
cm.dispose();
}
} else if (status == 1) {
if (selection == 0) {
//status = 1, so when you press Next, mode, which is 1, will make Status++, so status = 2
cm.sendNext("Are you sure you want to become an gunslinger?");
} else if (selection == 1) {
//status = 1
cm.sendNext("Are you sure you want to become a infighter?");
status++; //status = 2
//We ends here, mode will increase status++ since mode = 1.
//2 + 1 = 3
}
} else if (status == 2) {
//We are here thanks to mode.
cm.changeJob(MapleJob.GUNSLINGER);
cm.dispose();
} else if (status == 3) {
//We get 3 ^^
cm.changeJob(MapleJob.INFIGHTER);
cm.dispose();
}
}
}