Script, auto-reconnect

Posted by Zeno on Sun 08 Aug 2004 08:50 PM — 7 posts, 18,472 views.

USA #0
I want to make a script that will attempt a connection when the connection to a world is lost, every 1 minute for example. If it fails to connect, it won't open a "Failed connection" window, but instead, it will send text to the closed world saying the time, and what error it had.

I don't know any of the script commands to do this, could someone help me do this?
USA #1
There is a "Reconnector" plugin (check your plugin folder). You need to turn off the "failed to connect" notifications (those are the popup things on connection lost and such). You turn them off in global preferences, under the general tag.
USA #2
I don't see it in the plugin directory. Also, I don't want to turn off notify disconnect windows totally, only when the world is trying to re-connect, and is currently not connected.

[EDIT] I got the plugin from the site. Let me try it out.

Eh, it reconnects when I type 'quit' and it also doesn't send text to the world when the connection fails. Anyway to change this?

Its suppose to check for quitting, but it doesn't work.


quit
Your vision begins to blur, as a vortex of colors expands before your eyes
and envelops your body... When you come to, things are not as they were.

A demonic voice rasps, 'You shall be back here soon enough, Zeno...'
Connection checker enabled
--- Disconnected on Sunday, August 08, 2004, 8:01 PM ---
--- Connected for 1 minute, 21 seconds ---

Connecting to world, attempt # 1

--- Connected on Sunday, August 08, 2004, 8:01 PM ---



Ah, its case sensitive. I have to use "QUIT". Anyway to make it both quit and QUIT? An alias for quit->QUIT doesn't work.

Also, when I disconnect; (Ctrl+Shift+K) it reconnects me.
Amended on Mon 09 Aug 2004 12:17 AM by Zeno
Australia Forum Administrator #3
Have a look inside the plugin:


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


That should be pretty self-explanatory.

About the 4th line of the plugin reads:

<!ENTITY quit_command "QUIT" >


Just change that.

As for the reconnect when you disconnect it, well that is what it is supposed to do. Fix the line above and you should be right. Then you see something like this in your output window:


> QUIT
Deliberate quit (QUIT), reconnect disabled

USA #4
Yeah, I already modified the plugin to what I wanted, except that I don't know how to define quit_command as two things, quit and QUIT.

Also, is there a script function that disables "Notify is unable to connect"? Or a function that sends the notification to the world, instead of a window?
USA #5
Since you're not distributing the plugin, you can go in and change the match text of the alias itself, to match QUIT|quit (which, if you edited the alias to make it a regexp, you could then put in your entity). OR you can just change it to ignore case, then quit, Quit, QUIT, or any combination will work.

As for the connect thing, It would make sense if World.Connect could return the errors. Except, then you'd have your script (and client) hang until it resolved. Perhaps a callback for disconnect could include a reason why? (since the world not being able to connect still triggers the "disconnect" plugin callback)
USA #6
Ah, didn't notice that it was an alias. Ignore case worked fine.

The reason I want to have it not open a window, is because if it fails to connect multiple times, it will have multiple windows waiting, or simply not resume past the first window, if the "Okay" button is clicked. For example, if I'm not at the computer, but I want to know why it failed. I'm going to experiment with a few functions, see what I can come up with. Any more ideas would help, thanks.