[Release] Random Number Guessing Game!! V2!

Skilled Illusionist
Joined
Jun 21, 2008
Messages
305
Reaction score
3
Add this to NPCconversationmanager.java

Code:
    public int getRandom(int start, int end) {
        return (int)Math.floor(Math.random()*end+start);
    }


Code:
/*
 Made by RICHHHYYYY <3
*/

var status = -1;
var rofl = 1 
var isuck = 10000
function start() { 
    action(1, 0, 0); 
} 

function action(mode, Richy, Richyyy) { 
    if (mode != 1) { 
        cm.dispose(); 
        return;
    } else
        status++; 
    if(status == 0){
        cm.sendGetText ("Hi, I'm the guy that thinks of numbers... Pick a number 1-3");
    }else if(status == 1){  
        var lol = cm.getRandom(1, 3);
        if (cm.getText() == lol) {
            cm.sendOk ("Congratz");
            cm.gainMeso (rofl);
        } else {
        if (cm.getText() > 3) {
            cm.sendOk ("This number is out of range =[");
            cm.dispose();
        } else {
            cm.sendOk ("You suck =[");
            cm.gainMeso (isuck);
             cm.dispose();
            }
}
}
}

Code:
Credits:
Bassoe - NPC Command
XxOsirisxX  - Helped me fix NPC!
 
random just takes a random value out of the provided start and end value
this is exactly the reason i released it, well done

edit: (even though the script sucks a little bit, im glad you actually used my release lulz)
 
Nice job but it's usually good to make the variables meaningful

You mean like:
Code:
/*
 Made by RICHHHYYYY <3
*/

var status = -1;
var price = 1 
var price2 = 10000
function start() { 
    action(1, 0, 0); 
} 

function action(mode, Richy, Richyyy) { 
    if (mode != 1) { 
        cm.dispose(); 
        return;
    } else
        status++; 
    if(status == 0){
        cm.sendGetText ("Hi, I'm the guy that thinks of numbers... Pick a number 1-3");
    }else if(status == 1){  
        var lol = cm.getRandom(1, 3);
        if (cm.getText() == lol) {
            cm.sendOk ("Congratz");
            cm.gainMeso (price);
        } else {
        if (cm.getText() > 3) {
            cm.sendOk ("This number is out of range =[");
            cm.dispose();
        } else {
            cm.sendOk ("You suck =[");
            cm.gainMeso (price2);
             cm.dispose();
            }
}
}
}
 
You mean like:
Code:
/*
 Made by RICHHHYYYY <3
*/

var status = -1;
var price = 1 
var price2 = 10000
function start() { 
    action(1, 0, 0); 
} 

function action(mode, Richy, Richyyy) { 
    if (mode != 1) { 
        cm.dispose(); 
        return;
    } else
        status++; 
    if(status == 0){
        cm.sendGetText ("Hi, I'm the guy that thinks of numbers... Pick a number 1-3");
    }else if(status == 1){  
        var lol = cm.getRandom(1, 3);
        if (cm.getText() == lol) {
            cm.sendOk ("Congratz");
            cm.gainMeso (price);
        } else {
        if (cm.getText() > 3) {
            cm.sendOk ("This number is out of range =[");
            cm.dispose();
        } else {
            cm.sendOk ("You suck =[");
            cm.gainMeso (price2);
             cm.dispose();
            }
}
}
}

i think so
 
메이플 한국;4713181 said:
nice tags anyways,
nice release but i still don't understand how this works

You have to write a random number and you get mesos if you are correct, if not you nly get 1.
 
Back