cm.getText Warper

Re: [Release] cm.getText Warper

How do you know about cm.getText? I thought I was the first one to make something which uses that in a release.

BTW this is inefficient, making all the names and stuff ((hint: ignorecase) you should stick with an array.

Umm, I used it in my release for my NX selling NPC. It lets you type in an amount of NX, using a certain mesos to NX rate. Mine was like 1mil mesos to 1k NX. Would posting the link here as an example be "advertising" or something?
 
Re: [Release] cm.getText Warper

And credits to me for releasing sendGetText() and sendGetNumber().

Check the SVN, if it was up..

And credits to me for releasing sendGetText() and sendGetNumber().

Check the SVN, if it was up..

Oh please, use an array.
PHP:
var townnames = Array("Henesys", "Ellinia", "Kerning City", "Perion", "Lith Harbour");
//townnames[0] = Henesys, so townids[0] MUST BE Henesys's mapid, 
//else you will be warped to another map.
var townids = Array(10000000, 101000000, 103000000, 102000000, 104000000);

//end of configuration, do not touch unless you know what you're doing!
var selectedMapId = -1;
var status = 0;

function start() {
    status = -1;
    action(1, 0, 0);
}

function getTownId(townNameStr)
{
    for(int iter = 0; iter < townnames.length; iter++;) {
        if(townNameStr.equalsIgnoreCase(townnames[iter])) return townids[iter];
    }
    return -1;
}

function action(mode, type, selection) {
    if (mode == -1) {
        cm.dispose();
    } else {
        if (mode == 0 && status == 0) {
            cm.sendOk("Alrighty, cya around!");
            cm.dispose();
            return;
        }
        if (mode == 1)
            status++;
        else
            status--;

        if (status == 0) {
            cm.sendGetText("Please type in a town name:");
        } else if (status == 1) {
            var mapId = getTownId(cm.getText());
            if(mapId != -1) {
                selectedMapId = mapId;
                cm.sendYesNo("Go to " + cm.getText() + "?");
            } else {
                cm.sendOk("Invalid town name.");
                cm.dispose();
                return;
            }
        } else if (status == 2) {
            if(selectedMapId != -1) {
                cm.warp(selectedMapId, 0);
                cm.dispose();
                return;
            } else {
                cm.sendOk("This isn't supposed to happen..");
                cm.dispose();
                return;
            }
        }
    }
}
 
Back