Plugin Description
#11
But there are commands that use two "/" like //set BlockType.

I was thinking. I could also set all the commands in categories in the file itself. Like:
Navigation =
{
   Descend = {
      Command = "/descend;/desc"
      etc...
   },
   etc...
}

Region = 
{
etc...

Maybe we also need a plugin that generates a html page from these tables.

Oh wait.. the call function doesn't parse tables ;(

Wait! Maybe we can use the loadstring function for that.
Reply
Thanks given by:
#12
We don't need a separate plugin for that, we can make a source file that will expect this table to be called g_PluginInfo and will export them. Easy.
As for the doubleslash commands, even that is possible, although it looks a bit worse:
Commands =
{
  ["/set"] = { ... }
}

I think the categories should be a "member variable" for each command; this way a command doesn't need to be in a category, or could be in multiple categories at once; the exporting code would take care of that. And the categories could get a separate description, too:
g_PluginInfo =
{
  ...
  Commands =
  {
    descend =
    {
      Category = "Navigation";
      Permission = "..."; ...
    },
    ...
  },
  CommandCategories =
  {
    Navigation =
    {
      Desc = "Commands in this category will teleport a player to various important places";
    },
    ...
  },
};
Reply
Thanks given by:
#13
xoft Wrote:although it looks a bit worse:

Yea that doesn't look pretty Wink

xoft Wrote:I think the categories should be a "member variable" for each command; this way a command doesn't need to be in a category, or could be in multiple categories at once; the exporting code would take care of that. And the categories could get a separate description, too:
That's a good idea Smile

I created a branch where I'm now working on the new way of binding commands. Gonna work on the categories but I'l have some coffee first Smile https://github.com/STRWarrior/WorldEdit/...escription
Reply
Thanks given by:
#14
Ok Categories implented. Smile
Reply
Thanks given by:
#15
Very well, I'll write the same thing for Gallery and then write a processor that will use such a table to produce the documentation.

You are still using the explicit commands, is that really necessary?

Hmm, we have a problem. Gallery allows the server admin to select their own command prefix, so the command names are not exactly known.
Reply
Thanks given by:
#16
How were you planning on doing the processor. I started on it, but then we had dinner. Maybe you had a different approach in mind:
m_PluginManager = nil
m_Plugin = nil
m_ShouldReload = false

function Initialize(Plugin)
	m_Plugin = Plugin
	Plugin:SetName("DocumentPlugin")
	Plugin:SetVersion(1)
	
	m_PluginManager = cRoot:Get():GetPluginManager()
	cPluginManager.AddHook(cPluginManager.HOOK_TICK, OnTick)
	
	return true
end

function OnTick()
	if m_ShouldReload then
		m_PluginManager:DisablePlugin(m_Plugin:GetName())
		m_PluginManager:LoadPlugin(m_Plugin:GetDirectory())
	end
end

function DocumentPlugin(Plugin, FileName)
	local Folder = Plugin:GetLocalFolder()
	dofile(Folder .. "/" .. FileName)
	
	-- Process the g_PluginInfo table

	m_ShouldReload = true
	return true
end

I'm still using the explicit commands because I can now easily create aliases. Or should I do it like
["/ascend"] = 
{
   Alias = "/asc",
   -- etc
},
instead of
Ascend =
{
   Command = "/ascend;/asc",
   -- etc
},
Reply
Thanks given by:
#17
I'm writing the processor not as a separate plugin, but rather as a set of files that can be copied into any plugin and that will document that plugin.
I've started with the generic command registrator that will register all commands and subcommands based on the info in g_PluginInfo.Commands. I think it's getting close to being usable, so I'll commit it very soon to the Gallery plugin, if the net connection permits - I'm on a train back home.

I was planning on making a special variable available in each command, called Alias, which could be either a single string (for a single alias), or an array table of string for multiple aliases:
Commands =
{
  ascend =
  {
    Alias = { "asc", "a", },
  }
} ;
It fits better into the scheme of subcommands ("/gal info" etc.)
Reply
Thanks given by:
#18
(12-30-2013, 04:33 AM)xoft Wrote: I was planning on making a special variable available in each command, called Alias, which could be either a single string (for a single alias), or an array table of string for multiple aliases:
Commands =
{
  ascend =
  {
    Alias = { "asc", "a", },
  }
} ;
It fits better into the scheme of subcommands ("/gal info" etc.)

Oh then I'l edit my table.

I implented it. Smile
Reply
Thanks given by:
#19
With all those superfluous slashes in the commands, I decided that the full command name will be the key to the info table. I've already changed WE's info table, I'm now working on the dumper.
I decided to flatten WE's folder hierarchy to simplify loading the plugin. You won't be pleased with how much I've moved stuff aroundTongue
Reply
Thanks given by:
#20
I guess all I can do is waitTongue
Reply
Thanks given by:




Users browsing this thread: 3 Guest(s)