|
ArticyXImporter
ArticyXImporter for Unreal Engine
|
The UArticyExpressoScripts class manages script conditions and instructions. More...
#include <ArticyExpressoScripts.h>
Public Member Functions | |
| UArticyExpressoScripts () | |
| Default constructor for UArticyExpressoScripts. | |
| virtual UClass * | GetUserMethodsProviderInterface () |
| Retrieves the user methods provider interface. | |
| virtual void | Init (UArticyDatabase *DB) |
| Initializes the expresso scripts with the specified database. | |
| UArticyDatabase * | GetDb () const |
| Retrieves the Articy database. | |
| void | SetCurrentObject (UArticyPrimitive *Object) |
| Sets the current object for script evaluation. | |
| void | SetSpeaker (UArticyObject *Speaker) |
| Sets the speaker for dialog fragments. | |
| bool | Evaluate (const int &ConditionFragmentHash, UArticyGlobalVariables *GV, UObject *MethodProvider) const |
| Evaluates the condition and returns the result. | |
| bool | Execute (const int &InstructionFragmentHash, UArticyGlobalVariables *GV, UObject *MethodProvider) const |
| Executes the instruction and returns true if successful. | |
| void | SetDefaultUserMethodsProvider (UObject *MethodProvider) |
| Sets a default method provider for script evaluation and execution. | |
| UObject * | GetDefaultUserMethodsProvider () const |
| Retrieves the default user methods provider. | |
| UObject * | GetUserMethodsProviderObject () const |
| Retrieves the user methods provider object. | |
| virtual UArticyGlobalVariables * | GetGV () |
| Retrieves the active global variables instance. | |
Protected Member Functions | |
| virtual void | SetGV (UArticyGlobalVariables *GV) const |
| Sets the global variables instance for script execution. | |
| UArticyObject * | getObj (const FString &NameOrId, const uint32 &CloneId=0) const |
| Retrieves an Articy object by name or ID. | |
| void | setProp (const ExpressoType &Id_CloneId, const FString &Property, const ExpressoType &Value) const |
| Sets the value of a property on an Articy object. | |
| ExpressoType | getProp (const ExpressoType &Id_CloneId, const FString &Property) const |
| Retrieves the value of a property on an Articy object. | |
| int | random (int Min, int Max) |
| Generates a random integer between Min and Max. | |
| int | random (int Max) |
| Generates a random integer between 0 and Max. | |
| float | random (float Min, float Max) |
| Generates a random float between Min and Max. | |
| float | random (float Max) |
| Generates a random float between 0 and Max. | |
| ExpressoType | random (const ExpressoType &Min, const ExpressoType &Max) |
| Generates a random ExpressoType between Min and Max. | |
| ExpressoType | random (const ExpressoType &Max) |
| Generates a random ExpressoType between 0 and Max. | |
| void | incrementProp (const ExpressoType &Id_CloneId, const FString &Property, const float Value=1) const |
| Increments the value of a property on an Articy object. | |
| void | decrementProp (const ExpressoType &Id_CloneId, const FString &Property, const float Value=1) const |
| Decrements the value of a property on an Articy object. | |
| bool | isPropInRange (const ExpressoType &Id_CloneId, const FString &Property, float lowerBound, float upperBound) const |
| Checks if a property value is within a range. | |
| bool | isPropInRange (const ExpressoType &Id_CloneId, const FString &Property, const FString &lowerBound, const FString &upperBound) const |
| Checks if a property value is within a range. | |
| void | resetAllSeenCounters () |
| Resets all seen counters in the global variables. | |
| int | getSeenCounter (UArticyBaseObject *Object=nullptr) |
| Retrieves the seen counter for an Articy object. | |
| int | getSeenCounter (const FString &NameOrId) |
| Retrieves the seen counter for an Articy object by name or ID. | |
| int | setSeenCounter (const int Value=1) |
| Sets the seen counter for the current object. | |
| int | setSeenCounter (UArticyBaseObject *Object, const int Value=1) |
| Sets the seen counter for an Articy object. | |
| int | setSeenCounter (const FString &NameOrId, const int Value=1) |
| Sets the seen counter for an Articy object by name or ID. | |
| bool | fallback (UArticyBaseObject *Object) |
| Performs a fallback operation for an Articy object. | |
| bool | fallback (const FString &NameOrId) |
| Performs a fallback operation for an Articy object by name or ID. | |
| bool | fallback () |
| Performs a fallback operation for the current object. | |
Static Protected Member Functions | |
| static void | setProp (UArticyBaseObject *Object, const FString &Property, const ExpressoType &Value) |
| Sets the value of a property on an Articy object. | |
| static ExpressoType | getProp (UArticyBaseObject *Object, const FString &Property) |
| Retrieves the value of a property on an Articy object. | |
| static void | incrementProp (UArticyBaseObject *Object, const FString &Property, const float Value=1) |
| Increments the value of a property on an Articy object. | |
| static void | decrementProp (UArticyBaseObject *Object, const FString &Property, const float Value=1) |
| Decrements the value of a property on an Articy object. | |
| static bool | isInRange (float valueToTest, float lowerBound, float upperBound) |
| Checks if a value is within a range. | |
| static bool | isPropInRange (UArticyBaseObject *Object, const FString &Property, float lowerBound, float upperBound) |
| Checks if a property value is within a range. | |
| static bool | isInRange (const FString &valueToTest, const FString &lowerBound, const FString &upperBound) |
| Checks if a string value is within a range. | |
| static bool | isPropInRange (UArticyBaseObject *Object, const FString &Property, const FString &lowerBound, const FString &upperBound) |
| Checks if a property value is within a range. | |
| template<typename ... ArgTypes> | |
| static void | print (const FString &Msg, ArgTypes... Args) |
| Prints a formatted message to the log. | |
| template<typename ... ArgTypes> | |
| static void | print (const ExpressoType &Msg, ArgTypes... Args) |
| Prints a formatted message to the log. | |
| static const bool & | ConditionOrTrue (const bool &Condition) |
| Script conditions that are not empty return the condition value. | |
| static const bool | ConditionOrTrue (const int &Condition) |
| Script conditions that should evaluate to bool, but conditions evaluates to int. | |
| static bool | ConditionOrTrue (void) |
| Script conditions that are empty or only contain a comment always return true. | |
Protected Attributes | |
| UArticyPrimitive * | self = nullptr |
| The current object for script evaluation. | |
| UArticyObject * | speaker = nullptr |
| The speaker for dialog fragments. | |
| TMap< uint32, TFunction< bool()> > | Conditions |
| Map of condition fragments. | |
| TMap< uint32, TFunction< void()> > | Instructions |
| Map of instruction fragments. | |
| UObject * | UserMethodsProvider = nullptr |
| Cache of the current methods provider set during evaluation. | |
| TWeakObjectPtr< UObject > | DefaultUserMethodsProvider = nullptr |
| Default methods provider for script evaluation. | |
The UArticyExpressoScripts class manages script conditions and instructions.
The UArticyExpressoScripts class is responsible for evaluating conditions and executing instructions within the Articy runtime. It provides functionality to interact with Articy objects, properties, and global variables, and supports various script-related operations.
|
inlinestaticprotected |
Script conditions that are not empty return the condition value.
This method returns the condition value for script conditions that are not empty.
| Condition | The condition value. |
|
inlinestaticprotected |
Script conditions that should evaluate to bool, but conditions evaluates to int.
This method returns true if the integer condition is greater than zero, false otherwise.
| Condition | The integer condition value. |
|
inlinestaticprotected |
Script conditions that are empty or only contain a comment always return true.
This method returns true for script conditions that are empty or only contain a comment.
|
protected |
Decrements the value of a property on an Articy object.
This method decrements the value of the specified property on the given Articy object by the specified value.
| Id_CloneId | The compound ID of the object. |
| Property | The name of the property. |
| Value | The decrement value (default is 1). |
|
staticprotected |
Decrements the value of a property on an Articy object.
This method decrements the value of the specified property on the given Articy object by the specified value.
| Object | The Articy object containing the property. |
| Property | The name of the property. |
| Value | The decrement value (default is 1). |
| bool UArticyExpressoScripts::Evaluate | ( | const int & | ConditionFragmentHash, |
| UArticyGlobalVariables * | GV, | ||
| UObject * | MethodProvider ) const |
Evaluates the condition and returns the result.
Evaluates a condition fragment.
This method evaluates the specified condition fragment using the given global variables and method provider, and returns the result of the evaluation.
| ConditionFragmentHash | The hash of the condition fragment. |
| GV | The global variables used in the evaluation. |
| MethodProvider | The method provider used in the evaluation. |
This method evaluates a condition fragment using the specified global variables and method provider.
| ConditionFragmentHash | The hash of the condition fragment. |
| GV | The global variables used in the evaluation. |
| MethodProvider | The method provider used in the evaluation. |
| bool UArticyExpressoScripts::Execute | ( | const int & | InstructionFragmentHash, |
| UArticyGlobalVariables * | GV, | ||
| UObject * | MethodProvider ) const |
Executes the instruction and returns true if successful.
Executes an instruction fragment.
This method executes the specified instruction fragment using the given global variables and method provider, and returns true if the execution was successful.
| InstructionFragmentHash | The hash of the instruction fragment. |
| GV | The global variables used in the execution. |
| MethodProvider | The method provider used in the execution. |
This method executes an instruction fragment using the specified global variables and method provider.
| InstructionFragmentHash | The hash of the instruction fragment. |
| GV | The global variables used in the execution. |
| MethodProvider | The method provider used in the execution. |
|
protected |
Performs a fallback operation for the current object.
This method performs a fallback operation for the current object.
|
protected |
Performs a fallback operation for an Articy object by name or ID.
This method performs a fallback operation for the specified Articy object based on its name or ID.
| NameOrId | The name or ID of the object. |
|
protected |
Performs a fallback operation for an Articy object.
This method performs a fallback operation for the specified Articy object.
| Object | The Articy object. |
|
inline |
Retrieves the Articy database.
This method returns the Articy database associated with the expresso scripts.
| UObject * UArticyExpressoScripts::GetDefaultUserMethodsProvider | ( | ) | const |
Retrieves the default user methods provider.
This method returns the default user methods provider used for script evaluation and execution.
|
inlinevirtual |
Retrieves the active global variables instance.
This method returns the active global variables instance in use during script evaluation and execution, or nullptr if no instance is active.
|
protected |
Retrieves an Articy object by name or ID.
This method returns an Articy object based on the specified name or ID and clone ID.
| NameOrId | The name or ID of the object. |
| CloneId | The clone ID of the object. |
|
protected |
Retrieves the value of a property on an Articy object.
This method returns the value of the specified property on the given Articy object as an ExpressoType.
| Id_CloneId | The compound ID of the object. |
| Property | The name of the property. |
|
staticprotected |
Retrieves the value of a property on an Articy object.
This method returns the value of the specified property on the given Articy object as an ExpressoType.
| Object | The Articy object containing the property. |
| Property | The name of the property. |
|
protected |
Retrieves the seen counter for an Articy object by name or ID.
This method returns the seen counter for the specified Articy object based on its name or ID.
| NameOrId | The name or ID of the object. |
|
protected |
Retrieves the seen counter for an Articy object.
This method returns the seen counter for the specified Articy object, or the current object if none is specified.
| Object | The Articy object (default is nullptr, which means the current object). |
|
inlinevirtual |
Retrieves the user methods provider interface.
This method returns the user methods provider interface for script evaluation and execution.
| UObject * UArticyExpressoScripts::GetUserMethodsProviderObject | ( | ) | const |
Retrieves the user methods provider object.
This method returns the current user methods provider object used for script evaluation and execution.
|
protected |
Increments the value of a property on an Articy object.
This method increments the value of the specified property on the given Articy object by the specified value.
| Id_CloneId | The compound ID of the object. |
| Property | The name of the property. |
| Value | The increment value (default is 1). |
|
staticprotected |
Increments the value of a property on an Articy object.
This method increments the value of the specified property on the given Articy object by the specified value.
| Object | The Articy object containing the property. |
| Property | The name of the property. |
| Value | The increment value (default is 1). |
|
inlinevirtual |
Initializes the expresso scripts with the specified database.
This method initializes the expresso scripts with the specified Articy database.
| DB | The Articy database. |
|
staticprotected |
Checks if a string value is within a range.
This method checks if the specified string value is within the given lower and upper bounds.
| valueToTest | The string value to test. |
| lowerBound | The lower bound. |
| upperBound | The upper bound. |
|
staticprotected |
Checks if a value is within a range.
This method checks if the specified value is within the given lower and upper bounds.
| valueToTest | The value to test. |
| lowerBound | The lower bound. |
| upperBound | The upper bound. |
|
protected |
Checks if a property value is within a range.
This method checks if the value of the specified property on the given Articy object is within the given lower and upper bounds.
| Id_CloneId | The compound ID of the object. |
| Property | The name of the property. |
| lowerBound | The lower bound. |
| upperBound | The upper bound. |
|
protected |
Checks if a property value is within a range.
This method checks if the value of the specified property on the given Articy object is within the given lower and upper bounds.
| Id_CloneId | The compound ID of the object. |
| Property | The name of the property. |
| lowerBound | The lower bound. |
| upperBound | The upper bound. |
|
staticprotected |
Checks if a property value is within a range.
This method checks if the value of the specified property on the given Articy object is within the given lower and upper bounds.
| Object | The Articy object containing the property. |
| Property | The name of the property. |
| lowerBound | The lower bound. |
| upperBound | The upper bound. |
|
staticprotected |
Checks if a property value is within a range.
This method checks if the value of the specified property on the given Articy object is within the given lower and upper bounds.
| Object | The Articy object containing the property. |
| Property | The name of the property. |
| lowerBound | The lower bound. |
| upperBound | The upper bound. |
|
inlinestaticprotected |
Prints a formatted message to the log.
This method prints a formatted message to the log, allowing placeholders in the message.
| ArgTypes | The types of the arguments for formatting. |
| Msg | The message to print. |
| Args | The arguments for formatting the message. |
|
staticprotected |
Prints a formatted message to the log.
This method prints a formatted message to the log, allowing placeholders in the message.
| ArgTypes | The types of the arguments for formatting. |
| Msg | The message to print. |
| Args | The arguments for formatting the message. |
|
protected |
Generates a random ExpressoType between 0 and Max.
This method returns a random ExpressoType between 0 and the specified maximum value.
| Max | The maximum value. |
|
protected |
Generates a random ExpressoType between Min and Max.
This method returns a random ExpressoType between the specified minimum and maximum values.
| Min | The minimum value. |
| Max | The maximum value. |
|
protected |
Generates a random float between 0 and Max.
This method returns a random float between 0 and the specified maximum value.
| Max | The maximum value. |
|
protected |
Generates a random float between Min and Max.
This method returns a random float between the specified minimum and maximum values.
| Min | The minimum value. |
| Max | The maximum value. |
|
protected |
Generates a random integer between 0 and Max.
This method returns a random integer between 0 and the specified maximum value.
| Max | The maximum value. |
|
protected |
Generates a random integer between Min and Max.
This method returns a random integer between the specified minimum and maximum values.
| Min | The minimum value. |
| Max | The maximum value. |
|
protected |
Resets all seen counters in the global variables.
This method resets all seen counters in the global variables.
|
inline |
Sets the current object for script evaluation.
This method sets the current object used for script evaluation.
| Object | The current object. |
| void UArticyExpressoScripts::SetDefaultUserMethodsProvider | ( | UObject * | MethodProvider | ) |
Sets a default method provider for script evaluation and execution.
Sets the default user methods provider.
This method sets a default method provider that will be used whenever scripts are evaluated or executed without a valid method provider.
| MethodProvider | The default method provider. |
This method sets the default user methods provider for script evaluation and execution.
| MethodProvider | The user methods provider. |
|
inlineprotectedvirtual |
Sets the global variables instance for script execution.
This method sets the global variables instance to be used during the execution of expresso script fragments.
| GV | The global variables instance. |
|
protected |
Sets the value of a property on an Articy object.
This method sets the value of the specified property on the given Articy object using the ExpressoType value.
| Id_CloneId | The compound ID of the object. |
| Property | The name of the property. |
| Value | The value to set. |
|
staticprotected |
Sets the value of a property on an Articy object.
This method sets the value of the specified property on the given Articy object using the ExpressoType value.
| Object | The Articy object containing the property. |
| Property | The name of the property. |
| Value | The value to set. |
|
protected |
Sets the seen counter for an Articy object by name or ID.
This method sets the seen counter for the specified Articy object based on its name or ID to the specified value.
| NameOrId | The name or ID of the object. |
| Value | The value to set. |
|
protected |
Sets the seen counter for the current object.
This method sets the seen counter for the current object to the specified value.
| Value | The value to set (default is 1). |
|
protected |
Sets the seen counter for an Articy object.
This method sets the seen counter for the specified Articy object to the specified value.
| Object | The Articy object. |
| Value | The value to set. |
|
inline |
Sets the speaker for dialog fragments.
This method sets the speaker for dialog fragments within the expresso scripts.
| Speaker | The speaker object. |
|
protected |
Map of condition fragments.
This map contains condition fragments identified by their hash values, represented as lambda functions.
|
protected |
Default methods provider for script evaluation.
This member variable stores the default methods provider used for script evaluation and execution. It is a weak pointer in case the provider is deleted.
|
protected |
Map of instruction fragments.
This map contains instruction fragments identified by their hash values, represented as lambda functions.
|
protected |
The current object for script evaluation.
The current object where the script is evaluated on. Do not change the name, as it's called like this in script fragments!
|
protected |
The speaker for dialog fragments.
Inside a DialogFragment, this is a reference to the current speaker. Do not change the name, as it's called like this in script fragments!
|
mutableprotected |
Cache of the current methods provider set during evaluation.
This member variable stores the current methods provider set during the evaluation of scripts.