From 426aa514fffd879e6b81f75fec22901aaf111e89 Mon Sep 17 00:00:00 2001 From: Darkvater Date: Sat, 28 May 2005 16:59:51 +0000 Subject: [PATCH] (svn r2372) - Fix (console): update the example scripts in the scripts/ directory to reflect the new console functionality - Fix (console): any line starting with a '#' is a comment so ignore it - Fix (console): The special variables whose value can only be set by a custom process should, also print out their newly set value there, instead of relying on the default printout which is slightly confusing. Eg after you change the value it still printed out 'current value for...' instead of 'XXX changed to...' --- console.c | 9 ++++++++- console_cmds.c | 3 +++ scripts/autoexec.scr.example | 4 +--- scripts/on_client.scr.example | 2 +- scripts/on_dedicated.scr.example | 5 +++-- scripts/pre_dedicated.scr.example | 5 +++-- scripts/pre_server.scr.example | 3 ++- 7 files changed, 21 insertions(+), 10 deletions(-) diff --git a/console.c b/console.c index 95730c68e9..cccba3bebd 100644 --- a/console.c +++ b/console.c @@ -691,6 +691,9 @@ void IConsoleAliasExec(const IConsoleAlias *alias, byte tokencount, char *tokens memset(&aliases, 0, sizeof(aliases)); memset(&aliasstream, 0, sizeof(aliasstream)); + if (_stdlib_con_developer) + IConsolePrintF(_icolour_dbg, "condbg: requested command is an alias; parsing..."); + aliases[0] = aliasstream; for (cmdptr = alias->cmdline, a_index = 0, astream_i = 0; *cmdptr != '\0'; cmdptr++) { if (a_index >= lengthof(aliases) || astream_i >= lengthof(aliasstream)) break; @@ -964,6 +967,9 @@ void IConsoleVarExec(const IConsoleVar *var, byte tokencount, char *token[ICON_T byte t_index = tokencount; uint32 value; + if (_stdlib_con_developer) + IConsolePrintF(_icolour_dbg, "condbg: requested command is a variable"); + if (tokencount == 0) { /* Just print out value */ IConsoleVarPrintGetValue(var); return; @@ -976,7 +982,6 @@ void IConsoleVarExec(const IConsoleVar *var, byte tokencount, char *token[ICON_T /* Some variables need really special handling, handle it in their callback procedure */ if (var->proc != NULL) { var->proc(tokencount, &token[t_index - tokencount]); // set the new value - var->proc(0, NULL); // print out new value return; } /* Strings need special processing. No need to convert the argument to @@ -1035,6 +1040,8 @@ void IConsoleCmdExec(const char *cmdstr) bool longtoken = false; bool foundtoken = false; + if (cmdstr[0] == '#') return; // comments + for (cmdptr = cmdstr; *cmdptr != '\0'; cmdptr++) { if (!IsValidAsciiChar(*cmdptr)) { IConsoleError("command contains malformed characters, aborting"); diff --git a/console_cmds.c b/console_cmds.c index fb68c01b5d..27f7a52106 100644 --- a/console_cmds.c +++ b/console_cmds.c @@ -1086,6 +1086,8 @@ bool NetworkChangeCompanyPassword(byte argc, char *argv[]) if (!_network_server) SEND_COMMAND(PACKET_CLIENT_SET_PASSWORD)(_network_player_info[_local_player].password); + IConsolePrintF(_icolour_warn, "'company_pw' changed to: %s", _network_player_info[_local_player].password); + return true; } @@ -1136,6 +1138,7 @@ DEF_CONSOLE_CMD(ConProcServerIP) _network_server_bind_ip = inet_addr(argv[0]); snprintf(_network_server_bind_ip_host, sizeof(_network_server_bind_ip_host), "%s", inet_ntoa(*(struct in_addr *)&_network_server_bind_ip)); + IConsolePrintF(_icolour_warn, "'server_ip' changed to: %s", inet_ntoa(*(struct in_addr *)&_network_server_bind_ip)); return true; } diff --git a/scripts/autoexec.scr.example b/scripts/autoexec.scr.example index 3057ea971d..af1b66d213 100644 --- a/scripts/autoexec.scr.example +++ b/scripts/autoexec.scr.example @@ -1,6 +1,4 @@ -# # send chat messages from the console with -# # ] s i love this chat # -alias "s" "say %!" \ No newline at end of file +alias s "say %!" \ No newline at end of file diff --git a/scripts/on_client.scr.example b/scripts/on_client.scr.example index 53db9b9c20..5bbd760492 100644 --- a/scripts/on_client.scr.example +++ b/scripts/on_client.scr.example @@ -1,2 +1,2 @@ echo "Setting default network client settings..." -set name "myname" +name = "myname" diff --git a/scripts/on_dedicated.scr.example b/scripts/on_dedicated.scr.example index 53cee5a63d..5465cd7978 100644 --- a/scripts/on_dedicated.scr.example +++ b/scripts/on_dedicated.scr.example @@ -1,3 +1,4 @@ echo "Setting dedicated network server settings..." -set server_pw "*" -set server_name "My example dedicated gameserver" +# empty the server password +server_pw = "*" +server_name = "My example dedicated gameserver" diff --git a/scripts/pre_dedicated.scr.example b/scripts/pre_dedicated.scr.example index c4a9e2e8fa..f915ba2b78 100644 --- a/scripts/pre_dedicated.scr.example +++ b/scripts/pre_dedicated.scr.example @@ -1,2 +1,3 @@ -set server_ip 0.0.0.0 -set server_port 3979 +# set default server port, and have the dedicated server listen on all ports +server_ip = 0.0.0.0 +server_port = 3979 diff --git a/scripts/pre_server.scr.example b/scripts/pre_server.scr.example index 25e8756f20..c1b6c822c5 100644 --- a/scripts/pre_server.scr.example +++ b/scripts/pre_server.scr.example @@ -1 +1,2 @@ -set server_port 3979 +# set the server port to the default value +server_port = 3979