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.
 Entire forum ➜ MUSHclient ➜ Plugins ➜ Reconnecter (connect after disconnect, or when MUD is down)

Reconnecter (connect after disconnect, or when MUD is down)

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


Posted by Nick Gammon   Australia  (23,121 posts)  Bio   Forum Administrator
Date Mon 30 Sep 2002 10:22 AM (UTC)

Amended on Mon 30 Sep 2002 10:29 AM (UTC) by Nick Gammon

Message
Following a suggestion from Magnum, plus various requests in the past, I present a "reconnecter" that attempts to connect to the MUD if it is down, multiple times. The time between attempts is configurable.

To use, copy the code below the line, paste into a text editor, and save as "Reconnecter.xml", in your plugins directory, and then install it.

The file can also be downloaded from:


http://www.gammon.com.au/mushclient/plugins/ Reconnecter.xml


By changing the entities at the start you can configure the interval between retries, the command that is recognised for a deliberate QUIT, and the commands to initiate connection, or suppress it.

To use, just install. It will detect if your world is connected, and if not, try to connect. If you don't want to connect just now, type NOCONNECT (or whatever you have configured the command to be), case-sensitive.

Once connected, if the connect is dropped it will detect that and attempt to reconnect. However if you type the "quit" command (default QUIT in caps) then it suppresses the reconnection.

If you plan to leave the PC for a while, you might type NOCONNECT to suppress reconnection, and when you return, type CONNECT to activate it again.

You will need to suppress the dialog boxes that appear when you are disconnected, or that will interfere with the process. To do this, go to File -> Global Preferences -> General, and uncheck "Notify me when connection broken" and "Notify me if unable to connect".

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient [
  <!ENTITY interval "10" >
  <!ENTITY quit_command "QUIT" >
  <!ENTITY connect_command "CONNECT" >
  <!ENTITY noconnect_command "NOCONNECT" >
]>
<!-- Saved on Monday, September 30, 2002, 6:21 PM -->
<!-- MuClient version 3.26 -->

<!-- Plugin "Reconnecter" generated by Plugin Wizard -->

<!--
1. Change the entity above "interval" to be the number of seconds
between retries.

2. Change the entity above "quit_command" to be the command you
type to quit (eg. quit, QUIT, @quit or whatever)

3. Change the entity above "connect_command" to be the command you
type to enable connection checking.

4. Change the entity above "noconnect_command" to be the command you
type to disable connection checking.

-->

<muclient>
<plugin
   name="Reconnecter"
   author="Nick Gammon"
   id="83beba4e37b3d0e7f63cedbc"
   language="VBscript"
   purpose="Reconnects when disconnected"
   date_written="2002-09-30 18:20:24"
   requires="3.22"
   version="1.0"
   >
<description trim="y">
<![CDATA[
This plugin will automatically reconnect you when you are disconnected, 
at a user-configurable interval (say, every 5 seconds)
]]>

Reconnecter:help - this help screen

&connect_command;  - enable recconnection (eg. after using &noconnect_command;)

&noconnect_command; - disable reconnection (eg. if you are leaving the PC)

</description>

</plugin>


<!--  Timers  -->

<timers>
  <timer name="ConnectCheckTimer" script="OnConnectCheckTimer" 
  second="&interval;" active_closed="y" enabled="y">

  </timer>
</timers>

<!--  Aliases  -->

<aliases>
  <alias
   script="OnQuit"
   match="&quit_command;"
   enabled="y"
  >
  </alias>

  <alias
   script="OnConnect"
   match="&connect_command;"
   enabled="y"
  >
  </alias>
  <alias
   script="OnNoConnect"
   match="&noconnect_command;"
   enabled="y"
  >
  </alias>
</aliases>

<!--  Script  -->


<script>
<![CDATA[
dim retry

retry = 0
did_quit = vbFalse

sub OnConnectCheckTimer (sName)
'
'  If currently connecting, leave it to do that ...
'

if world.GetInfo (107) then exit sub

'
'  If currently connected, we don't need to check any more
'
if world.IsConnected then
  world.note "World is connected, disabling disconnection check"
  world.enabletimer sName, 0
  exit sub
end if

'
'  If deliberate quit, we don't need to check any more
'
if did_quit then
  world.note "Deliberate quit, disabling disconnection check"
  world.enabletimer sName, 0
  exit sub
end if

'
'  OK, we need to connect now ...
'

retry = retry + 1

world.note "Connecting to world, attempt # " & retry
world.connect

end sub

sub OnPluginDisconnect
'
'  If deliberate quit, we don't need to enable the connection check
'
if did_quit then  exit sub

'
'  We have been disconnected, we need to try connecting again
'
  world.note "Connection checker enabled"
  world.enabletimer "ConnectCheckTimer", 1
end sub

sub OnPluginConnect
'
'  Now we are connected, no need to keep trying to connect
'
  retry = 0
  world.enabletimer "ConnectCheckTimer", 0
'
'  No deliberate quit yet
'
  did_quit = vbFalse
end sub

sub OnPluginInstall
  world.doafternote 1, "Connection checker installed."
end sub

]]>

