Author Topic: Improved mudconfig help  (Read 3689 times)

Offline z993126

  • BFF
  • ***
  • Posts: 128
    • View Profile
Improved mudconfig help
« on: September 09, 2011, 12:03:55 pm »
I figured it'd be helpful for typing 'mudconfig' by itself to show you the values set for the examples, the way env does.  Missing a few items yet, but it's a lot better than the default, I think.

[code]
/* 2011-Seo-09 - T. Cook improved display of help output
 */
#include <lib.h>
#include <cfg.h>
#include <save.h>
#include <daemons.h>
#include <commands.h>
#include NETWORK_H
#include <sockets.h>
#include <rooms.h>
string GetHelp();

inherit LIB_DAEMON;

string ret_string = "";
string array config, config2, keywords;
string array bools = ({ "enable","disable","on","off","1","0" });
string array yesbools = ({ "enable","on","1","yes" });
string array nobools = ({ "disable","off","0","no" });
string array restrict_tokens = ({ "restrict","unrestrict" });
string array nonmodals = ({ "liveupgrade", "prompt","status","email",
        "websourceip", "websourcename", "mudname", "mudport",
        "debugger", "access", "pinging", "pinginterval",
        "imc2serverpass", "imc2clientpass" });
string array antimodals = ({ "imc2", "ced" });
string array modals = antimodals + ({ "channelpipes", "fastcombat",
        "catchtell","matchcommand", "matchobject", "autowiz", "locked",
        "localtime", "justenglish", "justhumans", "encumbrance", "pk",
        "compat", "exitsbare", "nmexits", "grid", "minimap", "wizmap",
        "cgi", "dirlist", "creweb", "selectclass", "severable",
        "retain", "defaultparse", "disablereboot", "loglocal", "logremote",
        "questrequired", "autoadvance" });
string array inet_services = ({ "oob", "hftp", "ftp", "http", "rcp", "inet" });

static int NotImplemented(string which);
varargs static int TestFun(string which, string arg);
varargs static int ModIntermud(string which, string arg);
varargs static int ModRouter(string which, string arg);
static int ProcessModal(string which, string arg);
varargs static int ModStartRoom(string which, string arg);
static int ProcessOther(string which, string arg);
static int ProcessString(string which, string arg);
int ProcessInet(string which, string arg);
varargs static int ModDefaultDomain(string which, string arg);
varargs static int ModCfg(string which, string arg);

static private void validate() {
    if(!this_player()) return 0;
        if( !(master()->valid_apply(({ "ASSIST" }))) )
            error("Illegal attempt to access mudconfig: "+get_stack()+" "+identify(previous_object(-1)));
}

mixed cmd(string str) {
    string which, arg;
       
        validate();
       
        if(this_player() && !securep(this_player())){
            write("This command is for full admins only. To become a "+
                    "full admin, you'll need to be added to the SECURE group.");
                return 1;
        }
   
        if(!this_player() && base_name(previous_object()) != IMC2_D &&
                base_name(previous_object()) != INTERMUD_D) return 1;
           
                if(base_name(previous_object()) == IMC2_D){
                    if(str != "imc2 disable") return 1;
                }
    if(base_name(previous_object()) == INTERMUD_D){
        if(str != "intermud disable") return 1;
    }
   
        if(!str || sscanf(str, "%s %s", which, arg) != 2){
            write(GetHelp());
                return 1;
        }
    cp(CONFIG_H,"/secure/save/backup/config."+time());
        config = explode( read_file(CONFIG_H),"\n" );
        config2 = ({});
        keywords = ({});
        foreach(string element in config){
            string s1, s2;
                if(sscanf(element,"#define %s %s",s1,s2) == 2) keywords += ({ s1 });
        }
   
        if(member_array(which,modals) != -1){
            ProcessModal(which, arg);
                return 1;
        }
   
        if(member_array(which,inet_services) != -1){
            ProcessInet(which, arg);
                return 1;
        }
   
        else switch(which){
            case "test" : TestFun(which, arg);break;
                case "intermud" : ModIntermud(which, arg);break;
                case "router" : ModRouter(which, arg);break;
                case "startroom" : ModStartRoom(which, arg);break;
                case "defaultdomain" : ModDefaultDomain(which, arg);break;
                case "resets" : which = "TIME_TO_RESET";ProcessOther(which,arg);break;
                case "offset" : which = "GMT_OFFSET";ProcessOther(which,arg);break;
                case "extraoffset" : which = "EXTRA_TIME_OFFSET";ProcessOther(which,arg);break;
                case "newbielevel" : which = "MAX_NEWBIE_LEVEL";ProcessOther(which,arg);break;
                case "monitor" : which = "GLOBAL_MONITOR";ProcessOther(which,arg);break;
                case "maxip" : which = "SAME_IP_MAX";ProcessOther(which,arg);break;
                case "pinginterval" : which = "PING_INTERVAL";ProcessOther(which,arg);break;
                case "maxcommands" : which = "MAX_COMMANDS_PER_SECOND";ProcessOther(which,arg);break;
                case "maxidle" : which = "IDLE_TIMEOUT";ProcessOther(which,arg);break;
                case "instances" : which = "ENABLE_INSTANCES";ProcessOther(which,arg);break;
                case "hostip" : which = "HOST_IP";ProcessString(which,arg);break;
                case "email" : which = "ADMIN_EMAIL";ProcessString(which,arg);break;
                case "liveupgrade" : which = "LIVEUPGRADE_SERVER";ProcessString(which,arg);break;
                case "mudstatus" : which = "MUD_STATUS";ProcessString(which,arg);break;
                case "debugger" : which = "DEBUGGER";ProcessString(which,arg);break;
                case "websourceip" : which = "WEB_SOURCE_IP";ProcessString(which,arg);break;
                case "websourcename" : which = "WEB_SOURCE_NAME";ProcessString(which,arg);break;
                case "imc2clientpass" : which = "IMC2_CLIENT_PW";ProcessString(which,arg);break;
                case "imc2serverpass" : which = "IMC2_SERVER_PW";ProcessString(which,arg);break;
                case "mudname" : ModCfg("name", arg);break;
                case "mudport" : ModCfg("port", arg);break;
            default : NotImplemented(which);break;
        }
    return 1;
}

varargs static int CompleteConfig(string file){
    string ret = implode(config2,"\n")+"\n";
        if(!file) file = CONFIG_H;
            validate();
                ret = replace_string(ret,"\n\n","\n");
                write_file(file,ret,1);
                RELOAD_D->ReloadBaseSystem();
                reload(LIB_CONNECT,0,1);
                reload(PLAYERS_D,0,1);
                write("Command complete.");
                return 1;
}

int ModPortOffset(string which, string arg){
    string out, service, svc, junk, offset, new_offset;
        string *new_array = ({});
        string netcfg = read_file(NETWORK_H);
        string *net_array = explode(netcfg,"\n");
       
        new_offset = arg;
        service = which;
        service = upper_case(service);
        foreach(string element in net_array){
            if(sscanf(element,"#define OFFSET_%s %s %d",svc, junk, offset) == 3){
                if(lower_case(svc) == lower_case(service)){
                    out = "#define OFFSET_"+service+"               "+new_offset;
                }
                else out = element;
            }
            else out = element;
                new_array += ({ out });
        }
    out = implode(new_array,"\n");
       
        write_file(NETWORK_H,out,1);
        write("The "+service+" port offset is being set to "+offset+".");
        RELOAD_D->eventReload(this_object(), 1, 1);
        reload(MASTER_D,0,1);
        return 1;
}             

int ModPort(string which, mixed arg){
    string out, service, svc, junk, new_offset, new_port;
        string *new_array = ({});
        string netcfg = read_file(NETWORK_H);
        string *net_array = explode(netcfg,"\n");
        int offset;
       
        if(stringp(arg)) new_port = arg;
        else new_port = itoa(arg);
            service = which;
                service = upper_case(service);
                foreach(string element in net_array){
                    if(sscanf(element,"#define OFFSET_%s %s %d",svc, junk, offset) == 3){
                        if(lower_case(svc) == lower_case(service)){
                            new_offset = ""+(atoi(new_port) - query_host_port());
                                out = "#define OFFSET_"+service+"               "+new_offset;
                        }
                        else out = element;
                    }
                    else out = element;
                        new_array += ({ out });
                }
    out = implode(new_array,"\n");
        if(last(out,1) != "\n") out += "\n";
            write_file(NETWORK_H,out,1);
                write("The "+service+" port is being set to "+atoi(new_port)+".");
                write("To complete this configuration, wait 2 seconds, then issue the following commands:");
                write("mudconfig "+lower_case(service)+" disable");
                write("mudconfig "+lower_case(service)+" enable");
                RELOAD_D->eventReload(this_object(), 1, 1);
                reload(MASTER_D,0,1);
                return 1;
}

static int NotImplemented(string which){
    validate();
        write("The keyword \""+which+"\" is not yet implemented in mudconfig.");
        return 1;
}

varargs static int TestFun(string which, string arg){
    validate();
        write("Which: "+which+" arg: "+arg);
        return 1;
}

varargs static int ModStartRoom(string which, string arg){
    if(!arg){
        write("Please specify the absolute path to the room's file.");
            return 1;
    }
    if(first(arg,1) != "/"){
        write("You've entered a relative path. Please try again, using an absolute path.");
            return 1;
    }
    if(last(arg,2) == ".c") arg = truncate(arg,2);
        if(!file_exists(arg+".c")){
            write("That file does not exist.");
                return 1;
        }
    if(catch(load_object(arg))){
        write("/n/nThat room file is broken. Please fix it and try again.");
            return 1;
    }
    cp(ROOMS_H,"/secure/save/backup/rooms."+time());
        config = explode( read_file(ROOMS_H),"\n" );
        config2 = ({});
        foreach(string line in config){
            string s1,s2,s3;
                if(sscanf(line,"%s %s %s",s1,s2,s3) == 3){
                    if(s1 == "#define" && s2 == "ROOM_START")
                        line = "#define ROOM_START       \""+arg+"\"";
                }
            config2 += ({ line });
        }
    CompleteConfig(ROOMS_H);
        reload(LIB_CREATOR,1,1);
        write("\nNote: Some objects, like verbs and workrooms, still contain the old "+
                "START_ROOM value. This will not change until they are reloaded or "+
                "the mud reboots.");
        return 1;
}

