- Home /
Build a console similar to minecraft
So this will come off as a little weird, but bare with me. There are probably many other games like this but Minecraft is the one that pops into my head.
So in minecraft, when you press "/", a command line comes up. You can then type in commands.
But if you do "/kill Username", it will make no difference from "/kill Username"
I basically want to write a console with commands and it won't matter how many spaces someone puts or anything like that.
That's known as a Parser. They can be a bit tricky to write, but you can probably look elsewhere to get a crude one (just command and direct object.) A really crude one can be made with simple string functions.
Also, I wouldn't say anything normally, but it stopped me on that sentence -- it's BEAR with me. It's the same root word as "get your bearings."
Lol thanks. What should I search though to find exactly what i mean
Depending on how complex you want your command system, you could create a lexical analysis class https://en.m.wikipedia.org/wiki/Lexical_analysis. Alternatively, if you don't want many commands, just check for the word and execute the task individually.
Answer by SunnyChow · Mar 06, 2016 at 04:50 AM
Maybe you can search about Regular Expression. It can help you to recognizes the command that user inputed, and seperated the input values
Your answer
![](https://koobas.hobune.stream/wayback/20220612070634im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
EventTrigger PointerEnter 1 Answer
Unity5 filled my SSD? 0 Answers
Generate floor mesh according to walls 0 Answers