VoidExpanse/scope-topic: Difference between revisions
(Created page with "<noinclude> Category:VoidExpanse/api_scopes </noinclude> = Scope topic = Topic scope is used only inside topic scripts. Controls dialogs and quests. '''Visibility:''' In...") |
No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 9: | Line 9: | ||
== List of functions == | == List of functions == | ||
{{Scripting_api|AddChoice| | {{Scripting_api|AddChoice| | ||
Line 23: | Line 14: | ||
* string: choice_localisation_id | * string: choice_localisation_id | ||
* string: choice_text | * string: choice_text | ||
* object: parameters | | * ''(optional) object: parameters''| | ||
void| | void| | ||
<pre style="margin:0px;">topic.AddChoice(1, "c001", "I'd like to pass this %one%, please.", {one: "hamburger"});</pre> | | <pre style="margin:0px;">topic.AddChoice(1, "c001", "I'd like to pass this one, please."); | ||
topic.AddChoice(1, "c001", "I'd like to pass this %one%, please.", {one: "hamburger"});</pre> | | |||
Adds a choice to dialog. | Adds a choice to dialog. | ||
}} | }} | ||
Line 40: | Line 24: | ||
* string: phrase_localisation_id | * string: phrase_localisation_id | ||
* string: phrase_text | * string: phrase_text | ||
* object: arguments | | * object: arguments| | ||
void| | void| | ||
<pre style="margin:0px;">topic.AddPhrase("p001", "Hello, i'm %npc_name%!", {npc_name: "Scott"});</pre> | | <pre style="margin:0px;">topic.AddPhrase("p001", "Hello, i'm npc!"); | ||
topic.AddPhrase("p001", "Hello, i'm %npc_name%!", | |||
{npc_name: "Scott"});</pre> | | |||
Adds an npc phrase to dialog. | Adds an npc phrase to dialog. | ||
}} | }} | ||
Line 52: | Line 38: | ||
<pre style="margin:0px;">topic.AddTopic("topic_id_01");</pre> | | <pre style="margin:0px;">topic.AddTopic("topic_id_01");</pre> | | ||
Adds specified topic to player's available topics. | Adds specified topic to player's available topics. | ||
}} | |||
{{Scripting_api|RefreshTopics| | |||
void| | |||
void| | |||
<pre style="margin:0px;">topic.RefreshTopics();</pre> | | |||
List of topics on client is loaded once per conversation. If new topic was added, or the old one removed, this list will be reloaded. But what if state of topic was changed, and current npc shouldn't have it now, but there's such topic in player's list because it was already loaded? | |||
RefreshTopics reloads current list of topics, testing all of them with CheckRequiments and actualize topic list. | |||
Can come in handly when single topic manages dialogs with multiple characters in sequence. | |||
}} | }} | ||
Line 120: | Line 116: | ||
<pre style="margin:0px;">var bInputExists = topic.InputExists();</pre> | | <pre style="margin:0px;">var bInputExists = topic.InputExists();</pre> | | ||
}} | }} | ||
{{Scripting_api|QuestAddLog| | {{Scripting_api|QuestAddLog| | ||
Line 134: | Line 121: | ||
* string: entry_id | * string: entry_id | ||
* string: quest_text | * string: quest_text | ||
* object: args| | * ''(optional) object: args''| | ||
void| | void| | ||
<pre style="margin:0px;">topic.QuestAddLog("some_quest", "e001", "I just got this %whaat% into quest log.", {whaat: "hamburger"});</pre> | | <pre style="margin:0px;">topic.QuestAddLog("some_quest", "e001", "I just got this quest into quest log."); | ||
topic.QuestAddLog("some_quest", "e001", "I just got this %whaat% into quest log.", | |||
{whaat: "hamburger"});</pre> | | |||
}} | }} | ||
Line 178: | Line 167: | ||
Removes all markers of quest. | Removes all markers of quest. | ||
}} | }} | ||
{{Scripting_api|QuestRemoveLocalMarkers| | |||
* string: quest_id| | |||
void| | |||
<pre style="margin:0px;">topic.QuestRemoveLocalMarkers("some_quest");</pre> | | |||
Removes all local markers of a quest (object, coordinate). All Galaxy markers persist. | |||
}} | |||
{{Scripting_api|QuestStart| | {{Scripting_api|QuestStart| |
Latest revision as of 09:08, 10 April 2014
Scope topic
Topic scope is used only inside topic scripts. Controls dialogs and quests.
Visibility: In topics only.
List of functions
AddChoice | ||
---|---|---|
Arguments | Returns | Example |
|
void |
topic.AddChoice(1, "c001", "I'd like to pass this one, please."); topic.AddChoice(1, "c001", "I'd like to pass this %one%, please.", {one: "hamburger"}); |
Description | ||
Adds a choice to dialog. |
AddPhrase | ||
---|---|---|
Arguments | Returns | Example |
|
void |
topic.AddPhrase("p001", "Hello, i'm npc!"); topic.AddPhrase("p001", "Hello, i'm %npc_name%!", {npc_name: "Scott"}); |
Description | ||
Adds an npc phrase to dialog. |
AddTopic | ||
---|---|---|
Arguments | Returns | Example |
|
void |
topic.AddTopic("topic_id_01"); |
Description | ||
Adds specified topic to player's available topics. |
RefreshTopics | ||
---|---|---|
Arguments | Returns | Example |
void |
void |
topic.RefreshTopics(); |
Description | ||
List of topics on client is loaded once per conversation. If new topic was added, or the old one removed, this list will be reloaded. But what if state of topic was changed, and current npc shouldn't have it now, but there's such topic in player's list because it was already loaded? RefreshTopics reloads current list of topics, testing all of them with CheckRequiments and actualize topic list. Can come in handly when single topic manages dialogs with multiple characters in sequence. |
HasTopic | ||
---|---|---|
Arguments | Returns | Example |
|
bool: returns whether player already has this topic or not |
var bHasTopic = topic.HasTopic("topic_id_01"); |
Description | ||
HasQuest | ||
---|---|---|
Arguments | Returns | Example |
|
bool: returns whether player already has this quest or not |
var bHasQuest = topic.HasQuest("quest_id_01"); |
Description | ||
Bind | ||
---|---|---|
Arguments | Returns | Example |
|
void |
topic.Bind("someTrigger", "OnSomeTrigger", { npc_id: "errors" }); |
Description | ||
Binds function to a trigger. |
DialogueBreak | ||
---|---|---|
Arguments | Returns | Example |
void |
void |
topic.DialogueBreak(); |
Description | ||
Immediately breaks current dialogue. |
GetCurrentNpcId | ||
---|---|---|
Arguments | Returns | Example |
void |
string: current npc id (name) |
var npc_id = topic.GetCurrentNpcId(); |
Description | ||
GetCurrentNpcShipId | ||
---|---|---|
Arguments | Returns | Example |
void |
int: current npc's ship id |
var npc_ship_id = topic.GetCurrentNpcShipId(); |
Description | ||
GetCurrentShipId | ||
---|---|---|
Arguments | Returns | Example |
void |
int: current player ship's ID |
var player_ship_id = topic.GetCurrentShipId(); |
Description | ||
Has a global alias - PLAYER_SHIP. It's better to use alias - faster. |
GetInput | ||
---|---|---|
Arguments | Returns | Example |
void |
int: player's choice id |
var input = topic.GetInput(); |
Description | ||
GetState | ||
---|---|---|
Arguments | Returns | Example |
void |
int: topic state |
var state = topic.GetState(); |
Description | ||
Returns current topic state - integer value. Usually state means current progress in questline, but it can be used any way possible. |
InputExists | ||
---|---|---|
Arguments | Returns | Example |
void |
bool: returns whether player choose something or not |
var bInputExists = topic.InputExists(); |
Description | ||
QuestAddLog | ||
---|---|---|
Arguments | Returns | Example |
|
void |
topic.QuestAddLog("some_quest", "e001", "I just got this quest into quest log."); topic.QuestAddLog("some_quest", "e001", "I just got this %whaat% into quest log.", {whaat: "hamburger"}); |
Description | ||
QuestAddMark | ||
---|---|---|
Arguments | Returns | Example |
|
void |
topic.QuestAddMark("some_quest", 1); |
Description | ||
Adds questmark, that'll be visible on a galaxy map. |
QuestClearLog | ||
---|---|---|
Arguments | Returns | Example |
|
void |
topic.QuestClearLog("some_quest"); |
Description | ||
Clears log of specified quest. |
QuestSetState | ||
---|---|---|
Arguments | Returns | Example |
|
void |
topic.QuestSetState("some_quest", QuestStatus.Finished); |
Description | ||
Sets state of quest. State can be QuestStatus.Active (0), QuestStatus.Finished (1), QuestStatus.Failed (2). All this constants are defined in any topic. You can use either them, or just numbers - 0,1,2. Status affects in which tab quest displays. |
QuestRemove | ||
---|---|---|
Arguments | Returns | Example |
|
void |
topic.QuestRemove("some_quest"); |
Description | ||
Removes quest completely - after that it won't appear in any tab. |
QuestRemoveMarkers | ||
---|---|---|
Arguments | Returns | Example |
|
void |
topic.QuestRemoveMarkers("some_quest"); |
Description | ||
Removes all markers of quest. |
QuestRemoveLocalMarkers | ||
---|---|---|
Arguments | Returns | Example |
|
void |
topic.QuestRemoveLocalMarkers("some_quest"); |
Description | ||
Removes all local markers of a quest (object, coordinate). All Galaxy markers persist. |
QuestStart | ||
---|---|---|
Arguments | Returns | Example |
|
void |
topic.QuestStart("some_quest", "Rats in the cellar"); |
Description | ||
Stars quest. After that it will appear in journal, and log messages and markers can be added to it. |
RemoveTopic | ||
---|---|---|
Arguments | Returns | Example |
|
void |
topic.RemoveTopic("topic_id"); |
Description | ||
Removes topic completely. |
SetState | ||
---|---|---|
Arguments | Returns | Example |
|
void |
topic.SetState(200); |
Description | ||
Changes state of current topic. |
Unbind | ||
---|---|---|
Arguments | Returns | Example |
|
void |
topic.Unbind("someTrigger", "OnSomeTrigger"); |
Description | ||
Unbinds function from a trigger. |