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 ➜ Need more control

Need more control

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


Posted by Rire   (5 posts)  Bio
Date Mon 27 May 2002 07:14 AM (UTC)
Message
K... I am missing a few functional commands I'm used to using while scripting.

I need a command to cause the host of my script to refresh itself without waiting for the script to end... VB implements this with the DoEvents command, and might be used like this:

For X = 1 To 100
World.Send "Test " & X
' K... The text we just send won't be received until
' the script ends. Then all the tests will be sent at
' the SAME TIME. Let's update the host application:
DoEvents
Next X

-- Thanks

I need a command to cause my scripts to delay... My delay routine is not very good, because writing timers through scripts is VERY unreliable. zMud --I know, that's a competitor, and everyone compares to zMud, but hey-- implements this feature through the #WAIT command

#REPEAT 100 {
Test %i
#WAIT 1000
}

-- Thanks again

I would really like to control menu items and status bars through my script. With the script controls you can easily add any object you like, including the script control itself. If you could add your menus or other parts of the interface that are object based, I would greatly appreciate it. (PS. A simple list of any properties and methods supported by those objects would be nice. )

Umm.... Thanks for reading this... If you got this far, I owe you a coke.

Thanks for listening
--Rire
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #1 on Mon 27 May 2002 08:46 AM (UTC)
Message
Have you tried using the built in timers? (See "AddTimer" on the function page - Linked from MUSHclient homepage).

If you program the script to stall, it holds up the whole program. MUSHclient Timers do not have that problem.

You could put all your SENDs in one subroutine, and call that subroutine from a timer, which you add/enable elsewhere in your script.

Otherwise, I would suggest adding all the lines to send to a variable (with CR/LF's built in), and echo the string at the appropriate time.

The only downside [some people complain about] to the built in timer, is that it has to be in whole seconds (I.E.: Not a fraction of a second). That hasn't been a problem for me yet.

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #2 on Mon 27 May 2002 09:41 PM (UTC)

Amended on Mon 27 May 2002 09:42 PM (UTC) by Nick Gammon

Message
Quote:

I need a command to cause my scripts to delay... My delay routine is not very good, because writing timers through scripts is VERY unreliable.


The problem with trying to delay in the middle of the script is that if you succeed, then nothing else can happen while you do it. You can loop 1000 times but that just slows the program down.

Even if you could make it pause with something like DoEvents, what would happen if, during that pause, more text arrived from the MUD, a trigger fired, and the same script got called again (while it was still in the middle)? It would all get to be a mess.

MUSHclient provides a number of ways of doing this, as Magnum said. Usually timers will do the trick, and for simple cases you can use "DoAfter". For example, if you want to send some tests every few seconds, try this:


world.DoAfter 1, "Test 1"
world.DoAfter 2, "Test 2"
world.DoAfter 3, "Test 3"
world.DoAfter 4, "Test 4"
world.DoAfter 5, "Test 5"

- 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.


12,873 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.