TCommand
| [Previous] [Main] [Next] |
· | By modifying CommandTopic so that it can optionally match the direct and/or indirect object of the command, as well as the action commanded.
|
· | By adding two new methods to CommandTopic to facilitate the handling of commands.
|
· | By adding the obeyCommand property to CommandTopic to indicate whether or not the NPC should obey the command.
|
· | By modifying ActorState.obeyCommand to work better with CommandTopic and multiple direct objects.
|
· | By adding a new CommandHelper convenience mix-in class, and defining TCommandTopic, DefaultTCommandTopic and AltTCommandTopic to make use of it.
|
· | By modifying DefaultCommandTopic to work the same way as CommandTopic
|
· | By adding an AltCommandTopic class
|
· | By adding a SuggestedCommandTopic class
|
· | handleAction(fromActor, action) - This method is called before topicResponse, and contains any handling of the action you wish. Its main purpose is to provide a hook for CommandHelper to use, but it can also be used for your own handling.
|
· | actionResponse(fromActor, action) - this is called after topicResponse, and is basically intended as an alternative to topicResponse when the response needs access to the action that's being commanded.
|
· | obeyCommand - if this is set to true, then ActorState.obeyCommand will return true to allow the target actor to obey the command just as it was given.
|
· | matchDobj - the direct object, class of direct object (e.g. Food, Wearable), or list of direct objects/classes that you want this CommandTopic to match. If this is left at nil it will simply be ignored.
|
· | matchIobj - the indirect object, class of indirect object (e.g. Container, Surface), or list of indirect objects/classes that you want this CommandTopic to match. If this is left at nil it will simply be ignored.
|
· | cmdDobj - the current direct object of the command that the CommandTopic matched on this occasion. For example,. if matchDobj is the list [brassCoin, goldCoin, silverCoin], and matchObj (which matches the action on a CommandTopic or TCommandTopic) is TakeAction, then if the TCommandTopic is responding to "bob, take silver coin", cmdDobj will be silverCoin.
|
· | cmdIobj - the current indirect object, if there is one. E.g. if the CommandTopic matched the command "Bob, put the coin in the slot", this will contain the slot object.
|
· | cmdAction - the current action that's being command. This simply makes it available to methods like topicResponse which otherwise wouldn't have access to it.
|
· | cmdTopic - if the action commanded is a TopicActionBase or subclass thereof (e.g. Bob, ask Fred about boots) then this holds the topic associated with the command (in this example, the 'boots' topic).
|
· | cmdPhrase - this is simply cmdAction.getInfinitivePhrase, e.g. if the command was "Bob, put the red book on the shelf" it will contain something like "put the red book on the shelf." This can be useful when the CommandTopic may have matched a number of different commands and we want to construct a sentence containing the command in topicResponse, e.g. "<q>Bob, <<cmdPhrase>>, will you?</q>". Note you might sometimes want the participle phrase, which you can get, for example, with "<q>Bob, would you mind terribly <<cmdAction.getParticiplePhrase>>?</q>", which might come out as "Bob, you mind terribly putting the red book on the shelf."
|
· | topicCmdPhrase() - this is a method that returns the command phrase (e.g. "ask Bob about boots") associated with a command to perform a TopicAction (e.g. "fred, ask bob about boots."). It it called by cmdPhrase when necessary, and was added to circumvent a run-time error that would otherwise occur. You probably won't need to use this method - you can just use cmdPhrase.
|
· | autoBlockSystemCommands - if true (the default) then any attempt to direct a system command to this actor when he's in this ActorState (e.g. Bob, Restore) will automatically be blocked, and the explainBlockSystemCommand() method called to explain why.
|
· | autoBlockTopicCommands - if true (the default) then any attempt to ask the actor who's in this ActorState to perform a conversational command (e.g. Bob, Ask Sally about lighthouse) will automatically be blocked, and the explainBlockTopicCommand() method called to explain why.
|