Server Help

ASSS Custom Projects - <c> cmdalias

Bak - Wed Jul 20, 2005 4:12 pm
Post subject: <c> cmdalias
Ever want to make an alias command for different command, without having to make a new module? Well you're in luck! This module will take commands and rename them to other commands which are then processed by the server. For example I could take the "*spec" command and instead of using the default behavior of listing who is speccing someone, it will lock the player in spec by changing the command to "?lock -s". You could also create a command to convienently unlock players from spec by aliasing "*unspec" to "?unlock". You don't need to change the command permissions or anything to use these commands; if the player has access to ?unlock he'll have access to *unspec. Notice that you now can differentiate between * and ? commands. So that while *spec will lock players in spec mode, ?spec will retain it's old functionality.

So how do you use it? At the top of global.conf, put a single line:
Quote:
#include cmdalias.conf

Then, in the same directory as global.conf, create a file called cmdalias.conf and define your command aliases as follows:
Code: Show/Hide

; this file defines command aliases, make sure module cmdalias is loaded or this won't do anything!

[CmdAlias]
;the number of aliases defined
Num=3

From1=*spec
To1=?lock -s

From2=*unspec
To2=?unlock

From3=*boo
To3=*aa Boo!


Note that you still don't have the ideal goal of *spec acting as it does in subgame (for bots and such). For that you'll need to create a new command like togglespeclock and alias it with "*spec". But this is a key step forward in doing this.

Some features to be desired are defining the commands on a per arena basis. These aliased commands are done for the entire server. Perhaps moving the settings from global settings to the per arena settings, and using attach to load the settings and unattach to free any data associated with them would work too. However, for now I believe this is fine.

Source attached, you also need to link to util.c somehow (uses hashtables, amalloc, and afree).
CypherJF - Wed Jul 20, 2005 7:29 pm
Post subject:
This I could see as a viable option for helping users migrate from subgame to asss. Now for someone to alias all the possible subgame commands over, and have it come as a default package. icon_wink.gif
Bak - Wed Jul 20, 2005 9:31 pm
Post subject:
the sg_compat module takes care of most of them. Namely, the following ones:

Code: Show/Hide
ALIAS("?recycle",     "recyclearena");
ALIAS("?get",         "geta");
ALIAS("?set",         "seta");
ALIAS("?setlevel",    "putmap");
ALIAS("*listban",     "listmidbans");
ALIAS("*removeban",   "delmidban");
ALIAS("*kill",        "kick");
ALIAS("*log",         "lastlog");
ALIAS("*zone",        "az");
ALIAS("*flags",       "flaginfo");
ALIAS("*locate",      "find");
ALIAS("*recycle",     "shutdown -r");
ALIAS("*sysop",       "setgroup sysop");
ALIAS("*smoderator",  "setgroup smod");
ALIAS("*moderator",   "setgroup mod");
ALIAS("*arena",       "aa");
ALIAS("*einfo",       "sg_einfo");
ALIAS("*tinfo",       "sg_tinfo");
ALIAS("*listmod",     "sg_listmod");
ALIAS("*where",       "sg_where");
ALIAS("*info",        "sg_info");
ALIAS("*lag",         "sg_lag");

Chambahs - Wed Jul 20, 2005 9:53 pm
Post subject:
God bak, you own more and more everyday
phong - Thu Jul 21, 2005 7:51 pm
Post subject:
can you put together a makefile? or an idea tongue.gif
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group