VoidExpanse/scope-topic: Difference between revisions

From AtomicTorchWiki
(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
Line 9: Line 9:


== List of functions ==
== List of functions ==
{{Scripting_api|AddChoice|
* int: choice_id
* string: choice_localisation_id
* string: choice_text|
void|
<pre style="margin:0px;">topic.AddChoice(1, "c001", "I'd like to pass this one, please.");</pre> |
Adds a choice to dialog.
}}


{{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.
}}
{{Scripting_api|AddPhrase|
* string: phrase_localisation_id
* string: phrase_text|
void|
<pre style="margin:0px;">topic.AddPhrase("p001", "Hello, i'm npc!");</pre> |
Adds an npc phrase 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.
}}
}}

Revision as of 06:39, 14 February 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
  • int: choice_id
  • string: choice_localisation_id
  • string: choice_text
  • (optional) object: parameters

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
  • string: phrase_localisation_id
  • string: phrase_text
  • object: arguments

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
  • string: topic_id

void

topic.AddTopic("topic_id_01");
Description

Adds specified topic to player's available topics.


HasTopic
Arguments Returns Example
  • string: topic_id

bool: returns whether player already has this topic or not

var bHasTopic = topic.HasTopic("topic_id_01");
Description


HasQuest
Arguments Returns Example
  • string: quest_id

bool: returns whether player already has this quest or not

var bHasQuest = topic.HasQuest("quest_id_01");
Description


Bind
Arguments Returns Example
  • string: trigger_name
  • string: function_name
  • object: parametes

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
  • string: quest_id
  • string: entry_id
  • string: quest_text

void

topic.QuestAddLog("some_quest", "e001", "I just got this quest into quest log.");
Description


QuestAddLog
Arguments Returns Example
  • string: quest_id
  • string: entry_id
  • string: quest_text
  • object: args

void

topic.QuestAddLog("some_quest", "e001", "I just got this %whaat% into quest log.", {whaat: "hamburger"});
Description


QuestAddMark
Arguments Returns Example
  • string: quest_id
  • int: system_id

void

topic.QuestAddMark("some_quest", 1);
Description

Adds questmark, that'll be visible on a galaxy map.


QuestClearLog
Arguments Returns Example
  • string: quest_id

void

topic.QuestClearLog("some_quest");
Description

Clears log of specified quest.


QuestSetState
Arguments Returns Example
  • string: quest_id
  • int: state

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
  • string: quest_id

void

topic.QuestRemove("some_quest");
Description

Removes quest completely - after that it won't appear in any tab.


QuestRemoveMarkers
Arguments Returns Example
  • string: quest_id

void

topic.QuestRemoveMarkers("some_quest");
Description

Removes all markers of quest.


QuestStart
Arguments Returns Example
  • string: quest_id
  • string: quest_title

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
  • string: topic_id

void

topic.RemoveTopic("topic_id");
Description

Removes topic completely.


SetState
Arguments Returns Example
  • int: state_value

void

topic.SetState(200);
Description

Changes state of current topic.


Unbind
Arguments Returns Example
  • string: trigger_name
  • string: function_name

void

topic.Unbind("someTrigger", "OnSomeTrigger");
Description

Unbinds function from a trigger.