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 ➜ Build new worlds from plugins

Build new worlds from plugins

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


Posted by Ked   Russia  (524 posts)  Bio
Date Mon 29 Mar 2004 08:16 PM (UTC)
Message
While porting a bunch of triggers from the main world file to a separate plugin I realized that Mushclient makes a pretty decent IDE for building plugins. All that is needed to make a new plugin is to open an empty world file, add whatever triggers/aliases/timers are needed, snap a script file to it, and then just dump the whole thing into a plugin using the wizard. However, rewriting an existing plugin using this method can be problematic. I tried creating a new world using an existing plugin as a template and it generally worked, with all the triggers/timers/aliases appearing in the created world, but Mushclient refused to recognize <plugin> and <script> tags in the plugin, resulting in no script file. So the suggestion is to allow the client to create a new scriptfile, with a required extension (using the language property of the <plugin> tag) and attach it automatically to the world file if the latter is being created from a plugin. That would make writing those a whole lot easier, especially big ones.
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #1 on Tue 30 Mar 2004 03:59 AM (UTC)
Message
Yes, there is a slight difference in the manner by which world files and plugin files are saved.

When I originally proposed the idea of plugins to Nick, I imagined it a little more like you do, where the main world and plugins would be far more similar. I still feel there are a pile of world settings that could be duplicated in a plugin. Things such as the colour of commands sent to the mud.

Unfortunately, things are the way they are because of the nature by which the software evolved. Plugins were a concept that came along well after MUSHclient was already a fine working product. Had they been concieved early, I'm sure Nick may have programmed the client differently.

One thing I would very much like to see myself, is a rewrite of the world configuration interface. For one thing, there are several sub-window lists within the configuration (such as aliases, triggers) which require scrollbars, and I've always hated subwindows within a larger window that can NOT be resized and expanded.

I feel that the whole world configuration interface would be much more useful if it also served as a plugin configuration interface. Much of options serve both world files and plugin files, such as aliases, triggers, etc.

This would most likely require a re-organization of the whole interface. Settings that are only appropriate for the world would need to be separated from settings that can apply to both the world file or a plugin file.

If you look at the world configuration screen now, you see something like this:

+ General
+ Appearance
+ Input
+ Paste/Send
+ Scripting
I think the expandable tree on the left side works, however it should be reorganized. The configuration window should also be made resizeable. A new layout may look like this:

- World
|  - General
|  |  |- Info
|  |  |- IP Address
|  |  |- Connecting
|  |  |- Logging
|  |  |- Chat
|  |  |_ Notes
|  - Appearance
|  |  |- ANSI Colour
|  |  |- Custome Colour
|  |  |- MXP / Pueblo
|  |  |- Output
|  |  |- Sounds
|  |  |_ Printing
|  - Input
|  |  |- Commands
|  |  |- Keypad
|  |  |- Macros
|  |  |_ Autosay
|  + Paste / Send
|  - Tools
|     |- Aliases
|     |- Triggers
|     |- Timers
|     |_ Scripting
- Plugin: AOD_EQ
|  - Input
|  |  |_ Commands
|  - Tools
|     |- Aliases
|     |- Triggers
|     |- Timers
|     |_ Scripting
+ Plugin: StatLine
+ Plugin: AOD_Speedwalks
+ Plugin: Chat
With a setup like that, you could look at Aliases within your world file, copy them, then just expand your plugin and paste in the Aliases section there.

I suppose the slight awkwardness to this arrangement is that plugins may seem like they are meant to be written, tweaked and debugged, then left alone. Well, at least the ones we intend to distribute. This kind of interface makes it very easy for anyone to add a new trigger to a plugin. (Too easy?). Hmm.

You can scan the forums and find some old threads where Nick and I and others discussed the concept of plugins before they were implemented, and some of the pitfalls to versatility were mentioned by Nick.

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

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

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #2 on Tue 30 Mar 2004 04:12 AM (UTC)

Amended on Tue 30 Mar 2004 04:17 AM (UTC) by Magnum

Message
In the meantime, what I have done is to create an empty 'shell' plugin. This basically has all the common elements required for a plugin.

As I develop the plugin, I may sometimes add an alias or trigger to my world file, then 'copy' it, remove it from the world, then 'paste' it into the plugin file (opened in a text editor).

Here is my default plugin:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient [
	<!ENTITY NoteColour "#000000" >
	<!ENTITY NamePrefix "" >
	]>

<muclient>
<plugin
	name=""
	date_written = "2003-01-16"
	date_modified = "2003-11-18"
	version="1.0"
	requires="3.25"
	author="Magnum"
	id=""			<!-- /world.note world.getuniqueid -->
	purpose=""
	language="VBscript"
	save_state="y"
	>

<description trim="y">
<![CDATA[
This is a Magnum's Default plugin. This line should be changed.
]]>
</description>

</plugin>

<!--	===== Set Note Colour ========================================= -->

<aliases>
  <alias
   name="Set_NoteColour"
   script="Set_NoteColour"
   match="&NamePrefix;Colour *"
   enabled="y"
   ignore_case="y"
  >
  </alias>
</aliases>

<script>
Dim NoteColour
NoteColour = "&NoteColour;"

<![CDATA[

If World.GetVariable("NoteColour") <> "" Then NoteColour = World.GetVariable("NoteColour")

Sub Set_NoteColour (AliasName, AliasLine, arrWildcards)
	NoteColour = LCase(arrWildcards(1))
	World.SetVariable "NoteColour", NoteColour
	ShowNote "Note Colour changed to: " & NoteColour
End Sub

Sub ShowNote (NoteString)
	World.ColourNote NoteColour, "", NoteString
End Sub

]]>
</script>

<!--	===== Default Settings ======================================== -->

<script>
<![CDATA[

Sub OnPluginInstall
	ShowNote "--------------------------------------------------------------------"
	ShowNote "Plugin: " & Chr(34) & World.GetPluginName & Chr(34) & " - Installed."
	Display_PluginInfo
End Sub

Sub OnPluginOpen
	ShowNote "Plugin: " & Chr(34) & World.GetPluginName & Chr(34) & " - Opened."
End Sub

Sub OnPluginClose
	ShowNote "Plugin: " & Chr(34) & World.GetPluginName & Chr(34) & " - Closed."
End Sub

Sub OnPluginConnect
	ShowNote "--------------------------------------------------------------------"
	ShowNote "Plugin: " & Chr(34) & World.GetPluginName & Chr(34) & " - Connected."
	Display_PluginInfo
End Sub

Sub OnPluginDisconnect
	ShowNote "Plugin: " & Chr(34) & World.GetPluginName & Chr(34) & " - Disconnected."
End Sub

Sub OnPluginEnable
	ShowNote "--------------------------------------------------------------------"
	ShowNote "Plugin: " & Chr(34) & World.GetPluginName & Chr(34) & " - Enabled."
	Display_PluginInfo
End Sub

Sub OnPluginDisable
	ShowNote "Plugin: " & Chr(34) & World.GetPluginName & Chr(34) & " - Disabled."
End Sub

Sub OnPluginSaveState
	ShowNote "Plugin: " & Chr(34) & World.GetPluginName & Chr(34) & " - Saved state."
End Sub

Sub Display_PluginInfo
	ShowNote "--------------------------------------------------------------------"
	ShowNote PadLeft("Plugin: ", 17) & PadRight(World.GetPluginName, 25) & World.GetPluginID
	ShowNote PadLeft("Version number: ", 17) & World.GetpluginInfo(World.getpluginID, 19)
	ShowNote PadLeft("Current World: ", 17) & PadRight(World.GetAlphaOption("name"), 25) & _
		World.GetAlphaOption("id")
	ShowNote "--------------------------------------------------------------------"
	ShowNote " HELP:"
	ShowNote " "
]]>
	ShowNote " &NamePrefix;Help    - Display this help."
	ShowNote " &NamePrefix;Colour  - Change the colour this plugin uses for notes."
<![CDATA[
	ShowNote "--------------------------------------------------------------------"
End Sub

]]>
</script>

<!--	===== Plugin Help ============================================= -->

<aliases>
  <alias
   script="OnHelp"
   match="&NamePrefix;Help"
   enabled="y"
   ignore_case="y"
  >
  </alias>
  <alias
   script="OnHelp"
   match="Plugins"
   enabled="y"
   ignore_case="y"
  >
  </alias>
</aliases>

<script>
<![CDATA[

Sub OnHelp (AliasName, AliasLine, arrWildcards)
	Display_PluginInfo
End Sub

]]>
</script> 

<!--	===== Plugin Support Routines ================================= -->

<include name="Plugins by Magnum\MAGNUM Script Tools.vbs"/>

<!--	=============================================================== -->
<!--	===== MAIN PLUGIN BLOCK ======================================= -->
<!--	=============================================================== -->

</muclient>

Note: There are some calls made to Routines in the include file, which is not quoted here.

I prefer to display a standard header for each plugin, so I put all that in the default plugin.

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

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

Posted by Ked   Russia  (524 posts)  Bio
Date Reply #3 on Tue 30 Mar 2004 05:17 AM (UTC)
Message
I like the changes to configuration dialogue, and I definitely think that it should be resizable. Actually, for awhile now I've been toying with an idea of building a separate application that would reproduce the general feel of Mushclient's configuration dialogue but parse in plugin files instead of worlds and output plugins, respectively. Haven't assessed everything that's involved in getting it to work but it sounds like something doable. I use a DefaultPlugin.xml myself, but when you have a task involving a few dozen triggers cut out for you, even the best code editors make your stomach turn at the idea of typing it all in, and even more so - at the idea of browsing through it all to find a chunck you want to edit.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #4 on Wed 31 Mar 2004 06:32 AM (UTC)
Message
Quote:

I tried creating a new world using an existing plugin as a template and it generally worked, with all the triggers/timers/aliases appearing in the created world, but Mushclient refused to recognize <plugin> and <script> tags in the plugin, resulting in no script file. So the suggestion is to allow the client to create a new scriptfile, with a required extension (using the language property of the <plugin> tag) and attach it automatically to the world file if the latter is being created from a plugin.


Plugins can have different languages (eg. VBscript, JScript) whereas the main world only has one language. I can see problems with trying to convert plugins back into script files.

- Nick Gammon

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

Posted by Larkin   (278 posts)  Bio
Date Reply #5 on Tue 01 Feb 2005 05:17 PM (UTC)
Message
I've only just begun writing plugins and scripts for MUSHclient, but my preferred method of debugging Python is to break apart my code into several source files and use the Pythonwin IDE for editing and testing (most) things.

What I've done just a few moments ago is to add plugins and use the import to load my script file into my plugin. This works well for what I do, though I could see that it may not work for everything everyone else might want to do.

I'm using a controlled metaclass pattern, that I got from Keldar, to keep instantiations of objects consistent across plugins, and it's incredibly useful!
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.


21,065 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.