nanakiwurtz Posted August 27, 2013 Share Posted August 27, 2013 I think it could be simplified like this: function script F_RandMes { set [email protected], getargcount(); return getarg(rand(1,[email protected])); }What do you think? Link to comment Share on other sites More sharing options...
Patskie Posted August 27, 2013 Share Posted August 27, 2013 It should be : function script F_RandMes { set [email protected], getargcount(); return getarg(rand(0,[email protected])); } since the first argument will be remove ( number of arguments ) callfunc("F_RandMes",1129,1222,1163,1357,1360,1522,1811,1410); Link to comment Share on other sites More sharing options...
nanakiwurtz Posted August 27, 2013 Author Share Posted August 27, 2013 function script F_RandMes { set [email protected], getargcount()-1; return getarg(rand(0,[email protected])); } Link to comment Share on other sites More sharing options...
Patskie Posted August 27, 2013 Share Posted August 27, 2013 Ahh i forgot that it will start from 0 haha Link to comment Share on other sites More sharing options...
Euphy Posted August 27, 2013 Share Posted August 27, 2013 You can use pull requests for something like this, you know. Want to give it a shot? Link to comment Share on other sites More sharing options...
DeadlySilence Posted August 27, 2013 Share Posted August 27, 2013 Is there any specific reason a variable is initialized for only one use? Wouldn't function script F_RandMes { return getarg(rand(0, (getargcount() - 1))); } be better? Link to comment Share on other sites More sharing options...
Capuche Posted August 27, 2013 Share Posted August 27, 2013 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!!!"); } Link to comment Share on other sites More sharing options...
Emistry Posted August 27, 2013 Share Posted August 27, 2013 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" 1 Link to comment Share on other sites More sharing options...
nanakiwurtz Posted August 27, 2013 Author Share Posted August 27, 2013 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 Link to comment Share on other sites More sharing options...
Patskie Posted August 27, 2013 Share Posted August 27, 2013 Lol 1 rep for ya @Emistry . Why not make it simply F_Rand or even F_Random :3 Link to comment Share on other sites More sharing options...
Skorm Posted August 29, 2013 Share Posted August 29, 2013 I think it could be simplified like this: function script F_RandMes { set [email protected], getargcount(); return getarg(rand(1,[email protected])); }What do you think? Nanakiwurtz, I think this is very cool... You're awesome to request this 1 Link to comment Share on other sites More sharing options...
Euphy Posted September 5, 2013 Share Posted September 5, 2013 Implemented in 66a2bfd. Link to comment Share on other sites More sharing options...