Jump to content

Recommended Posts

Posted

I think it could be simplified like this:

function    script    F_RandMes    {

    set .@i, getargcount();

    return getarg(rand(1,.@i));

}

What do you think? /ok
Posted

It should be : 

function    script    F_RandMes    {
    set .@i, getargcount();
    return getarg(rand(0,.@i));
}

since the first argument will be remove ( number of arguments ) 

callfunc("F_RandMes",1129,1222,1163,1357,1360,1522,1811,1410);
Posted

Why not, your way is easier to use.

Also F_RandMes is only used in F_Hi and F_Bye functions in a clean version, it's not a lot of work (lol) to change them

//////////////////////////////////////////////////////////////////////////////////
// *** Function "F_Hi"
//////////////////////////////////////////////////////////////////////////////////
//returns random HELLO message

function	script	F_Hi	{
	return callfunc("F_RandMes",5,"Hi!","Hello!","Good day!","How are you?","Hello there.");
}


//////////////////////////////////////////////////////////////////////////////////
// *** Function "F_Bye"
//////////////////////////////////////////////////////////////////////////////////
//returns random BYE message

function	script	F_Bye	{
	return callfunc("F_RandMes",6,"Bye. See you again.","Later.","Goodbye.","Good luck!","Have a nice day!","Byebye!!!");
}
Posted

even simpler ..??

function script F_RandMes {
    return getarg( rand( getargcount() ) );
}

but i think the name should change too ? since it's not only for "mes"

  • Upvote 1
Posted

Dang... I didn't realize that it only needs a single line...

Does making a 'Pull Request' means that I have to make a fork?

TBH I don't know how :P

Posted

I think it could be simplified like this:

function    script    F_RandMes    {
    set .@i, getargcount();
    return getarg(rand(1,.@i));
}
What do you think? /ok

 

Nanakiwurtz, I think this is very cool... You're awesome to request this :)

  • Upvote 1
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...