PixelCrushers.DialogueSystem.DialogueLua Class Reference

A static class that adds additional Chat Mapper-related functionality to the Lua environment, since Chat Mapper projects can define conditions and actions in Lua, modify Lua variables, and use Chat Mapper-specific Lua functions. More...

Static Public Member Functions

static void RegisterLuaFunctions ()
 
static void InitializeChatMapperVariables ()
 Initializes the Chat Mapper tables.
 
static void AddChatMapperVariables (DialogueDatabase database, List< DialogueDatabase > loadedDatabases)
 Adds the assets defined in a DialogueDatabase to the Chat Mapper tables.
 
static void RemoveChatMapperVariables (DialogueDatabase database, List< DialogueDatabase > loadedDatabases)
 Removes the assets defined in a DialogueDatabase from the Chat Mapper tables.
 
static void SetParticipants (string actorName, string conversantName, string actorIndex=null, string conversantIndex=null)
 Sets the conversation participant name variables (Variable['Actor'] and Variable['Conversant']) and, optionally, participant indices in Actor table.
 
static string GetSimStatus (DialogueEntry dialogueEntry)
 Returns the SimStatus of a dialogue entry, or a blank string if Include Sim Status isn't ticked.
 
static string GetSimStatus (int conversationID, int entryID)
 Returns the SimStatus of a dialogue entry, or a blank string if Include Sim Status isn't ticked.
 