sub OnQuit (sName, sLine, wildcards)
  did_quit = vbTrue
  world.send "&quit_command;"  ' send to world so it does it
  world.note "Deliberate quit (&quit_command;), reconnect disabled"
end sub

sub OnConnect (sName, sLine, wildcards)
  world.note "Connection checker enabled"
  world.enabletimer "ConnectCheckTimer", 1
  did_quit = vbFalse
end sub

sub OnNoConnect (sName, sLine, wildcards)
  world.note "Connection checker disabled"
  world.enabletimer "ConnectCheckTimer", 0
  did_quit = vbTrue
end sub


</script>


<!--  Plugin help  -->

<aliases>
  <alias
   script="OnHelp"
   match="Reconnecter:help"
   enabled="y"
  >
  </alias>
</aliases>

<script>
<![CDATA[
Sub OnHelp (sName, sLine, wildcards)
  World.Note World.GetPluginInfo (World.GetPluginID, 3)
End Sub
]]>
</script> 

</muclient>



- Nick Gammon

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

Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Reply #1 on Sun 17 Nov 2002 12:36 AM (UTC)
Message
This reconnecter, although it's very useful, has some VERY annoying features... For example, if you press the disconnect button, it reconnects automatically even if you don't want to... Also, if the quit command is sent by a trigger, the reconnecter doesn't stop reconnecting... Oh, and, Nick, please start using the "ignore case" option in triggers and aliases :) "QUIT" is the same as "quit" in my mud, yet the reconnecter doesn't like that... and the plugin wizard's help function alias is case sensitive.

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
Top

Posted by Nick Gammon   Australia  (23,121 posts)  Bio   Forum Administrator
Date Reply #2 on Sun 17 Nov 2002 08:12 PM (UTC)
Message
Well it wasn't supposed to be perfect. :)

Why would you make a trigger to quit you? So if certain input comes from the MUD you quit? I supposed you could add a function "OnPluginSend" to check for the word quit and react to that.

As for a manual disconnect, I don't think a plugin can tell the difference between you using the Disconnect menu and becoming disconnected.

You could probably make a "disconnect" alias that does the disconnect (after setting the "did_quit" flag).

As for the case-sensitivity, I am making aliases case-sensitive so they are less likely to match a MUD command. Maybe it is a pretty useless idea, but that was what I was thinking. You can always add the flag yourself.

- Nick Gammon

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

Posted by yramrang   (4 posts)  Bio
Date Reply #3 on Sun 24 Nov 2002 04:45 AM (UTC)
Message
Hello Nick, this add on is realy terrific for me, I use it very often. I have a slight problem though, Often, my internet connection goes down, every 2 hours to be exact, and the disconect plug in works perfect when I set internet explorer to reconect when a request is made.
The problem is that I want to use a utility that will disconect me and reconect me to the internet before it does it by it self (becouse I get an annoying e-mail when that happens, and I happen to get 12 of those a day...).
But when I do that, I get "Unable to connect to "my char", code=10065 (no route to host)" and it freazes there, I have to click OK and only then the reconect plug in will start working again, wich I cant do when I am away from keyboard doing other things and I want my character connected.

if there was an easy way to make the reconecter plug in overide the no route to host window and try to reconect never the less, could someone make the addition? I would greatly appreciate it.

Thanks for reading this long and gramaticaly incorect post :)
Top

Posted by yramrang   (4 posts)  Bio
Date Reply #4 on Sun 24 Nov 2002 04:55 AM (UTC)
Message
lol, my appologies for spamming... just read the actual help file and discovered that there is a general preferences window in mushclient! fun new stuff for me! :)
all I had to do was disable the disconect windows as the help file sayed, thanks for the flowless plug in again :)
Top

Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Reply #5 on Sun 24 Nov 2002 12:49 PM (UTC)
Message
Yramrang, just whom are you trying to convince? The truth is, as we all know that you suck :p Don't ever post here again, please.
However, yramrang has a point, not in the message box, but in that the plugin is a bit aggressive. I.E., when I press the disconnect button, it starts reconnecting by itself, even though i don't want to (why else would i have pressed the disconnect button?). Can you do something about it?

P.S. I've known Yramrang for a few years, so i don't think he'll be offended :p

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
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.


22,196 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.