Scripting Stuff

Posted by JSteele1234 on Mon 28 May 2001 05:03 AM — 4 posts, 18,660 views.

USA #0
I want to be able to send a line of text from one MU* to another, maybe have all open worlds in an array (worlds[0].send("blah"), or whatever).
Australia Forum Administrator #1
You can do this with a script like this:


dim mylist
dim i
dim otherworld

' get list of worlds
  mylist = world.GetWorldList

' if there is a list, send to every world in it
  if not IsEmpty (mylist) then
    for i = lbound (mylist) to ubound (mylist)
      set otherworld = world.getworld (mylist (i))
      if not (otherworld is nothing) then
        otherworld.send "say blah"
      end if
    next
  end if

USA #2
I don't know any VB, I script in JavaScript. I don't know what most of that does.. arg.
Also another suggestions... make it so that a person can use several scripts for the different languages, like have a script for JavaScript and another for VB for the same world. Sometimes it's easier to code something in one language than another.
Australia Forum Administrator #3
Here it is in JScript. I don't know how useful it is to switch languages for one world. For one thing I only have one script file at present. Surely if you know Jscript you wouldn't want to switch to VBscript half-way through your scripting?



worldlist = new VBArray(world.GetworldList()).toArray();

if (worldlist)  // if not empty
 for (i = 0; i < worldlist.length; i++)
   {
   // get object pointer to this world
   otherworld = world.getworld (worldlist [i]);
   // if it exists send message to it
   if (otherworld != null)
     otherworld.send ("say blah");

   }  // end of looping through worlds