varargs static int ModDefaultDomain(string which, string arg){
    if(!arg){
        write("Please specify the absolute path to the domain, eg: /domains/MystyShyre");
            return 1;
    }
   
        if(first(arg,1) != "/"){
            write("You've entered a relative path. Please try again, using an absolute path. "+
                    "For example: mudconfig defaultdomain /domains/MystyShyre");
                return 1;
        }
   
        if(!directory_exists(arg)){
            write("That domain does not exist. Type: help domaincreate");
                return 1;
        }
   
        if(!directory_exists(arg+"/room")){
            write("That directory seems to lack a /room dir. It is not suitable for a domain.");
                return 1;
        }
   
        cp("/secure/include/dirs.h","/secure/save/backup/dirs."+time());
        config = explode( read_file("/secure/include/dirs.h"),"\n" );
        config2 = ({});
        foreach(string line in config){
            string s1,s2,s3;
                if(sscanf(line,"%s %s %s",s1,s2,s3) == 3){
                    if(s1 == "#define" && s2 == "DIR_STANDARD_DOMAIN")
                        line = "#define DIR_STANDARD_DOMAIN       \""+arg+"\"";
                }
            config2 += ({ line });
        }
   
        CompleteConfig("/secure/include/dirs.h");
       
        write("\nPlease reboot the mud for this change to take effect.\n");
        return 1;
}

varargs static int ModRouter(string which, string arg){
    string preloads = read_file(CFG_PRELOAD);
        string *load_lines = explode(preloads,"\n");
        string *ret_arr = ({});
        string yesline = "/secure/daemon/i3router/server";
        string noline = "#/secure/daemon/i3router/server";
        validate();
        if(member_array(arg,bools) == -1){
            write("Please try again, indicating whether you want to enable or disable the intermud router. Note that this setting will persist across reboots.");
                return 1;
        }
   
        if(member_array(arg,yesbools) != -1){
            if(member_array(yesline,load_lines) != -1) write("Persistent router activation is already enabled.");
            else {
                write("Enabling persistent router activation.");
                    foreach(string line in load_lines){
                        if(line == noline) line = yesline;
                            ret_arr += ({ line });
                    }
                if(member_array(yesline,ret_arr) == -1){
                    ret_arr += ({ yesline });
                }
                unguarded( (: cp(CFG_PRELOAD,"/secure/save/backup/preload."+time()) :) );
                    ret_string = implode(ret_arr,"\n")+"\n";
                    ret_string = replace_string(ret_string,"\n\n","\n");
                    unguarded( (: write_file(CFG_PRELOAD,ret_string,1) :) );
            }
            if(find_object(ROUTER_D)) write("The intermud router is already running.");
            else {
                write("Starting the intermud router.");
                    load_object(ROUTER_D);
            }
           
                ret_string = "";
                write("The intermud router is enabled.");
                return 1;
        }
   
        if(member_array(arg,nobools) != -1){
           
                if(member_array(noline,load_lines) != -1) write("Persistent router activation is already disabled.");
                else {
                    write("Disabling persistent router activation.");
                        foreach(string line in load_lines){
                           
                                if(line == yesline) line = noline;
                                    ret_arr += ({ line });
                        }
                    if(member_array(noline,ret_arr) == -1){
                        ret_arr += ({ noline });
                    }
                    unguarded( (: cp(CFG_PRELOAD,"/secure/save/backup/preload."+time()) :) );
                        ret_string = implode(ret_arr,"\n")+"\n";
                        ret_string = replace_string(ret_string,"\n\n","\n");
                        unguarded( (: write_file(CFG_PRELOAD,ret_string,1) :) );
                       
                }
            if(!find_object(ROUTER_D)) write("The intermud router is not running.");
            else {
                write("Stopping the intermud router.");
                    find_object(ROUTER_D)->eventDestruct();
            }
            ret_string = "";
                write("The intermud router is disabled.");
                return 1;
        }
}

varargs static int ModIntermud(string which, string arg){
    validate();
        write("Which: "+which+" arg: "+arg);
        if(arg == "restrict"){
            write("Restricting intermud...");
                flush_messages(this_player());
                foreach(string element in config){
                    if(grepp(element, "RESTRICTED_INTERMUD")) element = "#define RESTRICTED_INTERMUD      1";
                        config2 += ({ element });
                }
            CompleteConfig();
                reload(INTERMUD_D,0,1);
                return 1;
        }
   
        if(arg == "reset"){
            object ob = find_object(INTERMUD_D);
                string savei3 = save_file(SAVE_INTERMUD);
                write("Purging all intermud data (including router password!). Previous data file saved to /secure/save/backup/ .");
                if(!ob){
                    if(file_exists(savei3)){
                        rename(savei3, "/secure/save/backup/intermud."+time());
                    }
                }
                else {
                    if(file_exists(savei3)){
                        rename(savei3, "/secure/save/backup/intermud."+time());
                    }
                    reload(INTERMUD_D,0,1);
                }
            config2 = config;
                CompleteConfig();
                return 1;
        }
   
        if(arg == "unrestrict"){
            write("Unrestricting intermud...");
                flush_messages(this_player());
                foreach(string element in config){
                    if(grepp(element, "RESTRICTED_INTERMUD")) element = "#define RESTRICTED_INTERMUD      0";
                        config2 += ({ element });
                }
            CompleteConfig();
                reload(INTERMUD_D,0,1);
                return 1;
        }
   
        if(member_array(arg,bools) == -1){
            write("Please try again, indicating whether you want to enable, disable, restrict, unrestrict, or reset intermud.");
                return 1;
        }
   
        if(member_array(arg,yesbools) != -1){
            write("Enabling intermud...");
                flush_messages(this_player());
                foreach(string element in config){
                    if(grepp(element, "DISABLE_INTERMUD")) element = "#define DISABLE_INTERMUD         0";
                        config2 += ({ element });
                }
            CompleteConfig();
                reload(INTERMUD_D,0,1);
                return 1;
        }
   
        if(member_array(arg,nobools) != -1){
            write("Disabling intermud...");
                if(this_player()) flush_messages(this_player());
                    foreach(string element in config){
                        if(grepp(element, "DISABLE_INTERMUD")) element = "#define DISABLE_INTERMUD         1";
                            config2 += ({ element });
                    }
            CompleteConfig();
                reload(INTERMUD_D,0,1);
                return 1;
        }
    return 1;
}

static int ProcessOther(string which, string arg){
    int junk;
        validate();
       
        if(sscanf(arg,"%d",junk) != 1){
            write("This parameter requires an integer as an argument.");
                return 1;
        }
   
        foreach(string element in config){
            if(grepp(element, which)){
                string s1, s2, s3;
                    if(sscanf(element,"#define %s %s",s1,s2) != 2){
                        write("Major problem. You should revert to a backup of "+
                                CONFIG_H+" immediately.");
                            return 1;
                    }
                s3 = trim(s2);
                    s2 = replace_string(s2,s3,arg);
                    element = "#define "+s1+" "+s2;
            }
            config2 += ({ element });
        }
    CompleteConfig();
        if(which == "LOCAL_TIME" || which == "EXTRA_TIME_OFFSET" || which == "GMT_OFFSET"){
            reload("/secure/sefun/local_time",0,1);
                reload("/secure/sefun/time",0,1);
                reload("/secure/sefun/timestamp",0,1);
                reload("/secure/sefun/sefun",0,1);
                RELOAD_D->eventReload("/daemon/time",2);
                reload("/secure/cmds/creators/people",0,1);
                reload("/cmds/players/date",0,1);
                reload("/cmds/players/nextreboot",0,1);
                reload("/cmds/players/version",0,1);
                write("This configuration change will require a few minutes to take effect completely.");
        }
    if(which == "GLOBAL_MONITOR") reload(SNOOP_D,0,1);
        if(which == "IDLE_TIMEOUT" || which == "MAX_NEWBIE_LEVEL" ||
                which == "FAST_COMBAT" || which == "GRID" || which == "WIZMAP" ||
                which == "MINIMAP"){
            reload(LIB_CREATOR,1,1);
                write("This configuration will take effect for each user the next time they log in.");
                return 1;
        }
    if(which == "PING_INTERVAL") reload (PING_D,1,1);
        return 1;
}

static int ProcessString(string which, string arg){
    object ob;
        validate();
       
        if(!strsrch(which, "IMC2_")){
            SECRETS_D->SetSecret(which, arg);
                reload(SECRETS_D, 0, 1);
                reload(IMC2_D, 0, 1);
                config2 = config;
                CompleteConfig();
                return 1;
        }
   
        foreach(string element in config){
            if(grepp(element, which)){
                string s1, s2, s3;
                    if(sscanf(element,"#define %s %s",s1,s2) != 2){
                        write("Major problem. You should revert to a backup of "+
                                CONFIG_H+" immediately.");
                            return 1;
                    }
                s3 = trim(s2);
                    s2 = replace_string(s2,s3,"\""+arg+"\"");
                    element = "#define "+s1+" "+s2;
            }
            config2 += ({ element });
        }
    if(!strsrch(which, "WEB_SOURCE")
            && ob = find_object(CMD_LIVEUPGRADE)){
        ob->eventDestruct();
    }
    CompleteConfig();
        return 1;
}