static void MarkDialogueEntryUntouched (DialogueEntry dialogueEntry)
 Marks a dialogue entry as untouched, by setting the Lua variable Conversation[#].Dialog[#].SimStatus="Untouched", where # is the conversation and/or dialogue entry ID.
 
static void MarkDialogueEntryDisplayed (DialogueEntry dialogueEntry)
 Marks a dialogue entry as displayed, by setting the Lua variable Conversation[#].Dialog[#].SimStatus="WasDisplayed", where # is the conversation and/or dialogue entry ID.
 
static void MarkDialogueEntryOffered (DialogueEntry dialogueEntry)
 Marks a dialogue entry as offered, by setting the Lua variable Conversation[#].Dialog[#].SimStatus="WasOffered" , where # is the conversation and/or dialogue entry ID.
 
static void MarkDialogueEntry (DialogueEntry dialogueEntry, string status)
 Marks a dialogue entry with a status such as "WasOffered".
 
static void AddToConversationTable (List< Conversation > conversations, List< DialogueDatabase > loadedDatabases, bool addRaw=false)
 
static LuaTable AddToConversationTable (LuaTable conversationTable, Conversation conversation, bool addRaw=false)
 
static LuaValue GetFieldLuaValue (Field field)
 
static string FieldValueAsString (Field field)
 Returns a field's value as a string for use in Lua.
 
static string ValueAsString (FieldType fieldType, string fieldValue)
 Returns a Chat Mapper value as a string for use in Lua.
 
static string RandomElement (string list)
 Returns a random element in a list.
 
static string GetLocalizedText (string tableName, string elementName, string fieldName)
 Gets the localized text for a field in a table element.
 
static string GetStatus (LuaTable asset1, LuaTable asset2)
 Chat Mapper function.
 
static void SetStatus (LuaTable asset1, LuaTable asset2, string statusValue)
 Chat Mapper function.
 
static float GetRelationship (LuaTable actor1, LuaTable actor2, string relationshipType)
 Chat Mapper function.
 
static void SetRelationship (LuaTable actor1, LuaTable actor2, string relationshipType, float value)
 Chat Mapper function.
 
static void IncRelationship (LuaTable actor1, LuaTable actor2, string relationshipType, float incrementAmount)
 Chat Mapper function.
 
static void DecRelationship (LuaTable actor1, LuaTable actor2, string relationshipType, float decrementAmount)
 Chat Mapper function.
 
static string GetStatusTableAsLua ()
 Gets the Lua commands necessary to rebuild the status table.
 
static string GetRelationshipTableAsLua ()
 Gets the Lua commands necessary to rebuild the relationship table.
 
static void RefreshStatusTableFromLua ()
 
static void RefreshRelationshipTableFromLua ()
 
static string DoubleQuotesToSingle (string s)
 Replaces all double-quotes with escaped double-quotes, newlines with escapes newlines, and removes carriage returns.
 
static string SpacesToUnderscores (string s)
 Replaces all spaces with underscores.
 
static string StringToTableIndex (string s)
 Returns the version of a string usable as the index to a Chat Mapper table.
 
static string StringToLocalizedTableIndex (string s)
 Returns a StringToTableIndex() value after adding the current language code to the end of s.
 
static string StringToFieldName (string s)
 Returns the version of a string usable as the field of an element in a Chat Mapper table.
 
static string StringToLocalizedFieldName (string s)
 Returns a StringToFieldName() value after adding the current language code to the end of s.
 
static bool DoesTableElementExist (string table, string element)
 Checks if a table element exists.
 
static Lua.Result GetTableField (string table, string element, string field)
 Gets the value of a field in a Lua table element.
 
static void SetTableField (string table, string element, string field, object value)
 Sets the value of a field in a Lua table element.
 
static Lua.Result GetActorField (string actor, string field)
 Gets the value of a field in the Lua Actor table.
 
static void SetActorField (string actor, string field, object value)
 Sets the value of a field in the Lua Actor table.
 
static Lua.Result GetItemField (string item, string field)
 Gets the value of a field in the Lua Item table.
 
static void SetItemField (string item, string field, object value)
 Sets the value of a field in the Lua Item table.
 
static Lua.Result GetQuestField (string quest, string field)
 Gets the value of a field in the Lua Quest table, which is an alias for the Item table.
 
static void SetQuestField (string quest, string field, object value)
 Sets the value of a field in the Lua Quest table, which is an alias for the Item table.
 
static Lua.Result GetLocationField (string location, string field)
 Gets the value of a field in the Lua Location table.
 
static void SetLocationField (string location, string field, object value)
 Sets the value of a field in the Lua Location table.
 
static string[] GetAllVariables ()
 Returns a list of all runtime variable names.
 
static bool DoesVariableExist (string variable)
 Checks if a variable exists in the Lua Variable table.
 
static Lua.Result GetVariable (string variable)
 Gets the value of a variable in the Lua Variable table.
 
static bool GetVariable (string variable, bool defaultValue)
 Gets the bool value of a Lua variable, or returns a default value if not defined.
 
static string GetVariable (string variable, string defaultValue)
 Gets the string value of a Lua variable, or returns a default value if not defined.
 
static int GetVariable (string variable, int defaultValue)
 Gets the int value of a Lua variable, or returns a default value if not defined.
 
static float GetVariable (string variable, float defaultValue)
 Gets the float value of a Lua variable, or returns a default value if not defined.
 
static void SetVariable (string variable, object value)
 Sets the value of a variable in the Lua Variable table.
 
static Lua.Result GetLocalizedTableField (string table, string element, string field)
 Gets the value of a localized field in a Lua table element.
 
static void SetLocalizedTableField (string table, string element, string field, object value)
 Sets the value of a localized field in a Lua table element.
 
static Lua.Result GetLocalizedActorField (string actor, string field)
 Gets the value of a localized field in the Lua Actor table.
 
static void SetLocalizedActorField (string actor, string field, object value)
 Sets the value of a localized field in the Lua Actor table.
 
static Lua.Result GetLocalizedItemField (string item, string field)
 Gets the value of a localized field in the Lua Item table.
 
static void SetLocalizedItemField (string item, string field, object value)
 Sets the value of a localized field in the Lua Item table.
 
static Lua.Result GetLocalizedQuestField (string quest, string field)
 Gets the value of a localized field in the Lua Quest table, which is an alias for the Item table.
 
static void SetLocalizedQuestField (string quest, string field, object value)
 Sets the value of a localized field in the Lua Quest table, which is an alias for the Item table.
 
static Lua.Result GetLocalizedLocationField (string location, string field)
 Gets the value of a localized field in the Lua Location table.
 
static void SetLocalizedLocationField (string location, string field, object value)
 Sets the value of a localized field in the Lua Location table.
 
static Lua.Result GetConversationField (int conversationID, string field)
 Gets the value of a conversation field.
 
static void SetConversationField (int conversationID, string field, object value)
 Sets the value of a conversation field.
 
static Lua.Result GetLocalizedConversationField (int conversationID, string field)
 Gets the value of a conversation field.
 

Static Public Attributes

const string SimStatus = "SimStatus"
 
const string Untouched = "Untouched"
 
const string WasDisplayed = "WasDisplayed"
 
const string WasOffered = "WasOffered"
 
static bool includeSimStatus = true
 Gets or sets a value indicating whether to record SimStatus in the Lua environment.
 
static bool replaceSlashWithUnderscore = true
 DANGEROUS: Version 2.2.5 introduced a fix that replaces "/" with "_" in table indices.
 

Detailed Description

A static class that adds additional Chat Mapper-related functionality to the Lua environment, since Chat Mapper projects can define conditions and actions in Lua, modify Lua variables, and use Chat Mapper-specific Lua functions.

For speed, this class occasionally bypasses the Lua wrapper class and works directly with the underlying Lua implementation, Lua Interpreter.

Member Function Documentation

◆ AddChatMapperVariables()

static void PixelCrushers.DialogueSystem.DialogueLua.AddChatMapperVariables ( DialogueDatabase  database,
List< DialogueDatabase loadedDatabases 
)
inlinestatic

Adds the assets defined in a DialogueDatabase to the Chat Mapper tables.

Doesn't add assets that are contained in loadedDatabases. Runs the global user script if defined.

Parameters
databaseThe DialogueDatabase containing assets to add.
loadedDatabasesList of databases that have already been loaded and added to Lua.

◆ AddToConversationTable() [1/2]

static void PixelCrushers.DialogueSystem.DialogueLua.AddToConversationTable ( List< Conversation conversations,
List< DialogueDatabase loadedDatabases,
bool  addRaw = false 
)
inlinestatic

◆ AddToConversationTable() [2/2]

static LuaTable PixelCrushers.DialogueSystem.DialogueLua.AddToConversationTable ( LuaTable  conversationTable,
Conversation  conversation,
bool  addRaw = false 
)
inlinestatic

◆ DecRelationship()

static void PixelCrushers.DialogueSystem.DialogueLua.DecRelationship ( LuaTable  actor1,
LuaTable  actor2,
string  relationshipType,
float  decrementAmount 
)
inlinestatic

Chat Mapper function.

See the online Chat Mapper manual for more details: http://www.chatmapper.com

Syntax:

  • void DecRelationship(actor1, actor2, "relationshipType", decrementAmount)

◆ DoesTableElementExist()

static bool PixelCrushers.DialogueSystem.DialogueLua.DoesTableElementExist ( string  table,
string  element 
)
inlinestatic

Checks if a table element exists.

Returns
true, if the table entry exists, false otherwise.
Parameters
tableTable name (e.g., "Actor").
elementElement name (e.g., "Player").

◆ DoesVariableExist()

static bool PixelCrushers.DialogueSystem.DialogueLua.DoesVariableExist ( string  variable)
inlinestatic

Checks if a variable exists in the Lua Variable table.

Returns
true if the variable exists, false otherwise.
Parameters
variableVariable name.

◆ DoubleQuotesToSingle()

static string PixelCrushers.DialogueSystem.DialogueLua.DoubleQuotesToSingle ( string  s)
inlinestatic

Replaces all double-quotes with escaped double-quotes, newlines with escapes newlines, and removes carriage returns.

This utility function is used to pre-process strings before inserting them in Lua commands to help prevent syntax errors. Note:: This method previously replaced all double-quotes with single-quotes. The same method name was kept to prevent any customer code that uses it from breaking.

Returns
The string, but with all double-quotes converted to escaped double-quotes.
Parameters
sThe original string.

◆ FieldValueAsString()

static string PixelCrushers.DialogueSystem.DialogueLua.FieldValueAsString ( Field  field)
inlinestatic

Returns a field's value as a string for use in Lua.

If it's a numeric field, the string will just contain the number. If it's a Boolean, it will be true or false (lowercase). Otherwise it will be a string enclosed in double-quotes, with any internal double quotes converted to single quotes.

Returns
The value as a string.
Parameters
fieldThe field.

◆ GetActorField()

static Lua.Result PixelCrushers.DialogueSystem.DialogueLua.GetActorField ( string  actor,
string  field 
)
inlinestatic

Gets the value of a field in the Lua Actor table.

Returns
The actor field as a Lua.Result. To get a basic data type, addend .AsString, .AsBool, etc., to it.
Parameters
actorActor name.
fieldName of the field in the actor element.
int age = GetActorField("Player", "Age").AsInt;

◆ GetAllVariables()

static string[] PixelCrushers.DialogueSystem.DialogueLua.GetAllVariables ( )
inlinestatic

Returns a list of all runtime variable names.

◆ GetConversationField()

static Lua.Result PixelCrushers.DialogueSystem.DialogueLua.GetConversationField ( int  conversationID,
string  field 
)
inlinestatic

Gets the value of a conversation field.

Parameters
conversationIDConversation ID.
fieldField name.
Returns
The value of the field.

◆ GetFieldLuaValue()

static LuaValue PixelCrushers.DialogueSystem.DialogueLua.GetFieldLuaValue ( Field  field)
inlinestatic

◆ GetItemField()

static Lua.Result PixelCrushers.DialogueSystem.DialogueLua.GetItemField ( string  item,
string  field 
)
inlinestatic

Gets the value of a field in the Lua Item table.

Returns
The item field as a Lua.Result. To get a basic data type, addend .AsString, .AsBool, etc., to it.
Parameters
itemItem/quest name.
fieldName of the field in the item element.
character.xp += GetItemField("Kill 5 Rats", "XP").AsInt;

◆ GetLocalizedActorField()

static Lua.Result PixelCrushers.DialogueSystem.DialogueLua.GetLocalizedActorField ( string  actor,
string  field 
)
inlinestatic

Gets the value of a localized field in the Lua Actor table.

Returns
The actor field as a Lua.Result. To get a basic data type, addend .AsString, .AsBool, etc., to it.
Parameters
actorActor name.
fieldBase name (non-localized) of the field in the actor element.
int age = GetActorField("Player", "Age").AsInt;

◆ GetLocalizedConversationField()

static Lua.Result PixelCrushers.DialogueSystem.DialogueLua.GetLocalizedConversationField ( int  conversationID,
string  field 
)
inlinestatic

Gets the value of a conversation field.

Parameters
conversationIDConversation ID.
fieldBase name (non-localized) of the field in the location element.
Returns
The value of the field.

◆ GetLocalizedItemField()

static Lua.Result PixelCrushers.DialogueSystem.DialogueLua.GetLocalizedItemField ( string  item,
string  field 
)
inlinestatic

Gets the value of a localized field in the Lua Item table.

Returns
The item field as a Lua.Result. To get a basic data type, addend .AsString, .AsBool, etc., to it.
Parameters
itemItem/quest name.
fieldBase name (non-localized) of the field in the item element.

◆ GetLocalizedLocationField()

static Lua.Result PixelCrushers.DialogueSystem.DialogueLua.GetLocalizedLocationField ( string  location,
string  field 
)
inlinestatic

Gets the value of a localized field in the Lua Location table.

Returns
The location field as a Lua.Result. To get a basic data type, addend .AsString, .AsBool, etc., to it.
Parameters
locationLocation name.
fieldBase name (non-localized) of the field in the location element.

◆ GetLocalizedQuestField()

static Lua.Result PixelCrushers.DialogueSystem.DialogueLua.GetLocalizedQuestField ( string  quest,
string  field 
)
inlinestatic

Gets the value of a localized field in the Lua Quest table, which is an alias for the Item table.

Returns
The field as a Lua.Result. To get a basic data type, addend .AsString, .AsBool, etc., to it.
Parameters
questQuest name.
fieldBase name (non-localized) of the field.

◆ GetLocalizedTableField()

static Lua.Result PixelCrushers.DialogueSystem.DialogueLua.GetLocalizedTableField ( string  table,
string  element,
string  field 
)
inlinestatic

Gets the value of a localized field in a Lua table element.

Returns
The field value as a Lua.Result. To get a basic data type, addend .AsString, .AsBool, etc., to it.
Parameters
tableTable name.
elementName of an element in the table.
fieldThe base name (non-localized) of a field in the element.

◆ GetLocalizedText()

static string PixelCrushers.DialogueSystem.DialogueLua.GetLocalizedText ( string  tableName,
string  elementName,
string  fieldName 
)
inlinestatic

Gets the localized text for a field in a table element.

Returns
The localized text.
Parameters
tableNameTable name.
elementNameElement name.
fieldNameField name.

◆ GetLocationField()

static Lua.Result PixelCrushers.DialogueSystem.DialogueLua.GetLocationField ( string  location,
string  field 
)
inlinestatic

Gets the value of a field in the Lua Location table.

Returns
The location field as a Lua.Result. To get a basic data type, addend .AsString, .AsBool, etc., to it.
Parameters
locationLocation name.
fieldName of the field in the location element.

◆ GetQuestField()

static Lua.Result PixelCrushers.DialogueSystem.DialogueLua.GetQuestField ( string  quest,
string  field 
)
inlinestatic

Gets the value of a field in the Lua Quest table, which is an alias for the Item table.

Returns
The field as a Lua.Result. To get a basic data type, addend .AsString, .AsBool, etc., to it.
Parameters
questQuest name.
fieldName of the field.
character.xp += GetQuestField("Kill 5 Rats", "XP").AsInt;

◆ GetRelationship()

static float PixelCrushers.DialogueSystem.DialogueLua.GetRelationship ( LuaTable  actor1,
LuaTable  actor2,
string  relationshipType 
)
inlinestatic

Chat Mapper function.

See the online Chat Mapper manual for more details: http://www.chatmapper.com

Syntax:

  • number GetRelationship(actor1, actor2, "relationshipType")

◆ GetRelationshipTableAsLua()

static string PixelCrushers.DialogueSystem.DialogueLua.GetRelationshipTableAsLua ( )
inlinestatic

Gets the Lua commands necessary to rebuild the relationship table.

Returns
The Lua code.

◆ GetSimStatus() [1/2]

static string PixelCrushers.DialogueSystem.DialogueLua.GetSimStatus ( DialogueEntry  dialogueEntry)
inlinestatic

Returns the SimStatus of a dialogue entry, or a blank string if Include Sim Status isn't ticked.

◆ GetSimStatus() [2/2]

static string PixelCrushers.DialogueSystem.DialogueLua.GetSimStatus ( int  conversationID,
int  entryID 
)
inlinestatic

Returns the SimStatus of a dialogue entry, or a blank string if Include Sim Status isn't ticked.

◆ GetStatus()

static string PixelCrushers.DialogueSystem.DialogueLua.GetStatus ( LuaTable  asset1,
LuaTable  asset2 
)
inlinestatic

Chat Mapper function.

See the online Chat Mapper manual for more details: http://www.chatmapper.com

Syntax:

  • string GetStatus(asset1, asset2)

◆ GetStatusTableAsLua()

static string PixelCrushers.DialogueSystem.DialogueLua.GetStatusTableAsLua ( )
inlinestatic

Gets the Lua commands necessary to rebuild the status table.

Returns
The Lua code.

◆ GetTableField()

static Lua.Result PixelCrushers.DialogueSystem.DialogueLua.GetTableField ( string  table,
string  element,
string  field 
)
inlinestatic

Gets the value of a field in a Lua table element.

Returns
The field value as a Lua.Result. To get a basic data type, addend .AsString, .AsBool, etc., to it.
Parameters
tableTable name.
elementName of an element in the table.
fieldName of a field in the element.

◆ GetVariable() [1/5]

static Lua.Result PixelCrushers.DialogueSystem.DialogueLua.GetVariable ( string  variable)
inlinestatic

Gets the value of a variable in the Lua Variable table.

Returns
The variable value as a Lua.Result. To get a basic data type, addend .AsString, .AsBool, etc., to it.
Parameters
variableVariable name.
int numKills = GetVariable("Kills").AsInt

◆ GetVariable() [2/5]

static bool PixelCrushers.DialogueSystem.DialogueLua.GetVariable ( string  variable,
bool  defaultValue 
)
inlinestatic

Gets the bool value of a Lua variable, or returns a default value if not defined.

◆ GetVariable() [3/5]

static float PixelCrushers.DialogueSystem.DialogueLua.GetVariable ( string  variable,
float  defaultValue 
)
inlinestatic

Gets the float value of a Lua variable, or returns a default value if not defined.

◆ GetVariable() [4/5]

static int PixelCrushers.DialogueSystem.DialogueLua.GetVariable ( string  variable,
int  defaultValue 
)
inlinestatic

Gets the int value of a Lua variable, or returns a default value if not defined.

◆ GetVariable() [5/5]

static string PixelCrushers.DialogueSystem.DialogueLua.GetVariable ( string  variable,
string  defaultValue 
)
inlinestatic

Gets the string value of a Lua variable, or returns a default value if not defined.

◆ IncRelationship()

static void PixelCrushers.DialogueSystem.DialogueLua.IncRelationship ( LuaTable  actor1,
LuaTable  actor2,
string  relationshipType,
float  incrementAmount 
)
inlinestatic

Chat Mapper function.

See the online Chat Mapper manual for more details: http://www.chatmapper.com

Syntax:

  • void IncRelationship(actor1, actor2, "relationshipType", incrementAmount)

◆ InitializeChatMapperVariables()

static void PixelCrushers.DialogueSystem.DialogueLua.InitializeChatMapperVariables ( )
inlinestatic

Initializes the Chat Mapper tables.

◆ MarkDialogueEntry()

static void PixelCrushers.DialogueSystem.DialogueLua.MarkDialogueEntry ( DialogueEntry  dialogueEntry,
string  status 
)
inlinestatic

Marks a dialogue entry with a status such as "WasOffered".

Typically you will use the more-specific functions MarkDialogueEntryDisplayed, MarkDialogueEntryOffered, and MarkDialogueEntryUntouched instead of this method.

Parameters
dialogueEntryDialogue entry to mark
statusMark entry with this status ("Untouched", "WasOffered", or "WasDisplayed")

◆ MarkDialogueEntryDisplayed()

static void PixelCrushers.DialogueSystem.DialogueLua.MarkDialogueEntryDisplayed ( DialogueEntry  dialogueEntry)
inlinestatic

Marks a dialogue entry as displayed, by setting the Lua variable Conversation[#].Dialog[#].SimStatus="WasDisplayed", where # is the conversation and/or dialogue entry ID.

The ConversationModel marks entries displayed when they are used in a conversation.

Parameters
dialogueEntryDialogue entry to mark.

◆ MarkDialogueEntryOffered()

static void PixelCrushers.DialogueSystem.DialogueLua.MarkDialogueEntryOffered ( DialogueEntry  dialogueEntry)
inlinestatic

Marks a dialogue entry as offered, by setting the Lua variable Conversation[#].Dialog[#].SimStatus="WasOffered" , where # is the conversation and/or dialogue entry ID.

If the value is already "WasDisplayed", this method leaves it as "WasDisplayed". The ConversationModel marks entries as offered when they are presented to the player as a response option.

Parameters
dialogueEntryDialogue entry to mark.

◆ MarkDialogueEntryUntouched()

static void PixelCrushers.DialogueSystem.DialogueLua.MarkDialogueEntryUntouched ( DialogueEntry  dialogueEntry)
inlinestatic

Marks a dialogue entry as untouched, by setting the Lua variable Conversation[#].Dialog[#].SimStatus="Untouched", where # is the conversation and/or dialogue entry ID.

The ConversationModel marks entries displayed when they are used in a conversation.

Parameters
dialogueEntryDialogue entry to mark.

◆ RandomElement()

static string PixelCrushers.DialogueSystem.DialogueLua.RandomElement ( string  list)
inlinestatic

Returns a random element in a list.

The list is defined in a string.

Returns
A random element.
Parameters
argsAn array of one LuaValue which is a string with elements separated by the horizontal bar character ('|').

◆ RefreshRelationshipTableFromLua()

static void PixelCrushers.DialogueSystem.DialogueLua.RefreshRelationshipTableFromLua ( )
inlinestatic

◆ RefreshStatusTableFromLua()

static void PixelCrushers.DialogueSystem.DialogueLua.RefreshStatusTableFromLua ( )
inlinestatic

◆ RegisterLuaFunctions()

static void PixelCrushers.DialogueSystem.DialogueLua.RegisterLuaFunctions ( )
inlinestatic

◆ RemoveChatMapperVariables()

static void PixelCrushers.DialogueSystem.DialogueLua.RemoveChatMapperVariables ( DialogueDatabase  database,
List< DialogueDatabase loadedDatabases 
)
inlinestatic

Removes the assets defined in a DialogueDatabase from the Chat Mapper tables.

Doesn't remove any assets that are contains in loadedDatabases.

Parameters
databaseA DialogueDatabase containing assets to remove.
loadedDatabasesList of databases containing items that should be kept in Lua.

◆ SetActorField()

static void PixelCrushers.DialogueSystem.DialogueLua.SetActorField ( string  actor,
string  field,
object  value 
)
inlinestatic

Sets the value of a field in the Lua Actor table.

Parameters
actorActor name.
fieldName of the field in the actor element.
valueValue to set the field to.
SetActorField("Player", "Age", 21);

◆ SetConversationField()

static void PixelCrushers.DialogueSystem.DialogueLua.SetConversationField ( int  conversationID,
string  field,
object  value 
)
inlinestatic

Sets the value of a conversation field.

Parameters
conversationIDConversation ID.
fieldField name.
valueValue to set.

◆ SetItemField()

static void PixelCrushers.DialogueSystem.DialogueLua.SetItemField ( string  item,
string  field,
object  value 
)
inlinestatic

Sets the value of a field in the Lua Item table.

Parameters
itemItem/quest name.
fieldName of the field in the item element.
valueValue to set the field to.
SetItemField("Kill 5 Rats", "XP", 500);

◆ SetLocalizedActorField()

static void PixelCrushers.DialogueSystem.DialogueLua.SetLocalizedActorField ( string  actor,
string  field,
object  value 
)
inlinestatic

Sets the value of a localized field in the Lua Actor table.

Parameters
actorActor name.
fieldBase name (non-localized) of the field in the actor element.
valueValue to set the field to.
SetActorField("Player", "Age", 21);

◆ SetLocalizedItemField()

static void PixelCrushers.DialogueSystem.DialogueLua.SetLocalizedItemField ( string  item,
string  field,
object  value 
)
inlinestatic

Sets the value of a localized field in the Lua Item table.

Parameters
itemItem/quest name.
fieldBase name (non-localized) of the field in the item element.
valueValue to set the field to.

◆ SetLocalizedLocationField()

static void PixelCrushers.DialogueSystem.DialogueLua.SetLocalizedLocationField ( string  location,
string  field,
object  value 
)
inlinestatic

Sets the value of a localized field in the Lua Location table.

Parameters
locationLocation name.
fieldBase name (non-localized) of the field in the location element.
valueValue to set the field to.

◆ SetLocalizedQuestField()

static void PixelCrushers.DialogueSystem.DialogueLua.SetLocalizedQuestField ( string  quest,
string  field,
object  value 
)
inlinestatic

Sets the value of a localized field in the Lua Quest table, which is an alias for the Item table.

Parameters
itemQuest name.
fieldBase name (non-localized) of the field.
valueValue to set the field to.

◆ SetLocalizedTableField()

static void PixelCrushers.DialogueSystem.DialogueLua.SetLocalizedTableField ( string  table,
string  element,
string  field,
object  value 
)
inlinestatic

Sets the value of a localized field in a Lua table element.

Parameters
tableTable name.
elementName of an element in the table.
fieldBase name (non-localized) of a field in the element.
valueThe value to set the field to.

◆ SetLocationField()

static void PixelCrushers.DialogueSystem.DialogueLua.SetLocationField ( string  location,
string  field,
object  value 
)
inlinestatic

Sets the value of a field in the Lua Location table.

Parameters
locationLocation name.
fieldName of the field in the location element.
valueValue to set the field to.

◆ SetParticipants()

static void PixelCrushers.DialogueSystem.DialogueLua.SetParticipants ( string  actorName,
string  conversantName,
string  actorIndex = null,
string  conversantIndex = null 
)
inlinestatic

Sets the conversation participant name variables (Variable['Actor'] and Variable['Conversant']) and, optionally, participant indices in Actor table.

Parameters
actorNameActor display name.
conversantNameConversant name.
actorIndexActor table index.
conversantIndexConversant table index.

◆ SetQuestField()

static void PixelCrushers.DialogueSystem.DialogueLua.SetQuestField ( string  quest,
string  field,
object  value 
)
inlinestatic

Sets the value of a field in the Lua Quest table, which is an alias for the Item table.

Parameters
itemQuest name.
fieldName of the field.
valueValue to set the field to.
SetQuestField("Kill 5 Rats", "XP", 500);

◆ SetRelationship()

static void PixelCrushers.DialogueSystem.DialogueLua.SetRelationship ( LuaTable  actor1,
LuaTable  actor2,
string  relationshipType,
float  value 
)
inlinestatic

Chat Mapper function.

See the online Chat Mapper manual for more details: http://www.chatmapper.com

Syntax:

  • void SetRelationship(actor1, actor2, "relationshipType", number)

◆ SetStatus()

static void PixelCrushers.DialogueSystem.DialogueLua.SetStatus ( LuaTable  asset1,
LuaTable  asset2,
string  statusValue 
)
inlinestatic

Chat Mapper function.

See the online Chat Mapper manual for more details: http://www.chatmapper.com

Syntax:

  • void SetStatus(asset1, asset2, "statusValue")

◆ SetTableField()

static void PixelCrushers.DialogueSystem.DialogueLua.SetTableField ( string  table,
string  element,
string  field,
object  value 
)
inlinestatic

Sets the value of a field in a Lua table element.

Parameters
tableTable name.
elementName of an element in the table.
fieldName of a field in the element.
valueThe value to set the field to.

◆ SetVariable()

static void PixelCrushers.DialogueSystem.DialogueLua.SetVariable ( string  variable,
object  value 
)
inlinestatic

Sets the value of a variable in the Lua Variable table.

Parameters
variableVariable name.
valueValue to set the variable to.
SetVariable("Met_Wizard", true);

◆ SpacesToUnderscores()

static string PixelCrushers.DialogueSystem.DialogueLua.SpacesToUnderscores ( string  s)
inlinestatic

Replaces all spaces with underscores.

Returns
The string with all spaces replaced by underscores.
Parameters
sThe original string.

◆ StringToFieldName()

static string PixelCrushers.DialogueSystem.DialogueLua.StringToFieldName ( string  s)
inlinestatic

Returns the version of a string usable as the field of an element in a Chat Mapper table.

◆ StringToLocalizedFieldName()

static string PixelCrushers.DialogueSystem.DialogueLua.StringToLocalizedFieldName ( string  s)
inlinestatic

Returns a StringToFieldName() value after adding the current language code to the end of s.

◆ StringToLocalizedTableIndex()

static string PixelCrushers.DialogueSystem.DialogueLua.StringToLocalizedTableIndex ( string  s)
inlinestatic

Returns a StringToTableIndex() value after adding the current language code to the end of s.

Returns
The table index for the localized entry.
Parameters
sThe original asset/field name.

◆ StringToTableIndex()

static string PixelCrushers.DialogueSystem.DialogueLua.StringToTableIndex ( string  s)
inlinestatic

Returns the version of a string usable as the index to a Chat Mapper table.

This utility function is used when looking up assets in tables to make it consistent with Chat Mapper. For example, if you have an actor named "Adam Birch", Chat Mapper creates a table entry Actor["Adam_Birch"] (note the underscore).

Returns
The string as it should be used to find an asset in a Chat Mapper table, with double-quotes replaced by single-quotes, spaces with underscores, and hyphens with underscores.
Parameters
sThe original asset/field name.

◆ ValueAsString()

static string PixelCrushers.DialogueSystem.DialogueLua.ValueAsString ( FieldType  fieldType,
string  fieldValue 
)
inlinestatic

Returns a Chat Mapper value as a string for use in Lua.

If it's a numeric field, the string will just contain the number. If it's a Boolean, it will be true or false (lowercase). Otherwise it will be a string enclosed in double-quotes, with any internal double quotes converted to single quotes.

Returns
The value as a string.
Parameters
fieldTypeField type.
fieldValueField value.

Member Data Documentation

◆ includeSimStatus

bool PixelCrushers.DialogueSystem.DialogueLua.includeSimStatus = true
static

Gets or sets a value indicating whether to record SimStatus in the Lua environment.

SimStatus comes from Chat Mapper, and is a way to remember whether a dialogue entry has been offered to the player ('WasOffered'), spoken by an actor ('WasDisplayed'), or neither ('Untouched'). If this information isn't useful in your project, you can disable it to save memory.

true to include sim status; otherwise, false.

◆ replaceSlashWithUnderscore

bool PixelCrushers.DialogueSystem.DialogueLua.replaceSlashWithUnderscore = true
static

DANGEROUS: Version 2.2.5 introduced a fix that replaces "/" with "_" in table indices.

In some existing projects with many forward slashes, it may not be practical to globally search and replace all variable names in Conditions and Script fields. In this case, you can revert the fix (and not replace "/" with "_") by setting this bool to false.

◆ SimStatus

const string PixelCrushers.DialogueSystem.DialogueLua.SimStatus = "SimStatus"
static

◆ Untouched

const string PixelCrushers.DialogueSystem.DialogueLua.Untouched = "Untouched"
static

◆ WasDisplayed

const string PixelCrushers.DialogueSystem.DialogueLua.WasDisplayed = "WasDisplayed"
static

◆ WasOffered

const string PixelCrushers.DialogueSystem.DialogueLua.WasOffered = "WasOffered"
static

The documentation for this class was generated from the following file: