Skip to content

added (console-)command usage - #389

Merged
H-M-H merged 4 commits into
ddnet:masterfrom
H-M-H:command_usage
Jan 3, 2016
Merged

H-M-H merged 4 commits into
ddnet:masterfrom
H-M-H:command_usage

Conversation

@H-M-H

@H-M-H H-M-H commented Dec 23, 2015

Copy link
Copy Markdown
Member

would fix #387
However, I am not exactly satisfied with this as servers can not send the usage to clients properly. At the moment servers just concat params and usage and sent it to client, which causes that old clients can not display the whole text as their buffer is too small.

@H-M-H H-M-H added enhancement Provides an enhancement to the game. network Network related. server Related to the server-side. client Related to the client-side. incomplete More information needs to be provided for this issue. labels Dec 23, 2015
@def-

def- commented Dec 23, 2015

Copy link
Copy Markdown
Member

Now you have duplicate information, ?s and [file]. Alternatively the parser could be changed to parse [file] but that might be too much work.

@heinrich5991

Copy link
Copy Markdown
Member

This kinda duplicates work of #388.

@H-M-H

H-M-H commented Dec 23, 2015

Copy link
Copy Markdown
Member Author

Well it was already done when #388 appeared.

@def- like this we would loose typeinformation.

@Henningstone

Copy link
Copy Markdown
Contributor

Also, #388 obviously won't work.

@laxa

laxa commented Dec 23, 2015

Copy link
Copy Markdown
Contributor

I guess the best option would be to rework all the "Help" argument inside the Console()->Register.
Sadly, we can't always have a solution that will fit all cases. Client needs to be updated once in a while.

@laxa

laxa commented Dec 23, 2015

Copy link
Copy Markdown
Contributor

Another idea : modify the parser to have a comment char like ?s#[File]

the commandparamsstring: "s[file]"
@H-M-H

H-M-H commented Dec 28, 2015

Copy link
Copy Markdown
Member Author

@def- @laxa I liked you idea the new format is now: parametertype + description in brackets.
Example: "i[some number] s[a string] ?i[optional number]"

Edit: the only problem left is that old clients do not have enough space in their buffer to display the whole parameterstring in remote-console but I guess this problem is neglectable.

@H-M-H H-M-H removed incomplete More information needs to be provided for this issue. network Network related. labels Dec 30, 2015
@H-M-H

H-M-H commented Jan 3, 2016

Copy link
Copy Markdown
Member Author

Okay, no complaints so far, my locals tests were fine so I will merge this.

H-M-H added a commit that referenced this pull request Jan 3, 2016
added (console-)command usage fixes #387
@H-M-H
H-M-H merged commit e41b4f4 into ddnet:master Jan 3, 2016
@heinrich5991

Copy link
Copy Markdown
Member

If you're asking for complaints, this is what I thought when reading the code:

  1. Why stuff the extra information into the format string for the parameters instead of making a second parameter that contains a space (or whatever)-separated list of parameter names?
  2. This is as you said not really backward-compatible, but it wouldn't be hard with 1).

@H-M-H

H-M-H commented Jan 3, 2016

Copy link
Copy Markdown
Member Author

As you see I did it with a usage string first but as deen pointed out this is kinda redundant and adding this requires changes in networkcode. The problem is now that the server can send further information here:

CMsgPacker Msg(NETMSG_RCON_CMD_ADD);
Msg.AddString(pCommandInfo->m_pName, IConsole::TEMPCMD_NAME_LENGTH);
Msg.AddString(pCommandInfo->m_pHelp, IConsole::TEMPCMD_HELP_LENGTH);
Msg.AddString(pCommandInfo->m_pParams, IConsole::TEMPCMD_PARAMS_LENGTH);
SendMsgEx(&Msg, MSGFLAG_VITAL, ClientID, true);
but the new clients would not be able to process it as they do not know if the server already sends them:
else if((pPacket->m_Flags&NET_CHUNKFLAG_VITAL) != 0 && Msg == NETMSG_RCON_CMD_ADD)
{
const char *pName = Unpacker.GetString(CUnpacker::SANITIZE_CC);
const char *pHelp = Unpacker.GetString(CUnpacker::SANITIZE_CC);
const char *pParams = Unpacker.GetString(CUnpacker::SANITIZE_CC);
if(Unpacker.Error() == 0)
m_pConsole->RegisterTemp(pName, pParams, CFGFLAG_SERVER, pHelp);
}

edit: thanks for complaints btw :D

SollyBunny pushed a commit to SollyBunny/ddnet that referenced this pull request Oct 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client Related to the client-side. enhancement Provides an enhancement to the game. server Related to the server-side.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proper (for casuals) hints about commands

5 participants