8. Expressions and conditions
8.1 Evaluation
The evaluation uses the same grammar as the Condition nodes.
if (Dialogue.Evaluate("quest.rescue.state == active && !has_key"))
{
// ...
}
8.2 Supported grammar
| Supported | Not supported | ||
|---|---|---|---|
==, !=, <, <=, >, >= | arithmetic (a + 1) | ||
&&, `\ | \ | , !`, parentheses | function calls |
true/false literals, numbers, strings | access to C# objects | ||
dotted identifiers (quest.rescue.state) | eval of code |
8.3 Invalid expressions
Invalid expressions: log [324], result false.
9. Quests
9.1 Static facade
| Member | Description |
|---|---|
AcceptQuest(id) / CompleteQuest(id) / FailQuest(id) | changes state |
SetQuestStep(id, stepId, done = true) | marks an objective |
GetQuestState(id) | Unknown, Available, Active, Completed, Failed |
Syntax
AcceptQuest(id)
CompleteQuest(id)
FailQuest(id)
SetQuestStep(id, stepId, done = true)
GetQuestState(id)
Parameters
| Parameter | Description |
|---|---|
id | identifier of the quest |
stepId | identifier of the quest objective |
done | indicates the completion of the objective; the default value is true |
Return value
GetQuestState(id) returns one of the values Unknown, Available, Active, Completed, Failed.
Notes
AcceptQuest(id), CompleteQuest(id) and FailQuest(id) modify the quest state. SetQuestStep(id, stepId, done = true) marks an objective.
9.2 Custom quest service
Example
public class MyQuestService : IQuestService { }
Dialogue.Bridge.SetQuestService(new MyQuestService());
With a custom service, SaveNarrativeState() saves the variables only: the persistence of quests remains in the application system.