Pre-including plugins in world files distributed with standalone MUSHclient

Posted by Fiendish on Sun 14 Nov 2010 06:16 AM — 9 posts, 26,170 views.

USA Global Moderator #0
I just want to be clear.
Is using <include name=".\worlds\plugins\blahblahblah.xml" plugin="y" /> the established mechanism for having path relative plugins?

Australia Forum Administrator #1
  • $PLUGINSDEFAULTDIR - the default plugins directory
  • $PROGRAMDIR - the MUSHclient program directory
  • $WORLDDIR - the directory the current world is in
  • $PLUGINDIR - the directory the current plugin is in



So in your case, probably:


<include name="$PLUGINDIR\blahblahblah.xml" plugin="y" />

Amended on Sun 14 Nov 2010 08:42 PM by Nick Gammon
USA Global Moderator #2
I ended up using
<include name="$PROGRAMDIR\worlds\plugins\blahblahblah.xml" plugin="y"/>
Because PLUGINDIR didn't work.
Amended on Sun 14 Nov 2010 08:36 AM by Fiendish
Australia Forum Administrator #3
It worked for me:

File: includes_test.xml


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>

<muclient>
<plugin
   name="includes_test"
   author="Nick Gammon"
   id="6d119b1a8390d08e5b76b33e"
   language="Lua"
   purpose="Testing includes"
   date_written="2010-11-15"
   requires="4.33"
   version="1"
   >
</plugin>

<include name="$PLUGINDIR\myincludes.xml" />

<script>
print "in test.xml"
</script>

</muclient>


File: myincludes.xml


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<muclient>

<script>
print "in myincludes.xml"
</script>

</muclient>



Output:


in myincludes.xml
in test.xml

USA #4
Nick Gammon said:
It worked for me:

It worked for me too: it's the entire basis upon which my plugin structure is built.
USA Global Moderator #5
The subject says "in world files", not "in plugins". There seems to be no concept of the current plugin directory for a world file. :)
Amended on Sun 14 Nov 2010 09:07 PM by Fiendish
USA #6
Fiendish said:
The subject says "in world files", not "in plugins". There seems to be no concept of the current plugin directory for a world file. :)

Touche! In that case, there would be no $PLUGINDIR set, because it's not a plugin. What about $PLUGINSDEFAULTDIR?
Australia Forum Administrator #7
Fiendish said:

The subject says "in world files", not "in plugins". There seems to be no concept of the current plugin directory for a world file. :)


The terser the question, the less helpful the answer is likely to be.

I normally skim subjects, particularly as the subject lines are normally very vague.

Now that you have clarified, I guess, that you are setting up a pre-made setup of world files and plugins, your original idea is probably as good as any:


<include name=".\worlds\plugins\blahblahblah.xml" plugin="y" />


The idea of the other substitution was for cases where the end-user might have customized away the locations of things. But in your case, you know where you have put the plugins.

I would have thought that $PLUGINSDEFAULTDIR might have been neater, that should evaluate to the same thing. But who knows? Then you need to make sure that the preferences database has set things up correctly. And if they plonk the installed files somewhere you don't expect, well I can't vouch for which system would work better. Probably need to test a few scenarios.
USA Global Moderator #8
Nick Gammon said:
The terser the question, the less helpful the answer is likely to be.

Except that your initial answer helped me. :)