static int ProcessModal(string which, string arg){
    int junk;
        validate();
        if(!arg){
            arg = "no";
                write("No argument: Assuming you want to disable this feature.");
        }
    if(member_array(arg,yesbools) != -1) junk = 1;
        if(member_array(arg,nobools) != -1) junk = 0;
            if(member_array(which,antimodals) != -1) junk = ( junk ^ 1 );
               
                    if(junk) junk = 1;
                    else junk = 0;
                        arg = itoa(junk);
                           
                            if(sscanf(arg,"%d",junk) != 1){
                                write("This parameter is a modal or quasi-modal. I have a hunch it requires an integer as an argument, or at least a \"yes\" or \"no\".");
                                    return 1;
                            }
   
        if(member_array(upper_case(which),keywords) != -1){
            which = upper_case(which);
        }
        else switch(lower_case(which)){
            case "autowiz" : which = "AUTO_WIZ";break;
                case "locked" : which = "MUD_IS_LOCKED";break;
                case "localtime" : which = "LOCAL_TIME";break;
                case "justenglish" : which = "ENGLISH_ONLY";break;
                case "justhumans" : which = "HUMANS_ONLY";break;
                case "encumbrance" : which = "ENABLE_ENCUMBRANCE";break;
                case "pk" : which = "PLAYER_KILL";break;
                case "compat"  : which = "COMPAT_MODE";break;
                case "retain" : which = "RETAIN_ON_QUIT";break;
                case "defaultparse" : which = "DEFAULT_PARSING";break;
                case "disablereboot" : which = "DISABLE_REBOOTS";break;
                case "exitsbare" : which = "BARE_EXITS";break;
                case "nmexits" : which = "NM_STYLE_EXITS";break;
                case "matchcommand" : which = "COMMAND_MATCHING";break;
                case "matchobject" : which = "OBJECT_MATCHING";break;
                case "catchtell" : which = "NPC_CATCH_TELL_DEBUG";break;
                case "loglocal" : which = "LOG_LOCAL_CHANS";break;
                case "logremote" : which = "LOG_REMOTE_CHANS";break;
                case "imc2" : which = "DISABLE_IMC2";break;
                case "fastcombat" : which = "FAST_COMBAT";break;
                case "channelpipes" : which = "CHANNEL_PIPES";break;
                case "cgi" : which = "ENABLE_CGI";break;
                case "dirlist" : which = "WWW_DIR_LIST";break;
                case "creweb" : which = "ENABLE_CREWEB";break;
                case "selectclass" : which = "CLASS_SELECTION";break;
                case "severable" : which = "SEVERABLE_LIMBS";break;
                case "questrequired" : which = "REQUIRE_QUESTING";break;
                case "autoadvance" : which = "AUTO_ADVANCE";break;
                case "ced" : which = "CED_DISABLED";break;
                case "minimap" : which = "MINIMAP";break;
                case "wizmap" : which = "WIZMAP";break;
                case "grid" : which = "GRID";break;
            default : break;
        }
    foreach(string element in config){
        if(grepp(element, which)){
            string s1, s2, s3;
                if(sscanf(element,"#define %s %s",s1,s2) != 2){
                    write("Major problem. You should revert to a backup of "+
                            CONFIG_H+" immediately.");
                        return 1;
                }
            s3 = trim(s2);
                s2 = replace_string(s2,s3,arg);
                element = "#define "+s1+" "+s2;
        }
        config2 += ({ element });
    }
    CompleteConfig();
        if(which == "DEFAULT_PARSING" || which == "ENABLE_ENCUMBRANCE" ||
                which == "BARE_EXITS" || which == "COMMAND_MATCHING" ||
                which == "AUTO_ADVANCE"){
            reload(LIB_CREATOR,1,1);
                write("This configuration will take effect for each user the next time they log in.");
                return 1;
        }
    if(which == "NPC_CATCH_TELL_DEBUG"){
        if(file_exists("/domains/default/room/catchtell"))
            reload("/domains/default/room/catchtell");
                return 1;
    }
    if(which == "CED_DISABLED"){
        reload(CMD_CED,1,1);
            reload(LIB_CREATOR,1,1);
            write("This configuration will take effect for each user "+
                    "the next time they log in.");
    }
    if(which == "NM_STYLE_EXITS"){
        reload(LIB_ROOM,1,1);
            reload(LIB_CREATOR,1,1);
            write("This configuration will take effect for rooms not yet loaded for each "
                    "user the next time they log in. To ensure all rooms pick up the new configuration, "
                    "either reboot the mud, or type: \"reload every room\", then quit and log back in.");
    }
    if(which == "RETAIN_ON_QUIT" || which == "OBJECT_MATCHING")
        write("To make this configuration take effect, reboot the mud.");
            if(which == "LOG_LOCAL_CHANS" || which == "LOG_REMOTE_CHANS"){
                reload(CHAT_D,1,1);
            }
    if(which == "DISABLE_IMC2"){
        object ob;
            IMC2_D->UnSetAutoDisabled(1);
            ob = find_object(IMC2_D);
            if(!junk && ob){
                reload(ob, 0, 1);         
                    reload(find_object(CHAT_D), 0, 1);
            }
            else IMC2_D->remove();   
    }
    if(which == "FAST_COMBAT"){
        reload(LIB_CREATOR,1,1);
            write("This configuration will take effect for each user the next time they log in.");
    }
   
        if(which == "ENABLE_CGI" || which == "WWW_DIR_LIST" || which == "ENABLE_CREWEB"){
            reload(WEB_SESSIONS_D,1,1);
                reload(SOCKET_HTTP,1,1);
                foreach(string element in get_dir(DIR_WWW_GATEWAYS+"/")){
                    if(last(element,2) == ".c") reload(DIR_WWW_GATEWAYS+"/"+element,1,1);
                }
        }
    return 1;
}

int ProcessService(string which, string what){
    int port_offset, type, port;
        string sclass;
        if(sscanf(what,"port %d",port)){
            what = "port";
        }
    switch(which){
        case "hftp": port_offset=OFFSET_HFTP;sclass="/secure/lib/net/h_ftpd";type=1;break;
            case "ftp": port_offset=OFFSET_FTP;sclass="/secure/lib/net/ftp";type=1;break;
            case "http": port_offset=OFFSET_HTTP;sclass="/secure/lib/net/http";type=3;break;
            case "rcp": port_offset=OFFSET_RCP;sclass="/secure/lib/net/remote";type=1;break;
            case "oob": port_offset=OFFSET_OOB;sclass="/secure/lib/net/oob";type=0;break;
    }
    switch(what){
        case "add": INET_D->AddService(which,port_offset, sclass, type);break;
            case "remove": INET_D->RemoveService(which);break;
            case "start": INET_D->eventStartServer(which);break;
            case "restart": INET_D->eventRestartServer(which,1);break;
            case "stop": INET_D->eventStopServer(which);break;
            case "port": ModPort(which, port);break;
    }
    if(which == "oob"){
        if( what == "start" || what == "restart")
            reload(OOB_D);
                if( what == "stop" )
                    OOB_D->eventDestruct();
    }
    write("Done.");
        return 1;
}

