Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Parse ¶
Parse initiates processing of the input string for the specified Thing. The input string is expected to be input from a player.
Parse runs with state.scripting set to false, disallowing scripting specific commands from being executed by players directly.
When sync handles a command the command may determine it needs to hold additional locks. In this case sync will return false and should be called again. This repeats until the list of locks are acquired, the command processed and sync returns true.
Types ¶
type Result ¶ added in v0.0.13
Result is the result of a Match. If the match is successful then Thing will be the matched Thing and Unknown and NotEnough will both be empty strings. If the match fails Thing will be nil. If the match fails due to unknown words then Unknown will be set to the unknown words. If the match fails because there are not enough matching Thing to satisfy a limit then NotEnough will be set to the words matched.
func Match ¶ added in v0.0.13
Match takes a list of alias and qualifier words, and lists of Things and returns a subset of the Things that match the aliases and qualifiers as a list of Results. See the Result type for details. Match will also return any unprocessed words. The word list may contain special limit qualifiers such as ALL, 3, 2nd or 2-4. See the specialQualifier function for details.
For example, given the words: {"ALL", "SMALL", "BALL", "ALL", "GREEN", "BALL"}
Match processes the words in reverse order. In this case starting with the last word 'BALL'.
Match will try to identify Things in the list with an alias of 'BALL'.
If there are no matches a Result of 'unknown' will be returned.
If there are matches then the word 'BALL' will be consumed. The matches will then be reduced to those Things with a qualifier of 'GREEN' - which is now the last word in the list.
If the matches cannot be reduced the original matches will be used. If the matches are reduced the qualifier 'GREEN' will be consumed.
The matches will then be reduced by limits. The default limit is the first match. This may be changed by using a special qualifier such as ALL, 3, 2nd, etc. In this example we have 'ALL' so all of the current matches will be returned. If there are not enough remaining matches to satisfy the limits requested a result of 'not enough' will be returned. If a special qualifier is found it will be consumed and removed from the word list.
Assuming we have at least one Thing that matches our example the words 'BALL', 'GREEN' and 'ALL' will have been consumed. The remaing, unprocessed words in the word list will be returned.
The reaming words can then be used to a subsequent call to Match for further matching. See also MatchAll.
Notes ¶
Bugs ¶
Terminal with is hardcoded to be 80 characters wide
If you examine another player you can see their inventory items. For now we only describe the inventory if not examining a player.
It should be possible to put a GET Veto on a player. However due to the way GET applies Vetoes we can't yet.
Do not use tabs in this string!
If a container is not collectable then it and its content will not be saved - even if it contains collectable items.
We don't treat observer differently to observers - should we?
It's currently assumed the actor and participant are at the same location. This is important as s.were is not updated when roles are switched, swapping locations could have implications for the locks being held. More investigation and testing required.
Source Files ¶
- act.go
- action.go
- cleanup.go
- close.go
- cmd.go
- commands.go
- debug.go
- drop.go
- dump.go
- examine.go
- get.go
- handler.go
- hit.go
- hold.go
- inventory.go
- junk.go
- look.go
- matcher.go
- move.go
- open.go
- poof.go
- prompt.go
- put.go
- quit.go
- read.go
- remove.go
- reset.go
- save.go
- say.go
- shout.go
- sneeze.go
- state.go
- take.go
- tell.go
- version.go
- wear.go
- which.go
- whisper.go
- who.go
- wield.go