Page 1 of 1

'command' variable doesn't seem right in the SayCommand listener

Posted: Sun Jan 25, 2015 2:10 pm
by BackRaw
Hi,

I have the following code:

Syntax: Select all

from commands.say import SayCommand

from players.helpers import index_from_playerinfo

from messages import SayText2


@SayCommand("flashtop")
def saycommand_flashtop(playerinfo, teamonly, command):
"""
Gets called whenever a player types 'flashtop' in the chat.
"""

SayText2(message="command: {0}, {1}".format(command[0], command[1]).send(index_from_playerinfo(playerinfo))
The output is

Code: Select all

flashtop 4
=> say, flashtop 4
Was this intended or is there something wrong? lol

Posted: Sun Jan 25, 2015 3:23 pm
by satoon101
Technically this is 100% correct. 'say' is a server command and it gets passed along with the Command instance that we pass. We 'might' look to change it in the future to not pass the actual command, since we pass the teamonly value (which is determined by whether 'say' or 'say_team' is used).

For reference:
https://github.com/Source-Python-Dev-Team/Source.Python/blob/master/src/core/modules/commands/say_commands_wrap.cpp#L69

Posted: Sun Jan 25, 2015 4:07 pm
by BackRaw
satoon101 wrote:Technically this is 100% correct. 'say' is a server command and it gets passed along with the Command instance that we pass. We 'might' look to change it in the future to not pass the actual command, since we pass the teamonly value (which is determined by whether 'say' or 'say_team' is used).

For reference:
https://github.com/Source-Python-Dev-Team/Source.Python/blob/master/src/core/modules/commands/say_commands_wrap.cpp#L69


Makes sense. I'm fine with it :)