A group dedicated to indie and standalone game development.

Post news Report RSS Chat Commands

Hey guys, thought I would give a quick little update about what's happening in the development of Societatem right now. You can now write commands in chat!

Posted by on

Hey guys. Last night I made the in-game chat double as a command console. To type commands, just add a '/' as the first character in the chat. Currently, there are only 2 commands,

/kill [Player]

/kick [Player]
AdminKick

though more commands will be added for developers, like spawning vehicles and such. The current 2 commands can only be executed by a select number of developers, which at the moment is only me and Chris. More commands for everyone to use will be added soon.

//This is for coding nerds who wants to see how it works

That thing took a lot of splitting and grouping into lists xP. Basically, if it detects that the first char is a '/', it will run a CalculateCommand function. A string is passed into the function, and then it SubString() by 1 to remove the '/'. The resulting string is then Split() by ' ', which is passed into an array. A new string called "MasterCommand" is then set as the first index of this array, and then a new string array, which is the parameters, is set as the rest of the first array. (E.g. parameters[0] = firstArray[1]). Then I just check over the command and make sure it's a command, then checks the amount of parameters, and if everything matches, the command is successfully executed! xD

- William,
RedCrusaderGames

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: