Plugin editor dialog

Posted by Twisol on Tue 21 Jul 2009 07:40 PM — 2 posts, 7,920 views.

USA #0
I think it would be incredibly useful to have a dedicated dialog for editing plugins, rather than having to edit its XML file. It would be much easier to add/modify elements; for example, I often find myself making a dummy trigger with the options I want just so I can copy it into my plugin.

I imagine it would be similar to the current configuration dialog, except limited to sections pertaining to the plugin. It would also be really nice to have a script section where you can modify the script segment.


Uhh, I'm not really running at full speed here, so I'll leave it there. I'll probably respond a bit more adequately to later questions/comments/rebukes. :P


EDIT: Couldn't the Plugin Wizard dialog be modified to allow this kind of editing? =/
Amended on Tue 21 Jul 2009 07:54 PM by Twisol
Australia Forum Administrator #1
Good idea in principle. :)

One problem is that plugins can use MXP entities at the start, for example:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient [
  <!ENTITY socials_command "socials" > 
  <!ENTITY end_socials_regexp "\&gt;" > 
  <!ENTITY timer_interval "30" > 
]>



Now if the code that read in the plugin interpreted those entities, then they are effectively thrown away when you save again (eg. &timer_interval; would be replaced by 30, and then 30 gets saved and not &timer_interval;).

However if they are *not* interpreted, then something like this wouldn't load:


<timers>
  <timer 
	  name="RandomSocial" 
	  script="DoRandomSocial" 
	  enabled="y" 
	  second="&timer_interval;" 
	>
  </timer>
</timers>


It would complain that "second field is not numeric" or some such thing.

I agree it would make modifying things like triggers easier, however most stuff is pretty simple (eg. you can easily tell which is the "match" field).

For more complicated things I usually do what you have said, make a trigger in any world window, copy it, delete it, and then paste the resulting XML code into my plugin.

It could be done, I just don't know if I have the energy to do it.

What you might be able to do, which would dummy-up most of that functionality, would be to have some script that:


  • Takes a requested plugin file
  • Strips out the <plugin> .. </plugin> stuff (and saves it somewhere, eg. in a SQLite database)
  • Adds in some <world> .. </world> stuff so that it looks like a world file.
  • Copies the <script> .. </script> stuff into a separate file.
  • Saves the resulting file.


This resulting file would look like a world file (with the script in the script file). You could then open that under a new copy of MUSHclient, and edit everything in the GUI interface in the usual way.

Then you would either simply make a new plugin with the plugin wizard, or have another script to reverse the process, effectively doing what the plugin wizard does anyway.