Author Topic: We need packagable commands mutually-agreed by modders  (Read 881 times)

In particular, /help and /credits. I'm sick of remembering /lchelp, /adminchathelp, /thishrlp, etc, package a /help command and add lines detailing your commands and what it does, under a section of your mod. Be it a chatmessage or a GUI with an API sinilar to the prefs. Same thing with /credits.

I created a /credits command for TotalRPG that plays well with others. Though for /help I think an underlying help system for server mods is desperately needed, one that would offer some level of organization by having each mod register it's help topics via a function call.

can't you just hook it so like it takes all other instances of servercmdhelp and adds it as items to a list of categories

nah that wouldn't work

is it possible to make a command that lists all commands on the server? that would be really useful.

I completely get what you mean, I was thinking of this the other day when I was working on Rising Lava.

Something like
Quote
function serverCmdHelp(%client) {
      messageClient(%client, '', "This is my message in the help");
      Parent::serverCmdHelp(%client);
}

I've not actually tried that code, but I'm not sure if it would work.

is it possible to make a command that lists all commands on the server? that would be really useful.
It's possible, but it would be pretty messy and there wouldn't be any way to filter out commands that you shouldn't be able to see (like commands that are only used by GUI's). A better solution might be a sort of Blockland manpages sort of thing. Keep a website that has documentation on various mods and allow the /help command to find information there for mods that are installed. This way external contributors could add info for mods that the creator might not be interested in adding.

Internal (add-ons/server_globalhelp/server.cs):
Code: [Select]
if($GlobalHelp::serverExecutedOnce) {
  return;
}
$GlobalHelp::serverExecutedOnce = 1;
new ScriptObject(ServHelp) {
  count=0;
};
Function addHelp(%name,%desc) {
  If(!%name || !%desc) {
    Error("Failed to add help command (Missing NAME or DESC)");
    Return;
  }
  ServHelp.count += 1;
  ServHelp.help[ServHelp.count@"name"] = %name;
  ServHelp.help[ServHelp.count@"desc"] = %desc;
//packaging this overwrites any other addons that create the servercmdhelp function.
Package GlobalHelp {
  Function serverCMDHelp(%c) {
    For(%i=0;%i<ServHelp.count;%i++) {
      messageClient(%c,'',"\c5"@ServHelp[%i@"name"]@"\c6 - "@ServHelp[%i@"desc"]);
    }
    messageClient(%c,'',"\c6Press PGUP to view all Help commands.");
  }
};
activatePackage(GlobalHelp);
External (Other addons):
Code: [Select]
if(!isObject(ServHelp)) {
  Exec("add-ons/server_globalhelp/server.cs");
}
addHelp("Test","Test Desc");
I havent tested this and i wrote this all on my kindle, so apologies for any syntax errors.
No package needed.

You can also add a variable like this:
Code: [Select]
ServHelp.help[ServHelp.count@"AdminOnly"]And have serverCMDhelp check for admin if the variable shown above is 1.
EDIT: Packaged serverCmdhelp to overwrite any addons that create the servercmdhelp function.
« Last Edit: March 09, 2016, 01:21:45 PM by RTBARCHIVE »

That's a nice start, but it would really need to be categorized by each individual mod so you could have separate topics like the minecraft help command does. At least at a minimum, I still think my manpages idea would probably be the most optimal since that would make it trivial to add support for the thousands of old mods that have been made and will never be updated to have help included in them.

That's a nice start, but it would really need to be categorized by each individual mod so you could have separate topics like the minecraft help command does. At least at a minimum, I still think my manpages idea would probably be the most optimal since that would make it trivial to add support for the thousands of old mods that have been made and will never be updated to have help included in them.
just make a function that, if $GlobalHelp::scbrown townlFiles and $GlobalHelp::serverExecutedOnce both equal one, scans every server.cs in the addons folder and searches for serverCmd, and if the file does not have addHelp(); in it, adds the found functions to the help list. Of course there would need to be a variable in ServHelp (ex. ServHelp.CRCBLOCK) that will not scan the file if the CRC is found in CRCBLOCK (and scan ADD-ON-LIST.cs for a list of enabled addons).

Categorizing is simple, just add another variable to addHelp (%addonName).
« Last Edit: March 09, 2016, 01:24:47 PM by RTBARCHIVE »

just make a function that, if $GlobalHelp::scbrown townlFiles and $GlobalHelp::serverExecutedOnce both equal one, scans every server.cs in the addons folder and searches for serverCmd, and if the file does not have addHelp(); in it, add the found functions to the help list. Of course there would need to be a variable in ServHelp (ex. ServHelp.CRCBLOCK) that will not scan the file if the CRC is found in CRCBLOCK (and scan ADD-ON-LIST.cs for a list of enabled addons)
Having an online help manual still has a number of great advantages over this still. Firstly you can actually have descriptive help rather than hoping that the command and arguments are self explanatory from their declaration, but not everyone uses good self-documenting conventions. Also you would get some mods like the duplicator which have like 9 redundant commands for the same thing, it just becomes a mess way too quickly.

Having an online help manual still has a number of great advantages over this still. Firstly you can actually have descriptive help rather than hoping that the command and arguments are self explanatory from their declaration, but not everyone uses good self-documenting conventions. Also you would get some mods like the duplicator which have like 9 redundant commands for the same thing, it just becomes a mess way too quickly.
I think I misunderstood the OP. What I got from him/her is that they want a global in-game solution to multiple addons having seperate help commands, and that s/he wants to have one command that contains all help functions. Either way, there is no reason to think that only one of these ideas can be created, as I think it would be better if they co-exist.
« Last Edit: March 09, 2016, 01:34:37 PM by RTBARCHIVE »

this needs to be part of a bigger add-on, like blockland glass
just to make it much more convenient in general