![]() |
PowerQuest 0.20.6
|
Parser: Contains functions for text parser commands. See Parser Scripting
if ( Parser.Said("Look at lamp") )
Display: It's a lamp
Properties | |
| bool | HasTarget [get] |
| Returns true if there was a "target" in the parsed text from the Said() function. | |
| IQuestClickable | Target [get] |
| Returns a "target" from the Said() function. | |
| string | Text [get] |
| Property to get the last text passed into the ParseText() function. | |
| bool | HasUnknownWord [get] |
| Returns true if the last parsed text had an unrecognised word. | |
| string | UnknownWord [get] |
| Returns any unrecognised word in the last parsed text. | |
| bool | HasWildcard [get] |
| Returns true if there's a wildcard word (*) in the parsed text. | |
| string | WildcardWord [get] |
| Returns what was matched as a wildcard word (*) in the parsed text. | |
Public Member Functions | |
| void | ParseText (string input, bool callOnParserScripts=true) |
| Triggers a parser command typed in by the player. Usually called from a gui, after they've typed in something and press Enter. | |
| void | RunParserScripts () |
| Initiates "OnParser" functions being called. Usually done automatically when ParseText() is called. | |
| bool | Said (string query) |
| Use this to check whether the player's input matches what you want. If it does, it returns true. For info see Parser Scripting | |
| bool | Said (string query, IQuestClickableInterface target) |
| Use this to check whether the player's input matches what you want, with a specified Quest Object. If it does, it returns true. For info see Parser Manual- Special Character, under Quest Objects. | |
| void | OnUnhandledEvent () |
| Call this if a line was not handled, it will copy the line to clipboard for pasting into your script if you want to add it, and save out a list of what people typed too. See Parser Manual- Unhandled input | |
|
get |
|
get |
Returns a "target" from the Said() function.
Eg.
if ( Parser.Said("Lift", H.Boulder) || Parser.Said("Lift", P.Elephant) )
{
Plr.Face( Parser.Target );
Dave: The {Parser.Target.Description} is too heavy.
}
|
get |
Property to get the last text passed into the ParseText() function.
|
get |
Returns true if the last parsed text had an unrecognised word.
eg.
if ( Parser.HasUnknownWord )
Display: You can't use the word {Parser.UnknownWord} here!
|
get |
Returns any unrecognised word in the last parsed text.
eg.
if ( Parser.HasUnknownWord )
Display: You can't use the word {Parser.UnknownWord} here!
|
get |
Returns true if there's a wildcard word (*) in the parsed text.
eg.
if ( Parser.HasWildcard )
Display: What on earth is a {Parser.WildcardWord}?
|
get |
Returns what was matched as a wildcard word (*) in the parsed text.
See Parser Manual- Special Characters
eg.
if ( Parser.Said("Sit on *") )
Display: You sit on the {Parser.WildcardWord}
| void ParseText | ( | string | input, |
| bool | callOnParserScripts = true ) |
Triggers a parser command typed in by the player. Usually called from a gui, after they've typed in something and press Enter.
By default RunParserScripts() is called automatically- which calls through to your OnParser commands. Pass "false" if you want to trigger this manually.
| void RunParserScripts | ( | ) |
Initiates "OnParser" functions being called. Usually done automatically when ParseText() is called.
| bool Said | ( | string | query | ) |
Use this to check whether the player's input matches what you want. If it does, it returns true. For info see Parser Scripting
Eg.
if ( Parser.Said("Say Hello") )
{
Dave: Hello!
}
else if ( Parser.Said("Talk Barney") )
{
Dave: Hi Barney.
Barney: Hi!
}
The parser template games have a bunch of shortcuts for using this- like: ~~ say hello~
| bool Said | ( | string | query, |
| IQuestClickableInterface | target ) |
Use this to check whether the player's input matches what you want, with a specified Quest Object. If it does, it returns true. For info see Parser Manual- Special Character, under Quest Objects.
Parser.Said("drink from", H.Well);WalkToClicked and FaceClicked will work.Parser.Target.Eg. if ( Parser.Said("drink from", H.Well) ) { Display: You take a drink from the well } else if ( Parser.Said("Talk"), C.Barney ) { Dave: Hi Barney. Barney: Hi! }
The parser template games have a bunch of shortcuts for using this- like: ~~ say hello~
| void OnUnhandledEvent | ( | ) |
Call this if a line was not handled, it will copy the line to clipboard for pasting into your script if you want to add it, and save out a list of what people typed too. See Parser Manual- Unhandled input