

Terminal Api provides a nice a easy way to add and modify terminal keywords. It allows you to create and add them whenever you want in your code as it will automatically add the keywords when it is safe to do so.
To create a terminal keyword, you can use the CreateTerminalKeyword method.
There are two overloaded methods available:
CreateTerminalKeyword(string word, bool isVerb = false, TerminalNode triggeringNode = null)CreateTerminalKeyword(string word, string displayText, bool clearPreviousText = false, string terminalEvent = "")Example:
TerminalKeyword keyword = TerminalApi.CreateTerminalKeyword("die", "No don't");
If you don't know what terminal nodes are, they essential hold information that the terminal uses when the keyword associated with the node is sent. For most cases, when a word is sent, it will display the nodes displayText. You can create a node by using the CreateTerminalNode method.
[!NOTE] You can pretty much ignore the terminalEvent parameter. Unless you know what you're doing.
There is one method available:
CreateTerminalNode(string displayText, bool clearPreviousText = false, string terminalEvent = "")Example:
TerminalNode node = TerminalApi.CreateTerminalNode("Hello world");
Once you have your keyword ready to add you can use the AddTerminalKeyword to add the keyword.
There is one method available:
AddTerminalKeyword(TerminalKeyword terminalKeyword)Example:
TerminalApi.AddTerminalKeyword(keyword);
Use UpdateKeyword to update any keyword that already exists.
There is one method available:
UpdateKeyword(TerminalKeyword terminalKeyword)Example:
TerminalApi.UpdateKeyword(keyword);
Use GetKeyword to get an already existing keyword.
This uses the keyword's word to find it.
There is one method available:
GetKeyword(string keyword)Example:
TerminalKeyword gottenKeyword = TerminalApi.GetKeyword("die");
[!IMPORTANT] If you use compatible nouns, make sure that verb keyword and noun keywords are added to the terminal!
Every keyword has a field for an array of CompatibleNoun, not all keywords use it though. Only keywords marked as verbs use it.
It allows for verb-noun combos like check fish. The verb being check and the noun being fish.
In TerminalApi there is an exstension method that allows you to quickly add a CompatibleNoun to your verb keyword.
There are three of these overloaded methods:
AddCompatibleNoun(this TerminalKeyword terminalKeyword, TerminalKeyword noun, TerminalNode result)AddCompatibleNoun(this TerminalKeyword terminalKeyword, string noun, TerminalNode result)AddCompatibleNoun(this TerminalKeyword terminalKeyword, string noun, string displayText)AddCompatibleNoun(this TerminalKeyword terminalKeyword, TerminalKeyword noun, string displayText, bool clearPreviousText = false)Here is an example:
TerminalKeyword verbKeyword = TerminalApi.CreateTerminalKeyword("check", true);
TerminalKeyword nounKeyword = TerminalApi.CreateTerminalKeyword("fish");
TerminalNode triggerNode = TerminalApi.CreateTerminalNode("There are no fish\n", true);
verbKeyword = verbKeyword.AddcompatibleNoun(nounKeyword, triggerNode);
TerminalApi.AddTerminalKeyword(verbKeyword);
TerminalApi.AddTerminalKeyword(nounKeyword);
In the example above, if you were to type check fish into the terminal you would get There are no fish\n.
Use AddCompatibleNoun method to add a CompatibleNoun to an existing keyword.
The Noun should also already exist.
There are four overloaded methods:
AddCompatibleNoun(TerminalKeyword verbKeyword, string noun, string displayText, bool clearPreviousText = false)AddCompatibleNoun(TerminalKeyword verbKeyword, string noun, TerminalNode triggerNode)AddCompatibleNoun(string verbWord, string noun, TerminalNode triggerNode)AddCompatibleNoun(string verbWord, string noun, string displayText, bool clearPreviousText = false)Example:
TerminalApi.AddCompatibleNoun("check", "die", "You are not dead.");
The above code would add the existing die noun to check and when check die is typed into the terminal You are not dead. would display.
Use UpdateKeywordCompatibleNoun method to update an existing compatible noun on a verb keyword.
There is four method:
UpdateKeywordCompatibleNoun(TerminalKeyword verbKeyword, string noun, TerminalNode newTriggerNode)UpdateKeywordCompatibleNoun(string verbWord, string noun, TerminalNode newTriggerNode)UpdateKeywordCompatibleNoun(TerminalKeyword verbKeyword, string noun, string newDisplayText)UpdateKeywordCompatibleNoun(string verbWord, string noun, string newDisplayText)Example:
TerminalApi.UpdateKeywordCompatibleNoun("check", "fish", "There are 100 fish.")
With the above code check fish you should get There are 100 fish. in the terminal.