int ProcessInet(string which, string arg){
    int sub;
        string preloads = read_file(CFG_PRELOAD);
        string *load_lines = explode(preloads,"\n");
        string *ret_arr = ({});
        string yesline = "/secure/daemon/inet";
        string noline = "#/secure/daemon/inet";
        validate();
        if(!arg) arg = "status";
            if(which != "inet"){
                sub = 1;
                    if(!find_object(INET_D)){
                        write("The inet service is not running. Please type: mudconfig inet start");
                            write("Or: mudconfig inet enable");
                            write("Then retry your command.");
                            return 1;
                    }
            }
            else {
                if(member_array(arg,yesbools) != -1){
                    if(member_array(yesline,load_lines) != -1) {
                        write("Persistent inet activation is already enabled.");
                            return 1;
                    }
                    else {
                        write("Enabling persistent inet activation.");
                            foreach(string line in load_lines){
                                if(line == noline) line = yesline;
                                    ret_arr += ({ line });
                            }
                        if(member_array(yesline,ret_arr) == -1){
                            ret_arr += ({ yesline });
                        }
                        unguarded( (: cp(CFG_PRELOAD,"/secure/save/backup/preload."+time()) :) );
                            ret_string = implode(ret_arr,"\n")+"\n";
                            ret_string = replace_string(ret_string,"\n\n","\n");
                            unguarded( (: write_file(CFG_PRELOAD,ret_string,1) :) );
                            write("The inet service is enabled.");
                            arg = "start";
                    }
                }
               
                    if(member_array(arg,nobools) != -1){
                        if(member_array(noline,load_lines) != -1){
                            write("Persistent inet activation is already disabled.");
                                return 1;
                        }
                        else {
                            write("Disabling persistent inet activation.");
                                foreach(string line in load_lines){
                                   
                                        if(line == yesline) line = noline;
                                            ret_arr += ({ line });
                                }
                            if(member_array(noline,ret_arr) == -1){
                                ret_arr += ({ noline });
                            }
                            unguarded( (: cp(CFG_PRELOAD,"/secure/save/backup/preload."+time()) :) );
                                ret_string = implode(ret_arr,"\n")+"\n";
                                ret_string = replace_string(ret_string,"\n\n","\n");
                                unguarded( (: write_file(CFG_PRELOAD,ret_string,1) :) );
                                write("The inet service is disabled.");
                                arg = "stop";
                        }
                    }
               
                    if(arg == "start"){
                        if(find_object(INET_D)) write("The inet service is already running.");
                        else {
                            write("Starting the inet service.");
                                load_object(INET_D);
                        }
                    }
                    else if(arg == "stop"){
                        if(!find_object(INET_D)) write("The inet service is already stopped.");
                        else {
                            write("Stopping the inet service.");
                                find_object(INET_D)->eventDestruct();
                        }
                    }
                    else if(arg == "restart"){
        &n

Offline z993126

  • BFF
  • ***
  • Posts: 128
    • View Profile
Re: Improved mudconfig help
« Reply #1 on: September 09, 2011, 12:22:26 pm »
Well that screwed up.  Here's the part I actually modified:

added #include <rooms.h>

Code: [Select]
string GetHelp(){
    return ("Syntax:  '%^B_WHITE%^%^BLACK%^mudconfig %^MAGENTA%^<parameter> <value>%^RESET%^'\n\n"
            "Modifies various system settings.\n"
            "Examples: \n"
            "\nmudconfig mudname <name>                                    (Currently %^YELLOW%^" + MUD_NAME + "%^RESET%^)"
            "\nmudconfig mudport <port>                                    (Currently %^YELLOW%^" + __PORT__ + "%^RESET%^)"
            "\nmudconfig email <the admin's email address>                 (Currently %^YELLOW%^" + ADMIN_EMAIL + "%^RESET%^)"
            "\nmudconfig startroom <filename of start room>                (Currently %^YELLOW%^" + ROOM_START + "%^RESET%^)"
            "\nmudconfig defaultdomain </full/path>"
            "\nmudconfig hostip <the computer's ip address (eg 111.222.333.444)>"
            "\nmudconfig websourceip <the remote web server's ip address (eg 111.222.333.444)>"
            "\nmudconfig websourcename <the remote web server's ip name (eg a.b.com)>"
            "\nmudconfig liveupgrade <the default liveupgrade mud's name>  (Currently %^YELLOW%^" + LIVEUPGRADE_SERVER + "%^RESET%^)"
            "\nmudconfig maxip <max connections per IP>                    (Currently %^YELLOW%^" + SAME_IP_MAX + "%^RESET%^)"
            "\nmudconfig pinginterval <i3 ping interval in seconds>        (Currently %^YELLOW%^" + PING_INTERVAL + "%^RESET%^)"
            "\nmudconfig monitor <monitoring level, 0 to 2>                (Currently %^YELLOW%^" + GLOBAL_MONITOR + "%^RESET%^)"
            "\nmudconfig newbielevel <max newbie level>                    (Currently %^YELLOW%^" + MAX_NEWBIE_LEVEL + "%^RESET%^)"
            "\nmudconfig resets <interval between resets>                  (Currently %^YELLOW%^" + TIME_TO_RESET + "%^RESET%^)"
            "\nmudconfig offset <offset from GMT in seconds>               (Currently %^YELLOW%^" + GMT_OFFSET + "%^RESET%^)"
            "\nmudconfig extraoffset <offset from GMT in hours>            (Currently %^YELLOW%^" + EXTRA_TIME_OFFSET + "%^RESET%^)"
            "\nmudconfig maxcommands <max number of commands per second>   (Currently %^YELLOW%^" + MAX_COMMANDS_PER_SECOND + "%^RESET%^)"
            "\nmudconfig maxidle <number of idle seconds before autoquit>  (Currently %^YELLOW%^" + IDLE_TIMEOUT + "%^RESET%^)"
            "\nmudconfig autowiz         [" + ( AUTO_WIZ == 1 ? "%^B_GREEN%^" : "" ) + " yes %^RESET%^|" + ( AUTO_WIZ == 0 ? "%^B_RED%^" : "" ) + " no %^RESET%^]"
            "\nmudconfig locked          [" + ( MUD_IS_LOCKED == 1 ? "%^B_GREEN%^" : "" ) + " yes %^RESET%^|" + ( MUD_IS_LOCKED == 0 ? "%^B_RED%^" : "" ) + " no %^RESET%^]"
            "\nmudconfig justenglish     [" + ( ENGLISH_ONLY == 1 ? "%^B_GREEN%^" : "" ) + " yes %^RESET%^|" + ( ENGLISH_ONLY == 0 ? "%^B_RED%^" : "" ) + " no %^RESET%^]"
            "\nmudconfig justhumans      [" + ( HUMANS_ONLY == 1 ? "%^B_GREEN%^" : "" ) + " yes %^RESET%^|" + ( HUMANS_ONLY == 0 ? "%^B_RED%^" : "" ) + " no %^RESET%^]"
            "\nmudconfig encumbrance     [" + ( ENABLE_ENCUMBRANCE == 1 ? "%^B_GREEN%^" : "" ) + " yes %^RESET%^|" + ( ENABLE_ENCUMBRANCE == 0 ? "%^B_RED%^" : "" ) + " no %^RESET%^]"
            "\nmudconfig severable       [" + ( SEVERABLE_LIMBS == 1 ? "%^B_GREEN%^" : "" ) + " yes %^RESET%^|" + ( SEVERABLE_LIMBS == 0 ? "%^B_RED%^" : "" ) + " no %^RESET%^]  (Whether limbs can be severed in combat. Requires a warmboot.)"
            "\nmudconfig pk              [" + ( PLAYER_KILL == 1 ? "%^B_GREEN%^" : "" ) + " yes %^RESET%^|" + ( PLAYER_KILL == 0 ? "%^B_RED%^" : "" ) + " no %^RESET%^]"
            "\nmudconfig minimap         [" + ( MINIMAP == 1 ? "%^B_GREEN%^" : "" ) + " yes %^RESET%^|" + ( MINIMAP == 0 ? "%^B_RED%^" : "" ) + " no %^RESET%^]  (Whether players get a minimap.)"
            "\nmudconfig wizmap          [" + ( WIZMAP == 1 ? "%^B_GREEN%^" : "" ) + " yes %^RESET%^|" + ( WIZMAP == 0 ? "%^B_RED%^" : "" ) + " no %^RESET%^]  (Whether cres get an area map.)"
            "\nmudconfig grid            [" + ( GRID == 1 ? "%^B_GREEN%^" : "" ) + " yes %^RESET%^|" + ( GRID == 0 ? "%^B_RED%^" : "" ) + " no %^RESET%^]  (Enable or disable the room grid system.)"
            "\nmudconfig compat          [" + ( COMPAT_MODE == 1 ? "%^B_GREEN%^" : "" ) + " yes %^RESET%^|" + ( COMPAT_MODE == 0 ? "%^B_RED%^" : "" ) + " no %^RESET%^]"
            "\nmudconfig retain          [" + ( RETAIN_ON_QUIT == 1 ? "%^B_GREEN%^" : "" ) + " yes %^RESET%^|" + ( RETAIN_ON_QUIT == 0 ? "%^B_RED%^" : "" ) + " no %^RESET%^]  (Whether items are retained on quit.)"
            "\nmudconfig defaultparse    [" + ( DEFAULT_PARSING == 1 ? "%^B_GREEN%^" : "" ) + " yes %^RESET%^|" + ( DEFAULT_PARSING == 0 ? "%^B_RED%^" : "" ) + " no %^RESET%^]"
            "\nmudconfig disablereboot   [" + ( DISABLE_REBOOTS == 1 ? "%^B_GREEN%^" : "" ) + " yes %^RESET%^|" + ( DISABLE_REBOOTS == 0 ? "%^B_RED%^" : "" ) + " no %^RESET%^]"
            "\nmudconfig matchcommand    [" + ( COMMAND_MATCHING == 1 ? "%^B_GREEN%^" : "" ) + " yes %^RESET%^|" + ( COMMAND_MATCHING == 0 ? "%^B_RED%^" : "" ) + " no %^RESET%^]  (Enable or disable fuzzy command matching.)"
            "\nmudconfig matchobject     [" + ( OBJECT_MATCHING == 1 ? "%^B_GREEN%^" : "" ) + " yes %^RESET%^|" + ( OBJECT_MATCHING == 0 ? "%^B_RED%^" : "" ) + " no %^RESET%^]  (Enable or disable fuzzy object name matching.)"
            "\nmudconfig exitsbare       [" + ( BARE_EXITS == 1 ? "%^B_GREEN%^" : "" ) + " yes %^RESET%^|" + ( BARE_EXITS == 0 ? "%^B_RED%^" : "" ) + " no %^RESET%^]"
            "\nmudconfig nmexits         [" + ( NM_STYLE_EXITS == 1 ? "%^B_GREEN%^" : "" ) + " yes %^RESET%^|" + ( NM_STYLE_EXITS == 0 ? "%^B_RED%^" : "" ) + " no %^RESET%^]  (This togggles where default exits are displayed.)"
            "\nmudconfig fastcombat      [" + ( FAST_COMBAT == 1 ? "%^B_GREEN%^" : "" ) + " yes %^RESET%^|" + ( FAST_COMBAT == 0 ? "%^B_RED%^" : "" ) + " no %^RESET%^]  (Heart rate overridden in combat.)"
            "\nmudconfig selectclass     [" + ( CLASS_SELECTION == 1 ? "%^B_GREEN%^" : "" ) + " yes %^RESET%^|" + ( CLASS_SELECTION == 0 ? "%^B_RED%^" : "" ) + " no %^RESET%^]  (Whether new players choose a class on login.)"
            "\nmudconfig instances       [" + ( ENABLE_INSTANCES == 1 ? "%^B_GREEN%^" : "" ) + " yes %^RESET%^|" + ( ENABLE_INSTANCES == 0 ? "%^B_RED%^" : "" ) + " no %^RESET%^]  (Whether mud instances are used.)"
            "\nmudconfig localtime       [" + ( LOCAL_TIME == 1 ? "%^B_GREEN%^" : "" ) + " yes %^RESET%^|" + ( LOCAL_TIME == 0 ? "%^B_RED%^" : "" ) + " no %^RESET%^]"
            "\nmudconfig questrequired   [" + ( REQUIRE_QUESTING == 1 ? "%^B_GREEN%^" : "" ) + " yes %^RESET%^|" + ( REQUIRE_QUESTING == 0 ? "%^B_RED%^" : "" ) + " no %^RESET%^]"
            "\nmudconfig autoadvance     [" + ( AUTO_ADVANCE == 1 ? "%^B_GREEN%^" : "" ) + " yes %^RESET%^|" + ( AUTO_ADVANCE == 0 ? "%^B_RED%^" : "" ) + " no %^RESET%^]"
            "\nmudconfig ced             [" + ( CED_DISABLED == 0 ? "%^B_GREEN%^" : "" ) + " yes %^RESET%^|" + ( CED_DISABLED == 1 ? "%^B_RED%^" : "" ) + " no %^RESET%^] (toggles the fullscreen editor)"
            "\nmudconfig router       [" + ( ROUTER_TESTING == 1 ? "%^B_GREEN%^" : "" ) + " enable %^RESET%^|" + ( ROUTER_TESTING == 0 ? "%^B_RED%^" : "" ) + " disable %^RESET%^]"
            "\nmudconfig channelpipes [ enable %^RESET%^| disable %^RESET%^]  (Whether to allow piping messages.  Not recommended.)"
            "\nmudconfig inet         [ enable %^RESET%^| disable %^RESET%^| start %^RESET%^| stop %^RESET%^| restart %^RESET%^| status %^RESET%^]"
            "\nmudconfig ftp          [ enable %^RESET%^| disable %^RESET%^| start %^RESET%^| stop %^RESET%^| restart %^RESET%^| status %^RESET%^]"
            "\nmudconfig hftp         [ enable %^RESET%^| disable %^RESET%^| start %^RESET%^| stop %^RESET%^| restart %^RESET%^| status %^RESET%^]"
            "\nmudconfig rcp          [ enable %^RESET%^| disable %^RESET%^| start %^RESET%^| stop %^RESET%^| restart %^RESET%^| status %^RESET%^]"
            "\nmudconfig oob          [ enable %^RESET%^| disable %^RESET%^| start %^RESET%^| stop %^RESET%^| restart %^RESET%^| status %^RESET%^]"
            "\nmudconfig http         [ enable %^RESET%^| disable %^RESET%^| start %^RESET%^| stop %^RESET%^| restart %^RESET%^| status %^RESET%^]"
            "\nmudconfig cgi          [" + ( ENABLE_CGI == 1 ? "%^B_GREEN%^" : "" ) + " enable %^RESET%^|" + ( ENABLE_CGI == 0 ? "%^B_RED%^" : "" ) + " disable %^RESET%^]  (Whether the mud webserver should use CGI.)"
            "\nmudconfig dirlist      [" + ( WWW_DIR_LIST == 1 ? "%^B_GREEN%^" : "" ) + " enable %^RESET%^|" + ( WWW_DIR_LIST == 0 ? "%^B_RED%^" : "" ) + " disable %^RESET%^]  (Allow the webserver to display dir contents.)"
            "\nmudconfig creweb       [" + ( ENABLE_CREWEB == 1 ? "%^B_GREEN%^" : "" ) + " enable %^RESET%^|" + ( ENABLE_CREWEB == 0 ? "%^B_RED%^" : "" ) + " disable %^RESET%^]  (Allow web based editing [requires cgi and dirlist].)"
            "\nmudconfig loglocal     [" + ( LOG_LOCAL_CHANS == 1 ? "%^B_GREEN%^" : "" ) + " enable %^RESET%^|" + ( LOG_LOCAL_CHANS == 0 ? "%^B_RED%^" : "" ) + " disable %^RESET%^]  (Whether local channels are logged.)"
            "\nmudconfig logremote    [" + ( LOG_REMOTE_CHANS == 1 ? "%^B_GREEN%^" : "" ) + " enable %^RESET%^|" + ( LOG_REMOTE_CHANS == 0 ? "%^B_RED%^" : "" ) + " disable %^RESET%^]  (Whether remote channels are logged.)"
            "\nmudconfig intermud     [" + ( DISABLE_INTERMUD == 0 ? "%^B_GREEN%^" : "" ) + " enable %^RESET%^|" + ( DISABLE_INTERMUD == 1 ? "%^B_RED%^" : "" ) + " disable %^RESET%^|" + ( RESTRICTED_INTERMUD == 1 ? "%^BOLD%^%^RED%^" : "" ) + " restrict %^RESET%^| unrestrict %^RESET%^| reset %^RESET%^]"
            "\nmudconfig imc2         [" + ( DISABLE_IMC2 == 0 ? "%^B_GREEN%^" : "" ) + " enable %^RESET%^|" + ( DISABLE_IMC2 == 1 ? "%^B_RED%^" : "" ) + " disable %^RESET%^]"
            "\nmudconfig imc2clientpass <client password for IMC2>"
            "\nmudconfig imc2serverpass <server password for IMC2>"
            "\n\nSee also:  admintool, config");
}

Offline Archaegeo

  • Acquaintance
  • *
  • Posts: 33
    • View Profile
Re: Improved mudconfig help
« Reply #2 on: November 02, 2011, 04:04:35 pm »
I did this about 3 years ago, not sure why its not been sucked in, yours or mine, either would be nice
http://lpmuds.net/smf/index.php?topic=569.0

Would be helpful for mudconfig to show the values it sets and their current status.

(Not sure if mine still valid, mudconfig prob changed or gained some more values in 3 years)

Offline quixadhal

  • BFF
  • ***
  • Posts: 642
    • View Profile
    • WileyMUD
Re: Improved mudconfig help
« Reply #3 on: November 02, 2011, 04:49:13 pm »
If only there were some source repository where people could clone their own local copy, make changes and then easily submit a diff.  It's be even better if they could also pull in official changes from said repository and merge them into their own custom lib as they liked.

Oh well, maybe someday...

Kalinash

  • Guest
Re: Improved mudconfig help
« Reply #4 on: November 04, 2011, 01:22:20 pm »

Offline quixadhal

  • BFF
  • ***
  • Posts: 642
    • View Profile
    • WileyMUD
Re: Improved mudconfig help
« Reply #5 on: November 05, 2011, 07:39:32 pm »
1990 called, they want their hand-rolled distributions back.  Oh, and they said they had a cool "Citadel BBS" that could replace this silly web forum.  Give 'em a call and let them know.

Offline z993126

  • BFF
  • ***
  • Posts: 128
    • View Profile
Re: Improved mudconfig help
« Reply #6 on: November 13, 2011, 12:57:54 am »
And here's my "finished" modification of it.  Looks much nicer.  Feel free to take and modify, etc.

Code: [Select]
string GetHelp(){
int x = this_player()->GetScreen()[0] - 37;
string preloads = read_file( CFG_PRELOAD );
string *load_lines = explode( preloads, "\n" );
string *ret_arr = ({});
string yesline = "/secure/daemon/inet";
string noline = "#/secure/daemon/inet";
string Y = "%^YELLOW%^", X  ="%^RESET%^", BG = "%^B_GREEN%^", BR = "%^B_RED%^", yX = " yes %^RESET%^|";
string nX = " no %^RESET%^]", eX = " enable %^RESET%^|", dX = " disable %^RESET%^]", uX = " unrestrict %^RESET%^|";
string rX = " restrict %^RESET%^|", dP = " disable %^RESET%^|";
this_player()->eventPage( explode(
"Syntax:  '%^B_WHITE%^%^BLACK%^mudconfig %^MAGENTA%^<parameter> <value>%^RESET%^'\n\n"
"Modifies various system settings.\n"
"Parameters: \n" +
sprintf(
"\n%%^BOLD%%^%%^CYAN%%^%|" + ( x + 37 ) + "'='s%%^RESET%%^" // == MUD SETTINGS ==
"\n  %-=14s %' '-=39s%' '=" + x + "s" +  // name
"\n  %-=14s %' '-=39s%' '=" + x + "s" +  // port
"\n  %-=14s %' '-=39s%' '=" + x + "s" +  // email
"\n  %-=14s %' '-=54s%' '=" + ( x - 15 ) + "s" +  // start
"\n  %-=14s %' '-=54s%' '=" + ( x - 15 ) + "s" +  // std domain
"\n  %-=14s %' '-=39s%' '=" + x + "s" +  // host
"\n  %-=14s %' '-=39s%' '=" + x + "s" +  // source ip
"\n  %-=14s %' '-=39s%' '=" + x + "s" +  // source name
"\n  %-=14s %' '-=39s%' '=" + x + "s" +  // LU
"\n  %-=14s %' '-=39s%' '=" + x + "s" +  // imc2 client pass
"\n  %-=14s %' '-=39s%' '=" + x + "s" +  // imc2 server pass
"\n  %-=14s %' '-=39s%' '=" + x + "s" +  // maxip
"\n  %-=14s %' '-=39s%' '=" + x + "s" +  // ping
"\n  %-=14s %' '-=39s%' '=" + x + "s" +  // mon
"\n  %-=14s %' '-=39s%' '=" + x + "s" +  // newbie
"\n  %-=14s %' '-=39s%' '=" + x + "s" +  // reset
"\n  %-=14s %' '-=39s%' '=" + x + "s" +  // offset1
"\n  %-=14s %' '-=39s%' '=" + x + "s" +  // offset2
"\n  %-=14s %' '-=39s%' '=" + x + "s" +  // commands
"\n  %-=14s %' '-=39s%' '=" + x + "s",   // idle
"MUD SETTINGS",
"mudname",        Y + MUD_NAME + X,                         "MUD name",
"mudport",        Y + (string) __PORT__ + X,                "MUD access port",
"email",          Y + ADMIN_EMAIL + X,                      "administrator e-mail address",
"startroom",      Y + ROOM_START + X,                       "start room",
"defaultdomain",  Y + DIR_STANDARD_DOMAIN + X,              "default domain path",
"hostip",         Y + HOST_IP + X,                          "host computer IP address",
"websourceip",    Y + WEB_SOURCE_IP + X,                    "liveupgrade server IP address",
"websourcename",  Y + WEB_SOURCE_NAME + X,                  "liveupgrade server domain name",
"liveupgrade",    Y + LIVEUPGRADE_SERVER + X,               "default liveupgrade MUD name",
"imc2clientpass", Y + "******" + X,                         "IMC2 client password",
"imc2serverpass", Y + "******" + X,                         "IMC2 server password",
"maxip",          Y + (string) SAME_IP_MAX + X,             "maximum connections per IP address",
"pinginterval",   Y + (string) PING_INTERVAL + X,           "seconds between I3 pings",
"monitor",        Y + (string) GLOBAL_MONITOR + X,          "monitoring level, 0 to 2",
"newbielevel",    Y + (string) MAX_NEWBIE_LEVEL + X,        "maximum newbie level",
"resets",         Y + (string) TIME_TO_RESET + X,           "seconds between reset calls",
"offset",         Y + (string) GMT_OFFSET + X,              "seconds of offset from GMT",
"extraoffset",    Y + (string) EXTRA_TIME_OFFSET + X,       "hours of offset from GMT",
"maxcommands",    Y + (string) MAX_COMMANDS_PER_SECOND + X, "maximum user commands per second",
"maxidle",        Y + (string) IDLE_TIMEOUT + X,            "seconds to idle autoquit"
) +
sprintf(
"\n%%^BOLD%%^%%^CYAN%%^%|" + ( x + 37 ) + "'='s%%^RESET%%^" // == SYSTEM OPTIONS ==
"\n  %-=15s [%s yes %s|%s no %s]%' '=" + ( x + 7 ) + "s"   // locked
"\n  %-=15s [%s yes %s|%s no %s]%' '=" + ( x + 7 ) + "s"   // instances
"\n  %-=15s [%s yes %s|%s no %s]%' '=" + ( x + 7 ) + "s"   // disablereboot
"\n  %-=15s [%s yes %s|%s no %s]%' '=" + ( x + 7 ) + "s"   // compat
"\n  %-=15s [%s yes %s|%s no %s]%' '=" + ( x + 7 ) + "s"   // grid
"\n  %-=15s [%s yes %s|%s no %s]%' '=" + ( x + 7 ) + "s"   // localtime
"\n%%^BOLD%%^%%^CYAN%%^%|" + ( x + 37 ) + "'"='s%%^RESET%%^"  // == CHARACTER OPTIONS ==
"\n  %-=15s [%s yes %s|%s no %s]%' '=" + ( x + 7 ) + "s"   // autowiz
"\n  %-=15s [%s yes %s|%s no %s]%' '=" + ( x + 7 ) + "s"   // justhuman
"\n  %-=15s [%s yes %s|%s no %s]%' '=" + ( x + 7 ) + "s"   // justenglish
"\n  %-=15s [%s yes %s|%s no %s]%' '=" + ( x + 7 ) + "s"   // selectclass
"\n  %-=15s [%s yes %s|%s no %s]%' '=" + ( x + 7 ) + "s"   // encumbrance
"\n  %-=15s [%s yes %s|%s no %s]%' '=" + ( x + 7 ) + "s"   // severable
"\n  %-=15s [%s yes %s|%s no %s]%' '=" + ( x + 7 ) + "s"   // pk
"\n%%^BOLD%%^%%^CYAN%%^%|" + ( x + 37 ) + "'='s%%^RESET%%^" // == GAMEPLAY OPTIONS ==
"\n  %-=15s [%s yes %s|%s no %s]%' '=" + ( x + 7 ) + "s"   // retain
"\n  %-=15s [%s yes %s|%s no %s]%' '=" + ( x + 7 ) + "s"   // fastcombat
"\n  %-=15s [%s yes %s|%s no %s]%' '=" + ( x + 7 ) + "s"   // questrequired
"\n  %-=15s [%s yes %s|%s no %s]%' '=" + ( x + 7 ) + "s"   // autoadvance
"\n%%^BOLD%%^%%^CYAN%%^%|" + ( x + 37 ) + "'='s%%^RESET%%^"  // == INTERFACE OPTIONS ==
"\n  %-=15s [%s yes %s|%s no %s]%' '=" + ( x + 7 ) + "s"   // minimap
"\n  %-=15s [%s yes %s|%s no %s]%' '=" + ( x + 7 ) + "s"   // wizmap
"\n  %-=15s [%s yes %s|%s no %s]%' '=" + ( x + 7 ) + "s"   // defaultparse
"\n  %-=15s [%s yes %s|%s no %s]%' '=" + ( x + 7 ) + "s"   // matchcommand
"\n  %-=15s [%s yes %s|%s no %s]%' '=" + ( x + 7 ) + "s"   // matchobject
"\n  %-=15s [%s yes %s|%s no %s]%' '=" + ( x + 7 ) + "s"   // exitsbare
"\n  %-=15s [%s yes %s|%s no %s]%' '=" + ( x + 7 ) + "s"   // nmexits
"\n  %-=15s [%s yes %s|%s no %s]%' '=" + ( x + 7 ) + "s",  // ced
"SYSTEM OPTIONS",
"locked",        MUD_IS_LOCKED      == 1 ? BG : "", X, MUD_IS_LOCKED      == 0 ? BR : "", X, "restrict logins",
"instances",     ENABLE_INSTANCES   == 1 ? BG : "", X, ENABLE_INSTANCES   == 0 ? BR : "", X, "use MUD instances",
"disablereboot", DISABLE_REBOOTS    == 1 ? BG : "", X, DISABLE_REBOOTS    == 0 ? BR : "", X, "disable reboots",
"compat",        COMPAT_MODE        == 1 ? BG : "", X, COMPAT_MODE        == 0 ? BR : "", X, "use compatibility mode",
"grid",          GRID               == 1 ? BG : "", X, GRID               == 0 ? BR : "", X, "use room grid system",
"localtime",     LOCAL_TIME         == 1 ? BG : "", X, LOCAL_TIME         == 0 ? BR : "", X, "use local system time",
"CHARACTER OPTIONS",
"autowiz",       AUTO_WIZ           == 1 ? BG : "", X, AUTO_WIZ           == 0 ? BR : "", X, "all users are wizards",
"justhumans",    HUMANS_ONLY        == 1 ? BG : "", X, HUMANS_ONLY        == 0 ? BR : "", X, "restrict races",
"justenglish",   ENGLISH_ONLY       == 1 ? BG : "", X, ENGLISH_ONLY       == 0 ? BR : "", X, "restrict languages",
"selectclass",   CLASS_SELECTION    == 1 ? BG : "", X, CLASS_SELECTION    == 0 ? BR : "", X, "class choice at create",
"encumbrance",   ENABLE_ENCUMBRANCE == 1 ? BG : "", X, ENABLE_ENCUMBRANCE == 0 ? BR : "", X, "stricter encumbrance",
"severable",     SEVERABLE_LIMBS    == 1 ? BG : "", X, SEVERABLE_LIMBS    == 0 ? BR : "", X, "severable limbs (req. reboot)",
"pk",            PLAYER_KILL        == 1 ? BG : "", X, PLAYER_KILL        == 0 ? BR : "", X, "allow player-killing",
"GAMEPLAY OPTIONS",
"retain",        RETAIN_ON_QUIT     == 1 ? BG : "", X, RETAIN_ON_QUIT     == 0 ? BR : "", X, "inventory persistence",
"fastcombat",    FAST_COMBAT        == 1 ? BG : "", X, FAST_COMBAT        == 0 ? BR : "", X, "disable default combat heartbeat",
"questrequired", REQUIRE_QUESTING   == 1 ? BG : "", X, REQUIRE_QUESTING   == 0 ? BR : "", X, "require questing",
"autoadvance",   AUTO_ADVANCE       == 1 ? BG : "", X, AUTO_ADVANCE       == 0 ? BR : "", X, "autoadvance characters",
"INTERFACE OPTIONS",
"minimap",       MINIMAP            == 1 ? BG : "", X, MINIMAP            == 0 ? BR : "", X, "player minimap access",
"wizmap",        WIZMAP             == 1 ? BG : "", X, WIZMAP             == 0 ? BR : "", X, "creator wizmap access",
"defaultparse",  DEFAULT_PARSING    == 1 ? BG : "", X, DEFAULT_PARSING    == 0 ? BR : "", X, "use default parser",
"matchcommand",  COMMAND_MATCHING   == 1 ? BG : "", X, COMMAND_MATCHING   == 0 ? BR : "", X, "fuzzy-match commands",
"matchobject",   OBJECT_MATCHING    == 1 ? BG : "", X, OBJECT_MATCHING    == 0 ? BR : "", X, "fuzzy-match object names",
"exitsbare",     BARE_EXITS         == 1 ? BG : "", X, BARE_EXITS         == 0 ? BR : "", X, "simple-match exits",
"nmexits",       NM_STYLE_EXITS     == 1 ? BG : "", X, NM_STYLE_EXITS     == 0 ? BR : "", X, "Nightmare-style exits",
"ced",           CED_DISABLED       == 0 ? BG : "", X, CED_DISABLED       == 1 ? BR : "", X, "use fullscreen editor"
) +
sprintf(
"\n%%^BOLD%%^%%^CYAN%%^%|" + ( x + 37 ) + "'" + box( 0022, enc ) + "'s%%^RESET%%^"  // == NETWORK OPTIONS ==
"\n  %-=12s [%s enable %s|%s disable %s]%' '=" + ( x + 2 ) + "s"
"\n  %-=12s [%s enable %s|%s disable %s]%' '=" + ( x + 2 ) + "s"
"\n  %-=12s [%s enable %s|%s disable %s]%' '=" + ( x + 2 ) + "s",
"NETWORK OPTIONS",
"router",    find_object( ROUTER_D ) ? BG : "", X, !find_object( ROUTER_D ) ? BR : "", X, "use intermud router",
"cgi",       ENABLE_CGI         == 1 ? BG : "", X, ENABLE_CGI          == 0 ? BR : "", X, "allow MUD webserver CGI",
"dirlist",   WWW_DIR_LIST       == 1 ? BG : "", X, WWW_DIR_LIST        == 0 ? BR : "", X, "allow webserver dir listing"
) +
( ENABLE_CGI == 1 && WWW_DIR_LIST == 1 ? sprintf(
"\n  %-=12s [%s enable %s|%s disable %s]%' '=" + ( x + 2 ) + "s",
"creweb",    ENABLE_CREWEB      == 1 ? BG : "", X, ENABLE_CREWEB       == 0 ? BR : "", X, "allow web-based editing"
) : "" ) +
sprintf(
"\n  %-=12s [%s enable %s|%s disable %s]%' '=" + ( x + 2 ) + "s"
"\n  %-=12s [%s enable %s|%s disable %s]%' '=" + ( x + 2 ) + "s"
"\n  %-=12s [%s enable %s|%s disable %s]%' '=" + ( x + 2 ) + "s",
"loglocal",  LOG_LOCAL_CHANS    == 1 ? BG : "", X, LOG_LOCAL_CHANS     == 0 ? BR : "", X, "log local channels",
"logremote", LOG_REMOTE_CHANS   == 1 ? BG : "", X, LOG_REMOTE_CHANS    == 0 ? BR : "", X, "log remote channels",
"imc2",      DISABLE_IMC2       == 0 ? BG : "", X, DISABLE_IMC2        == 1 ? BR : "", X, "allow IMC2 protocol use"
) +
"\n  inet         [" +
( member_array( yesline, load_lines ) != -1 ? BG : "" ) + " enable %^RESET%^|" +
( member_array( noline,  load_lines ) != -1 ? BR : "" ) + " disable %^RESET%^|" +
( find_object( INET_D ) ? BG : "" ) + " start %^RESET%^|" + ( !find_object( INET_D ) ? BR : "" ) + " stop %^RESET%^| restart | status ]"
"\n  ftp          [" +
(  INET_D->GetService( "ftp" ) ? BG : "" ) + eX +
( !INET_D->GetService( "ftp" ) ? BR : "" ) + dP +
(  INET_D->GetServer(  "ftp" ) ? BG : "" ) + " start %^RESET%^|" +
( !INET_D->GetServer(  "ftp" ) ? BR : "" ) + " stop %^RESET%^| restart | status ]"
"\n  hftp         [" +
(  INET_D->GetService( "hftp" ) ? BG : "" ) + eX +
( !INET_D->GetService( "hftp" ) ? BR : "" ) + dP +
(  INET_D->GetServer(  "hftp" ) ? BG : "" ) + " start %^RESET%^|" +
( !INET_D->GetServer(  "hftp" ) ? BR : "" ) + " stop %^RESET%^| restart | status ]"
"\n  rcp          [" +
(  INET_D->GetService( "rcp" ) ? BG : "" ) + eX +
( !INET_D->GetService( "rcp" ) ? BR : "" ) + dP +
(  INET_D->GetServer(  "rcp" ) ? BG : "" ) + " start %^RESET%^|" +
( !INET_D->GetServer(  "rcp" ) ? BR : "" ) + " stop %^RESET%^| restart | status ]"
"\n  oob          [" +
(  INET_D->GetService( "oob" ) ? BG : "" ) + eX +
( !INET_D->GetService( "oob" ) ? BR : "" ) + dP +
(  INET_D->GetServer(  "oob" ) ? BG : "" ) + " start %^RESET%^|" +
( !INET_D->GetServer(  "oob" ) ? BR : "" ) + " stop %^RESET%^| restart | status ]"
"\n  http         [" +
(  INET_D->GetService( "http" ) ? BG : "" ) + eX +
( !INET_D->GetService( "http" ) ? BR : "" ) + dX +
(  INET_D->GetServer(  "http" ) ? BG : "" ) + " start %^RESET%^|" +
( !INET_D->GetServer(  "http" ) ? BR : "" ) + " stop %^RESET%^| restart | status ]"
"\n  intermud     [" + ( DISABLE_INTERMUD    == 0 ? BG : "" ) + eX + ( DISABLE_INTERMUD    == 1 ? BR : "" ) + " disable %^RESET%^|" +
                       ( RESTRICTED_INTERMUD == 0 ? BG : "" ) + uX + ( RESTRICTED_INTERMUD == 1 ? BR : "" ) + rX + " reset ]"
//"\n  channelpipes [ enable %^RESET%^| disable %^RESET%^]  (Whether to allow piping messages.  Not recommended.)"
"\n\nSee also:  admintool, config", "\n"
), MSG_ENV );
return 0;
}

Offline quixadhal

  • BFF
  • ***
  • Posts: 642
    • View Profile
    • WileyMUD
Re: Improved mudconfig help
« Reply #7 on: November 13, 2011, 07:18:26 pm »
Coupla things...

If you haven't set a start room, ROOM_START is not defined, so you need to put #ifdef ROOM_START around the lines that use it, otherwise brand new muds will fail.

You have a typo on your //CHARACTER OPTIONS line, extra double-quote.

And the function box() and variable enc appear to be custom things you wrote and haven't included. :)

Otherwise, looks good. :)

Offline quixadhal

  • BFF
  • ***
  • Posts: 642
    • View Profile
    • WileyMUD
Re: Improved mudconfig help
« Reply #8 on: November 14, 2011, 02:50:11 am »
Just because I was bored and this was along the lines of what I was doing myself too...

Code: [Select]
string GetHelp(){
        int width = this_player()->GetScreen()[0];
        string *preloads = explode( read_file( CFG_PRELOAD ), "\n" );
        string yesline = "/secure/daemon/inet";
        string noline = "#/secure/daemon/inet";
        string Y = "%^YELLOW%^", X  ="%^RESET%^", BG = "%^B_GREEN%^", BR = "%^B_RED%^";

        string enabled = "[" + BG + Y + " yes " + X + "|  no ]";
        string disabled = "[ yes |" + BR + Y + "  no " + X + "]";
        string srvenabled = "[" + BG + Y + "   yes   " + X + "|    no   |  start  |   stop  | restart |  status ]";
        string srvdisabled = "[   yes   |" + BR + Y + "    no   " + X + "|  start  |   stop  | restart |  status ]";
        string i3ena = "[" + BG + Y + "   yes   " + X + "|    no   ";
        string i3dis = "[   yes   |" + BR + Y + "    no   " + X;
        string i3un = "|" + BG + Y + "  unrestrict  " + X + "|   restrict   |  reset  ]";
        string i3res  = "|  unrestrict  |" + BR + Y + "   restrict   " + X + "|  reset  ]";

        int y_width = strlen(Y+X);
        int ena_width = strlen(BG+Y+X);
        int dis_width = strlen(BR+Y+X);
        int i3eu_width = strlen(BG+Y+X+BG+Y+X);
        int i3du_width = strlen(BR+Y+X+BG+Y+X);
        int i3er_width = strlen(BG+Y+X+BR+Y+X);
        int i3dr_width = strlen(BR+Y+X+BR+Y+X);
        int router_here = find_object(ROUTER_D) ? 1 : 0;
        int inet_enabled = member_array( yesline, preloads ) == -1 ? 0 : 1;
        int ftp_enabled = INET_D->GetService("ftp");
        int hftp_enabled = INET_D->GetService("hftp");
        int rcp_enabled = INET_D->GetService("rcp");
        int oob_enabled = INET_D->GetService("oob");
        int http_enabled = INET_D->GetService("http");

        string *output = ({ });
        output += ({ "Syntax:  '%^B_WHITE%^%^BLACK%^mudconfig %^MAGENTA%^<parameter> <value>%^RESET%^'" });
        output += ({ "" });
        output += ({ "Modifies various system settings." });
        output += ({ "Parameters: " });
        output += ({ sprintf( "%%^BOLD%%^%%^CYAN%%^%|*'='s%%^RESET%%^", width, "[ MUD SETTINGS ]") });

        output += ({ sprintf( "  %-=15s %-=*s %=36s", "mudname",        width-2-15-1+y_width-1-36-2, Y + MUD_NAME + X,                     "MUD name") });
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "mudport",        width-2-15-1+y_width-1-36-2, Y + "" + __PORT__ + X,                "MUD access port") });
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "email",          width-2-15-1+y_width-1-36-2, Y + ADMIN_EMAIL + X,                  "administrator e-mail address") });

#ifdef ROOM_START
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "startroom",      width-2-15-1+y_width-1-36-2, Y + ROOM_START + X,                   "start room") });
#else
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "startroom",      width-2-15-1+y_width-1-36-2, Y + "NONE" + X,                       "start room") });
#endif
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "defaultdomain",  width-2-15-1+y_width-1-36-2, Y + DIR_STANDARD_DOMAIN + X,          "default domain path") });
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "hostip",         width-2-15-1+y_width-1-36-2, Y + HOST_IP + X,                      "host computer IP address") });
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "websourceip",    width-2-15-1+y_width-1-36-2, Y + WEB_SOURCE_IP + X,                "liveupgrade server IP address") })
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "websourcename",  width-2-15-1+y_width-1-36-2, Y + WEB_SOURCE_NAME + X,              "liveupgrade server domain name") }
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "liveupgrade",    width-2-15-1+y_width-1-36-2, Y + LIVEUPGRADE_SERVER + X,           "default liveupgrade MUD name") });
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "imc2clientpass", width-2-15-1+y_width-1-36-2, Y + "******" + X,                     "IMC2 client password") });
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "imc2serverpass", width-2-15-1+y_width-1-36-2, Y + "******" + X,                     "IMC2 server password") });
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "maxip",          width-2-15-1+y_width-1-36-2, Y + "" + SAME_IP_MAX + X,             "maximum connections per IP address
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "pinginterval",   width-2-15-1+y_width-1-36-2, Y + "" + PING_INTERVAL + X,           "seconds between I3 pings") });
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "monitor",        width-2-15-1+y_width-1-36-2, Y + "" + GLOBAL_MONITOR + X,          "monitoring level, 0 to 2") });
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "newbielevel",    width-2-15-1+y_width-1-36-2, Y + "" + MAX_NEWBIE_LEVEL + X,        "maximum newbie level") });
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "resets",         width-2-15-1+y_width-1-36-2, Y + "" + TIME_TO_RESET + X,           "seconds between reset calls") });
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "offset",         width-2-15-1+y_width-1-36-2, Y + "" + GMT_OFFSET + X,              "seconds of offset from GMT") });
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "extraoffset",    width-2-15-1+y_width-1-36-2, Y + "" + EXTRA_TIME_OFFSET + X,       "hours of offset from GMT") });
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "maxcommands",    width-2-15-1+y_width-1-36-2, Y + "" + MAX_COMMANDS_PER_SECOND + X, "maximum user commands per second")
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "maxidle",        width-2-15-1+y_width-1-36-2, Y + "" + IDLE_TIMEOUT + X,            "seconds to idle autoquit") });

        output += ({ sprintf( "%%^BOLD%%^%%^CYAN%%^%|*'='s%%^RESET%%^", width, "[ SYSTEM OPTIONS ]") });
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "locked",         width-2-15-1+(MUD_IS_LOCKED ? ena_width : dis_width)-1-36-2,      (MUD_IS_LOCKED ? enabled : disabled)
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "instances",      width-2-15-1+(ENABLE_INSTANCES ? ena_width : dis_width)-1-36-2,   (ENABLE_INSTANCES ? enabled : disabl
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "disablereboot",  width-2-15-1+(DISABLE_REBOOTS ? ena_width : dis_width)-1-36-2,    (DISABLE_REBOOTS ? enabled : disable
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "compat",         width-2-15-1+(COMPAT_MODE ? ena_width : dis_width)-1-36-2,        (COMPAT_MODE ? enabled : disabled),
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "grid",           width-2-15-1+(GRID ? ena_width : dis_width)-1-36-2,               (GRID ? enabled : disabled),
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "localtime",      width-2-15-1+(LOCAL_TIME ? ena_width : dis_width)-1-36-2,         (LOCAL_TIME ? enabled : disabled),

        output += ({ sprintf( "%%^BOLD%%^%%^CYAN%%^%|*'='s%%^RESET%%^", width, "[ CHARACTER OPTIONS ]") });
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "autowiz",        width-2-15-1+(AUTO_WIZ ? ena_width : dis_width)-1-36-2,           (AUTO_WIZ ? enabled : disabled),
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "justhumans",     width-2-15-1+(HUMANS_ONLY ? ena_width : dis_width)-1-36-2,        (HUMANS_ONLY ? enabled : disabled),
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "justenglish",    width-2-15-1+(ENGLISH_ONLY ? ena_width : dis_width)-1-36-2,       (ENGLISH_ONLY ? enabled : disabled),
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "selectclass",    width-2-15-1+(CLASS_SELECTION ? ena_width : dis_width)-1-36-2,    (CLASS_SELECTION ? enabled : disable
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "encumbrance",    width-2-15-1+(ENABLE_ENCUMBRANCE ? ena_width : dis_width)-1-36-2, (ENABLE_ENCUMBRANCE ? enabled : disa
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "severable",      width-2-15-1+(SEVERABLE_LIMBS ? ena_width : dis_width)-1-36-2,    (SEVERABLE_LIMBS ? enabled : disable
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "pk",             width-2-15-1+(PLAYER_KILL ? ena_width : dis_width)-1-36-2,        (PLAYER_KILL ? enabled : disabled),

        output += ({ sprintf( "%%^BOLD%%^%%^CYAN%%^%|*'='s%%^RESET%%^", width, "[ GAMEPLAY OPTIONS ]") });
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "retain",         width-2-15-1+(RETAIN_ON_QUIT ? ena_width : dis_width)-1-36-2,     (RETAIN_ON_QUIT ? enabled : disabled
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "fastcombat",     width-2-15-1+(FAST_COMBAT ? ena_width : dis_width)-1-36-2,        (FAST_COMBAT ? enabled : disabled),
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "questrequired",  width-2-15-1+(REQUIRE_QUESTING ? ena_width : dis_width)-1-36-2,   (REQUIRE_QUESTING ? enabled : disabl
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "autoadvance",    width-2-15-1+(AUTO_ADVANCE ? ena_width : dis_width)-1-36-2,       (AUTO_ADVANCE ? enabled : disabled),

        output += ({ sprintf( "%%^BOLD%%^%%^CYAN%%^%|*'='s%%^RESET%%^", width, "[ INTERFACE OPTIONS ]") });
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "minimap",        width-2-15-1+(MINIMAP ? ena_width : dis_width)-1-36-2,            (MINIMAP ? enabled : disabled),
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "wizmap",         width-2-15-1+(WIZMAP ? ena_width : dis_width)-1-36-2,             (WIZMAP ? enabled : disabled),
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "defaultparse",   width-2-15-1+(DEFAULT_PARSING ? ena_width : dis_width)-1-36-2,    (DEFAULT_PARSING ? enabled : disable
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "matchcommand",   width-2-15-1+(COMMAND_MATCHING ? ena_width : dis_width)-1-36-2,   (COMMAND_MATCHING ? enabled : disabl
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "matchobject",    width-2-15-1+(OBJECT_MATCHING ? ena_width : dis_width)-1-36-2,    (OBJECT_MATCHING ? enabled : disable
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "exitsbare",      width-2-15-1+(BARE_EXITS ? ena_width : dis_width)-1-36-2,         (BARE_EXITS ? enabled : disabled),
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "nmexits",        width-2-15-1+(NM_STYLE_EXITS ? ena_width : dis_width)-1-36-2,     (NM_STYLE_EXITS ? enabled : disabled
        /* Pay attention!  This is a negative flag! */
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "ced",            width-2-15-1+(!CED_DISABLED ? ena_width : dis_width)-1-36-2,      (!CED_DISABLED ? enabled : disabled)

        output += ({ sprintf( "%%^BOLD%%^%%^CYAN%%^%|*'='s%%^RESET%%^", width, "[ NETWORK OPTIONS ]") });
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "router",         width-2-15-1+(router_here ? ena_width : dis_width)-1-36-2,        (router_here ? enabled : disabled),
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "cgi",            width-2-15-1+(ENABLE_CGI ? ena_width : dis_width)-1-36-2,         (ENABLE_CGI ? enabled : disabled),
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "dirlist",        width-2-15-1+(WWW_DIR_LIST ? ena_width : dis_width)-1-36-2,       (WWW_DIR_LIST ? enabled : disabled),

        if( ENABLE_CGI == 1 && WWW_DIR_LIST == 1 ) {
            output += ({ sprintf( "  %-=15s %-=*s %=36s", "creweb",         width-2-15-1+(ENABLE_CREWEB ? ena_width : dis_width)-1-36-2,      (ENABLE_CREWEB ? enabled : disab
        }

        output += ({ sprintf( "  %-=15s %-=*s %=36s", "loglocal",       width-2-15-1+(LOG_LOCAL_CHANS ? ena_width : dis_width)-1-36-2,    (LOG_LOCAL_CHANS ? enabled : disable
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "logremote",      width-2-15-1+(LOG_REMOTE_CHANS ? ena_width : dis_width)-1-36-2,   (LOG_REMOTE_CHANS ? enabled : disabl
        /* Pay attention!  This is a negative flag! */
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "imc2",           width-2-15-1+(!DISABLE_IMC2 ? ena_width : dis_width)-1-36-2,      (!DISABLE_IMC2 ? enabled : disabled)

        output += ({ sprintf( "%%^BOLD%%^%%^CYAN%%^%|*'='s%%^RESET%%^", width, "[ NETWORK SERVICES ]") });
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "inet",           width-2-15-1+(inet_enabled ? ena_width : dis_width)-1-36-2,      (inet_enabled ? srvenabled : srvdisab
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "ftp",            width-2-15-1+(ftp_enabled ? ena_width : dis_width)-1-36-2,       (ftp_enabled ? srvenabled : srvdisabl
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "hftp",           width-2-15-1+(hftp_enabled ? ena_width : dis_width)-1-36-2,      (hftp_enabled ? srvenabled : srvdisab
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "rcp",            width-2-15-1+(rcp_enabled ? ena_width : dis_width)-1-36-2,       (rcp_enabled ? srvenabled : srvdisabl
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "oob",            width-2-15-1+(oob_enabled ? ena_width : dis_width)-1-36-2,       (oob_enabled ? srvenabled : srvdisabl
        output += ({ sprintf( "  %-=15s %-=*s %=36s", "http",           width-2-15-1+(http_enabled ? ena_width : dis_width)-1-36-2,      (http_enabled ? srvenabled : srvdisab
        if(!DISABLE_INTERMUD) {
            output += ({ sprintf( "  %-=15s %-=*s %=36s", "intermud",       width-2-15-1+(!RESTRICTED_INTERMUD ? i3eu_width: i3er_width)-1-36-2, (!RESTRICTED_INTERMUD ? i3ena
        } else {
            output += ({ sprintf( "  %-=15s %-=*s %=36s", "intermud",       width-2-15-1+(!RESTRICTED_INTERMUD ? i3du_width: i3dr_width)-1-36-2, (!RESTRICTED_INTERMUD ? i3dis
        }

        //"\n  channelpipes [ enable %^RESET%^| disable %^RESET%^]  (Whether to allow piping messages.  Not recommended.)"
        output += ({ "" });
        output += ({ "See also:  admintool, config" });

        this_player()->eventPage(output, MSG_SYSTEM);
        return 0;
}

Offline z993126

  • BFF
  • ***
  • Posts: 128
    • View Profile
Re: Improved mudconfig help
« Reply #9 on: November 19, 2011, 04:12:17 am »
If you haven't set a start room, ROOM_START is not defined, so you need to put #ifdef ROOM_START around the lines that use it, otherwise brand new muds will fail.

You have a typo on your //CHARACTER OPTIONS line, extra double-quote.
And the function box() and variable enc appear to be custom things you wrote and haven't included. :)

Ah, thanks for that.  The extra double-quote is a typo from the fact that I (thought I) replaced all the box() references with "=", ditto enc variable.
For the laughs and/or if you're interested in it, here's my box() sefun:

Code: [Select]
/* ** HEADER for ../funs/boxdrawing.c **
2005-Jul-31 - T. Cook
boxdrawing character handling
-----
2011-Aug-16 - T. Cook revised for DeadSouls
2011-Jul-17 - T. Cook began altering for DeadSouls
2010-May-21 - T. Cook reformatted for notepad++
2009-Dec-30 - T. Cook modified for tublib, streamlined
2005-Sep-27 - T. Cook tidied up
*/
#pragma strong_types

#ifndef __boxdrawing__
#define __boxdrawing__
/* info for box()
func: get boxdrawing character
args: int form (UDRL  1=single, 2=double, 0=none)
string style "OEM", "UTF-8", "Latin-1" [default]
rtrn: string boxdrawing character
*/
string box( int form, string style ){
switch( style ){
case "OEM":
switch( form ){
case 0000: return "\x20";
case 0011: return "\xC4";
case 0022: return "\xCD";
case 0101: return "\xBF";
case 0102: return "\xB8";
case 0110: return "\xDA";
case 0111: return "\xC2";
case 0120: return "\xD5";
case 0122: return "\xD1";
case 0201: return "\xB7";
case 0202: return "\xBB";
case 0210: return "\xD6";
case 0211: return "\xD2";
case 0220: return "\xC9";
case 0222: return "\xCB";
case 1001: return "\xD9";
case 1002: return "\xBE";
case 1010: return "\xC0";
case 1011: return "\xC1";
case 1020: return "\xD4";
case 1022: return "\xCF";
case 1100: return "\xB3";
case 1101: return "\xB4";
case 1102: return "\xB5";
case 1110: return "\xC3";
case 1111: return "\xC5";
case 1120: return "\xC6";
case 1122: return "\xD8";
case 2001: return "\xBD";
case 2002: return "\xBC";
case 2010: return "\xD3";
case 2011: return "\xD0";
case 2020: return "\xC8";
case 2022: return "\xCA";
case 2200: return "\xBA";
case 2201: return "\xB6";
case 2202: return "\xB9";
case 2210: return "\xC7";
case 2211: return "\xD7";
case 2220: return "\xCC";
case 2222: return "\xCE";
default:   return "\x3F";
}
break;
case "UTF-8":
switch( form ){
case 0000: return "\xE3\x80\x80";
case 0011: return "\xE2\x94\x80";
case 0022: return "\xE2\x95\x90";
case 0101: return "\xE2\x94\x90";
case 0102: return "\xE2\x95\x95";
case 0110: return "\xE2\x94\x8C";
case 0111: return "\xE2\x94\xAC";
case 0120: return "\xE2\x95\x92";
case 0122: return "\xE2\x95\xA4";
case 0201: return "\xE2\x95\x96";
case 0202: return "\xE2\x95\x97";
case 0210: return "\xE2\x95\x93";
case 0211: return "\xE2\x95\xA5";
case 0220: return "\xE2\x95\x94";
case 0222: return "\xE2\x95\xA6";
case 1001: return "\xE2\x94\x98";
case 1002: return "\xE2\x95\x9B";
case 1010: return "\xE2\x94\x94";
case 1011: return "\xE2\x94\xB4";
case 1020: return "\xE2\x95\x98";
case 1022: return "\xE2\x95\xA7";
case 1100: return "\xE2\x94\x82";
case 1101: return "\xE2\x94\xA4";
case 1102: return "\xE2\x95\xA1";
case 1110: return "\xE2\x94\x9C";
case 1111: return "\xE2\x94\xBC";
case 1120: return "\xE2\x95\x9E";
case 1122: return "\xE2\x95\xAA";
case 2001: return "\xE2\x95\x9C";
case 2002: return "\xE2\x95\x9D";
case 2010: return "\xE2\x95\x99";
case 2011: return "\xE2\x95\xA8";
case 2020: return "\xE2\x95\x9A";
case 2022: return "\xE2\x95\xA9";
case 2200: return "\xE2\x95\x91";
case 2201: return "\xE2\x95\xA2";
case 2202: return "\xE2\x95\xA3";
case 2210: return "\xE2\x95\x9F";
case 2211: return "\xE2\x95\xAB";
case 2220: return "\xE2\x95\xA0";
case 2222: return "\xE2\x95\xAC";
default:   return "\xEF\xBC\x9F";
}
break;
default:
switch( form ){
case 0000: return " ";
case 0011: return "-";
case 0022: return "=";
case 0101: return "+";
case 0102: return "+";
case 0110: return "+";
case 0111: return "+";
case 0120: return "+";
case 0122: return "+";
case 0201: return "+";
case 0202: return "+";
case 0210: return "+";
case 0211: return "+";
case 0220: return "+";
case 0222: return "+";
case 1001: return "+";
case 1002: return "+";
case 1010: return "+";
case 1011: return "+";
case 1020: return "+";
case 1022: return "+";
case 1100: return "|";
case 1101: return "+";
case 1102: return "+";
case 1110: return "+";
case 1111: return "+";
case 1120: return "+";
case 1122: return "+";
case 2001: return "+";
case 2002: return "+";
case 2010: return "+";
case 2011: return "+";
case 2020: return "+";
case 2022: return "+";
case 2200: return "|";
case 2201: return "+";
case 2202: return "+";
case 2210: return "+";
case 2211: return "+";
case 2220: return "+";
case 2222: return "+";
default:   return "?";
}
break;
}
return "";
}
#endif
/* EOF */

and here's the command for the user to set their encoding method (so if you do box( 1111, this_player()->GetProperty( "Encoding" ) ) it'll automagically switch what they get)

Code: [Select]
/*  /cmds/players/encoding.c
 *  allows a person to set their character encoding
 *  by T. Cook
 *  2011-Aug-16
 */

#include <lib.h>

inherit LIB_DAEMON;

mixed cmd( string arg ){
if( !arg || arg == "" ){
if( !this_player()->GetProperty( "Encoding" ) ){
this_player()->SetProperty( "Encoding", "Latin-1" );
}
return "Encoding is currently set to " + this_player()->GetProperty( "Encoding" );
}
switch( lower_case( arg ) ){
//case "utf-8": case "utf8": case "unicode": arg = "UTF-8"; break;
case "oem": arg = "OEM"; break;
default: arg = "Latin-1"; break;
}
message(
"system",
"Encoding set to " + this_player()->SetProperty( "Encoding", arg ) + ".",
this_player()
);
    return 1;
}

string GetHelp(){
return (
"Syntax:  '%^B_WHITE%^%^BLACK%^encoding %^MAGENTA%^<encoding type>%^RESET%^'\n\n"
"Allows you to set your character encoding to display "
"extended characters.  Defaults to 'Latin-1'.  Also "
"available is 'OEM', usable with Terminal font in Windows.\n"
"See also:  env"
);
}