Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Suggestions ➜ Scripting Stuff

Scripting Stuff

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by JSteele1234   USA  (27 posts)  Bio
Date Mon 28 May 2001 05:03 AM (UTC)
Message
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).

~ JSteele1234 ~
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Mon 28 May 2001 05:30 AM (UTC)
Message
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


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by JSteele1234   USA  (27 posts)  Bio
Date Reply #2 on Mon 28 May 2001 08:58 PM (UTC)
Message
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.

~ JSteele1234 ~
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Mon 28 May 2001 10:38 PM (UTC)

Amended on Mon 28 May 2001 10:39 PM (UTC) by Nick Gammon

Message
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


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


17,794 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.