Quick Connect, this world's data

Posted by Zeno on Tue 15 Jun 2004 03:10 PM — 6 posts, 17,617 views.

USA #0
I'm always opening a Quick Connect, and entering the same address and port as my current world, as of I need to test things with another character. What about in the Quick Connect dialog box, you add a drop down box, that has all the open worlds listed, and a button that if clicked, will fill in the address, port, world name of the selected open world?
Australia Forum Administrator #1
How about this? This is an alias that will do that if you type "newworld".


<aliases>
  <alias
   match="newworld"
   enabled="y"
   echo_alias="y"
   send_to="12"
   sequence="100"
  >
  <send>filename = "c:\\newworld.mcl"
Set fs = CreateObject("Scripting.FileSystemObject")
Set file = fs.CreateTextFile(filename, vbTrue )
file.Write "&lt;?xml version=""1.0"" encoding=""iso-8859-1""?&gt;" &amp; vbCrLf
file.Write "&lt;!DOCTYPE muclient&gt;" &amp; vbCrLf
file.Write "&lt;muclient&gt;" &amp; vbCrLf
file.Write "&lt;world defaults=""y"" " &amp; vbCrLf 
file.Write " name=""" &amp; WorldName &amp; " (copy)"" " &amp; vbCrLf
file.Write " site=""" &amp; WorldAddress &amp; """ " &amp; vbCrLf
file.Write " port=""" &amp; WorldPort &amp; """ " &amp; vbCrLf
file.Write "/&gt;" &amp; vbCrLf
file.Write "&lt;/muclient&gt;" &amp; vbCrLf
file.Close
Set fs = Nothing
world.Open filename</send>
  </alias>
</aliases>



You may like to change the first line in the "send" text (the filename) to be something better (eg. add a number to it or something).

What this does is write a small text file like this:


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<muclient>
<world defaults="y" 
 name="Your current world name (copy)" 
 site="your.current.world.address" 
 port="4000" 
/>
</muclient>


It then uses the world.Open command to open it, thus effectively creating a new world with the same settings as the world from which you execute it.

In a couple of minutes' work you could bang the whole thing into a plugin, make it a global plugin, and then the "newworld" alias will work in whatever world you have currently open.
USA #2
Is that alias suppose to work without changing it?


Error number: -2146827284
Event:        Execution of line 2 column 5
Description:  Expected ';'
Line in error: 
Set fs = CreateObject("Scripting.FileSystemObject")
Called by:    Immediate execution
Australia Forum Administrator #3
That particular alias was written to use VBscript - is that the language you have the scripting set to?

If not, I can turn it into a plugin that will use VBscript (or, change the script language yourself).
USA #4
Ah, it was set to Jscript. Not sure why. Alright it works, I'll make a plugin of it sometime soon, thanks.

Made the plugin. Thanks.
Amended on Wed 16 Jun 2004 06:56 PM by Zeno
Australia Forum Administrator #5
Here is a Lua version of the same thing:


<aliases>
  <alias
   match="newworld"
   enabled="y"
   echo_alias="y"
   send_to="12"
   sequence="100"
  >
  <send>

do  -- keep variables local
  local filename = GetInfo (67) .. "newworld.mcl"
  local f = io.output (filename)  -- create world file
  assert (f:write [[
&lt;?xml version="1.0" encoding="iso-8859-1"?&gt;
&lt;!DOCTYPE muclient&gt;
&lt;muclient&gt;
&lt;world defaults="y" 
 name="Your current world name (copy)" 
 site="your.current.world.address" 
 port="4000" 
/&gt;
&lt;/muclient&gt; 
  ]])
  f:close ()  -- close world file now
  
  Open (filename)  -- now get MUSHclient to open the world
end  -- of do

</send>
  </alias>
</aliases>



This one uses GetWorld (67) to open the world file in the current MUSHclient worlds directory.