Kk ... so here's a task for one of you diehard Lua people out there :-D. I made a random ooc (global on this specific mud) alias that takes the list of aliases, selects all of them under the "global" group, puts them in an array, then randomly chooses which to spit out. It also replaces the %1 in the "send" field of the array to the text from "ooc *". I have had some people ask me if they can send me the alias, but they have scripts in Lua, and don't want to switch to JScript just for a nifty little alias. So ... my question is, can anyone convert this into Lua for me?
Edited for formatting
aliaslist = new VBArray(world.GetAliasList()).toArray();
nums = new Array(100); // Gets list of aliases
var k = 0 ;
for (i=0;i<aliaslist.length;i++) {
if( world.GetAliasOption(aliaslist[i], "group") == "global") { // if alias is grouped "global"
nums[k] = world.GetAliasOption(aliaslist[i], "send") ; // and the send field to nums alias
k++; increases spot that next alias will be placed in, and the max for the random number generator
}
}
var generator = Math.random()*(k); // selects random number that is in use
generator = Math.ceil(generator)-1; // fixes numbers so they range from 0 - nums.length
text = new String(nums[generator]) ;
var deleteafter = text.indexOf("%") ;
text1 = new String(text.substring(0, deleteafter)) ;
text2 = new String(text.substring(deleteafter+2, text.length)) ;
text = text1+"%1"+text2 // removes the %1 from the Send field, and replaces it with the %1 captured by the alias
world.Send(text); // sends text via random alias
Edited for formatting