Would you like to react to this message? Create an account in a few clicks or log in to continue.

Cloud Piece Meso/Exp Exchange

Go down

Cloud Piece Meso/Exp Exchange Empty Cloud Piece Meso/Exp Exchange

Post by Maplepuppet Tue Aug 02, 2011 2:39 pm

Pretty sure anyone could code this but whatever.

Code:

item = [itemID]; // Cloud Piece?
status = -1;
var sel;
var amt = 1000; // Reward amount here
var choice = "exp" // exp or mesos

function start() {
    if (cm.getLevel() < 1) {
        cm.sendNext("Invalid Level.");
        cm.dispose();
        return;
    }
    var text = "Click the Cloud Piece to Proceed#b\r\n";
    for(var i = 0; i < item.length; i++)
        text += "\r\n#L" + i + "##v" + item[i] + "#.#l";
    cm.sendSimple(text);
}

function action(mode, type, selection) {
    status++;
    if (mode != 1) {
        cm.dispose();
        return;
    }
    if (status == 0) {
        sel = selection;
        cm.sendGetNumber("How many  #b#v" + item[sel] + "##k do you want to trade?", 1, 1, 500);
    } else if (status == 1) {
        if(cm.haveItem(item[sel], selection)) {
            cm.gainItem(item[sel], -selection);
            cm.gainExp(amt * selection); // Change gainExp to gainMeso to change to meso exchange
            cm.sendOk("You have received #r"+selection * amt+"#k "+choice+"."); // Pic Exp or Mesos
        } else
            cm.sendOk("Uhh... Hold on, you don't have " + selection + " #v" + item[sel] + "# as you told me. Nice try.");
        cm.dispose();
    }


Untested so it might not work.

Maplepuppet
Lurkin' the forum.

Posts : 30
Join date : 2011-08-02

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum