# Tools

Tools Function Library

The Tools Function Library is a versatile collection of extra utility functions designed to streamline and simplify common tasks in Unreal Engine game development.

This library is a useful resource for any Unreal Engine project, offering a wide range of functions that provide essential functionality for various game development needs.


# Print

# Log

Print a message on screen and/or console with control params. (In Development, Debug or Editor mode)

Check your Verbosity setting to select where this message is printed.

Parameters
Message: string
(Omittable) Owner: ref              // Object that called this function.
(Omittable) PrintType: PrintType    [ Log, Success, Warning, Error ]
$ ^Quillscript.Tools.Log Hello
$ ^Quillscript.Tools.Log 'Print this message'
$ ^Quillscript.Tools.Log 'Print this message' {&Script} Error

#include "Utils/Tools.h"
...

UTools::Log("Print this message", MyObject, EPrintType::Error);

# Print

Print a message on screen and/or console. (In Development, Debug or Editor mode)

Check your Verbosity setting to select where this message is printed.

Parameters
Message: string
(Omittable) Owner: ref    // Object that called this function.
$ ^Quillscript.Tools.Print Hello
$ ^Quillscript.Tools.Print 'Print this message'
$ ^Quillscript.Tools.Print 'Print this message' {&Script}

#include "Utils/Tools.h"
...

// Macro (Only inside an UObject method. Type cast is NOT required)
PRINT("Print this message")

// Function call.
UTools::Print("Print this message", MyObject)

# Success

Print a success message on screen and/or console. (In Development, Debug or Editor mode)

Check your Verbosity setting to select where this message is printed.

Parameters
Message: string
(Omittable) Owner: ref    // Object that called this function.
$ ^Quillscript.Tools.Success Hello
$ ^Quillscript.Tools.Success 'Print this message'
$ ^Quillscript.Tools.Success 'Print this message' {&Script}

#include "Utils/Tools.h"
...

// Macro (Only inside an UObject method. Type cast is NOT required)
SUCCESS("Print this message");

// Function call.
UTools::Success("Print this message", MyObject);

# Warning

Print a warning message on screen and/or console. (In Development, Debug or Editor mode)

Check your Verbosity setting to select where this message is printed.

Parameters
Message: string
(Omittable) Owner: ref    // Object that called this function.
$ ^Quillscript.Tools.Warning Hello
$ ^Quillscript.Tools.Warning 'Print this message'
$ ^Quillscript.Tools.Warning 'Print this message' {&Script}

#include "Utils/Tools.h"
...

// Macro (Only inside an UObject method. Type cast is NOT required)
WARNING("Print this message");

// Function call.
UTools::Warning("Print this message", MyObject);

# Error

Print an error message on screen and/or console. (In Development, Debug or Editor mode)

Check your Verbosity setting to select where this message is printed.

Parameters
Message: string
(Omittable) Owner: ref    // Object that called this function.
$ ^Quillscript.Tools.Error Hello
$ ^Quillscript.Tools.Error 'Print this message'
$ ^Quillscript.Tools.Error 'Print this message' {&Script}

#include "Utils/Tools.h"
...

// Macro (Only inside an UObject method. Type cast is NOT required)
ERROR("Print this message");

// Function call.
UTools::Error("Print this message", MyObject);


# Utilities

# Rename Object

Rename the given object.

This function is useful to give a know name to an object and reference it later by name in script like:
$ &ObjName.ObjFunction

Parameters
Object: ref
NewName: string
$ ^Quillscript.Tools.RenameObject {&RefName} NewRefName
$ &NewRefName.MyFunction

#include "Utils/Tools.h"
...

UTools::RenameObject(MyObject, "RefName");

# Find Class by Path

Attempts to locate a class by its path, specified as a string. This function is a valuable utility for dynamically finding and accessing classes within your Unreal Engine project based on their defined paths.

Parameters
Path: string
// Store class reference in {&ReturnValue}.
$ ^Quillscript.Tools.FindClassByPath /Game/Path/To/Blueprint.Blueprint
$ ^Quillscript.Tools.FindClassByPath /Game/Path/To/Blueprint.Blueprint_C
$ ^Quillscript.Tools.FindClassByPath Module.ClassName

#include "Utils/Tools.h"
...

// Blueprint class.
TObjectPtr<UClass> BlueprintPath{ UTools::FindClassByPath("/Game/Path/To/My/Blueprint.Blueprint") };
TObjectPtr<UClass> ClassPath{ UTools::FindClassByPath("/Game/Path/To/My/Blueprint.Blueprint_C") };

// C++ class.
TObjectPtr<UClass> CppClass{ UTools::FindClassByPath("Module.ClassName") };
TObjectPtr<UClass> CppClassExample{ UTools::FindClassByPath("Engine.Actor") };

# Get Class Default Object

Get the default object from the given class. This function is useful to expose the Default Object to Blueprints.

Parameters
Class: ref[Class]
// Store class reference in {&ReturnValue}.
$ ^Quillscript.Tools.GetClassDefaultObject {&Class}

#include "Utils/Tools.h"
...

TObjectPtr<UClass> DefaultObject{ UTools::GetClassDefaultObject(Class) };

# Property Exists


# Get Property by Name


# Set Property by Name


# Find Property by Name


# Insert Property by Name


# Call Function by Name

Call a Target's function by name and return its Return Value and Outer Parameters.

This is a simplified general usage version of Interpreter.CallFunctionOnTarget() that do not create Quillscript variables and script references.

Parameters
WorldContextObject: ref
Target: ref
FunctionName: name
Parameters: array[string]
// Store class reference in {&ReturnValue}.
$ ^Quillscript.Tools.CallFunctionByName {&Target} MyFunction '("10","true")'

#include "Utils/Tools.h"
...

TMap<FName, FString> OuterParams{
    UTools::CallFunctionByName(
        WorldContextObject,
        Target,
        "MyFunction",
        TArray<FString>({"10", "true"})
    )
};

# Has Authority

Serves as a shortcut utility designed for use inside static methods that have a WorldContextObject parameter. It allows you to determine whether the current execution context possesses authority, using the GetFirstPlayerController, which is often associated with server or authoritative roles in networked multiplayer games.

While this function provides a convenient way to check authority within static methods, it's important to note that if your function already has access to HasAuthority() through other means, it's advisable to use those methods instead.

Parameters
WorldContextObject: ref
// Store result in {&ReturnValue}.
$ ^Quillscript.Tools.HasAuthority

#include "Utils/Tools.h"
...

// Macro (Only inside functions with a 'WorldContextObject' variable)
if (HAS_AUTHORITY())
{
    // Implementation.
}

// Function call.
if (UTools::HasAuthority(WorldContextObject))
{
    // Implementation.
}

# Is Module Loaded

Check whether a specific module or plugin is currently loaded within the Unreal Engine project. This function provides a straightforward way to determine if a particular module or plugin is available and active for use in your project.

Parameters
ModuleName: name
// Store result in {&ReturnValue}.
$ ^Quillscript.Tools.IsModuleLoaded ModuleName

#include "Utils/Tools.h"
...

if (UTools::IsModuleLoaded(ModuleName))
{
    // Implementation.
}

# Generate Random String

Check whether a specific module or plugin is currently loaded within the Unreal Engine project. This function provides a straightforward way to determine if a particular module or plugin is available and active for use in your project.

Parameters
(Omittable) Size: byte = 8
(Omittable) Letters: bool = true
(Omittable) Numbers: bool = true
(Omittable) Symbols: bool = false
// Store result in {&ReturnValue}.
$ ^Quillscript.Tools.GenerateRandomString
$ ^Quillscript.Tools.GenerateRandomString 8 true true true

#include "Utils/Tools.h"
...

FString RandomString{ UTools::GenerateRandomString() };

# Retrieve Option

Fetch a level transition option by providing the option's key. This function is particularly useful when you need to access specific transition options after a level change, allowing you to retrieve and utilize option values as needed.

Parameters
WorldContextObject: ref
Key: string
Value: string
// Store if level option exists in {$ReturnValue}.
// Store level option value in {&Value}.
$ ^Quillscript.Tools.RetrieveOption MyKey

#include "Utils/Tools.h"
...

FString Key, Value;
FString RandomString{ UTools::RetrieveOption(WorldContextObject, Key, Value) };

# Sort Strings Alphabetically

Sort an array of strings in alphabetical order. This function allows you to arrange a collection of strings into ascending alphabetical sequence, making it easier to manage and organize string data.

Parameters
Strings: array[string]
// Store result in {&ReturnValue}.
$ MyArray = '("Snowfall","Unreal Engine","Quillscript")'
$ ^Quillscript.Tools.SortStringsAlphabetically {MyArray}

#include "Utils/Tools.h"
...

TArray<FString> SortedArray{ UTools::SortStringsAlphabetically(StringsArray) };

# Register String Table

Register a string table by path. This function is useful when a string table is used by path and never referenced, causing it to not be loaded during runtime.

Parameters
StringTablepPath: name
// Store result in {&ReturnValue}.
$ ^Quillscript.Tools.RegisterStringTable /Game/Folder/MyTable.MyTable

#include "Utils/Tools.h"
...

UTools::RegisterStringTable("/Game/Folder/MyTable.MyTable");

# Find String Table Key


# Get Variables in String


# Length



# Metadata

# Get Project Name

Retrieves the project name that is configured in the Edit > Project Settings > Project > Description > Project Name field. This function allows you to access the project's name programmatically.

// Store result in {&ReturnValue}.
$ ^Quillscript.Tools.GetProjectName

#include "Utils/Tools.h"
...

FString ProjectName{ UTools::GetProjectName() };

# Get Project Version

Retrieves the project version that is set in the Edit > Project Settings > Project > Description > Project Version field. You can use this function to access the project's version number within your code.

// Store result in {&ReturnValue}.
$ ^Quillscript.Tools.GetProjectVersion

#include "Utils/Tools.h"
...

FString ProjectVersion{ UTools::GetProjectVersion() };

# Get Company Name

Fetches the company name specified in the Edit > Project Settings > Project > Description > Company Name field. This function is useful for obtaining the company name associated with your project.

// Store result in {&ReturnValue}.
$ ^Quillscript.Tools.GetCompanyName

#include "Utils/Tools.h"
...

FString CompanyName{ UTools::GetCompanyName() };


# Assets

# Mark Asset Dirty


# Save Asset



# Files

# Get All Save Game Slot Names


# Save to Text File


# Load Text File


# Load Image


# Take Screenshot


# Directory to String


# List Files


# List Directories


# Launch File



# Settings

# Get Bool Setting


# Set Bool Setting


# Get String Setting


# Set String Setting


# Get Int Setting


# Set Int Setting


# Get Float Setting


# Set Float Setting


# Setting File to String



# UI

# Destroy Widget


# Add to Constraint Viewport


# Capture Widget


# Get Nested Widgets


# Get Nested Widgets Of Class


# Remove Visible Widgets


# Remove Hidden Widgets


# Play Typewriter Effect

Return the given string in the 'On Printed Event' character-by-character in the given interval.

Text: text
PrintedDelegate: event
CompletedDelegate: event
(Omittable) Interval: float = 0.02
(Omittable) Sound: ref[Sound Base] = nullptr
(Omittable) bOverlapSound: bool = false
(Omittable) bSanitize: bool = true

#include "Utils/Tools.h"
...

FTextPrintedDelegate OnPrinted;
OnPrinted.BindDynamic(this, &UMyObject::Printed);

FTextCompletedDelegate OnCompleted;
OnCompleted.BindDynamic(this, &UMyObject::Completed);

TObjectPtr<ASmartTypewriter> Typewriter{
    UTools::PlayTypewriterEffect(
        WorldContextObject,
        TXT("Hello, world!"),
        OnPrinted,
        OnCompleted
    )
};
On Printed
void UMyObject::Printed(const FText& Text, const FString& Character, const int32& Index)
{
	// Implementation
}
On Completed
void UMyObject::Completed()
{
	// Implementation
}


# Pipes

# Replace Variables


# To Signed Number


# To Display Text


# Upper First Letter


# Text Upper First Letter


# Remove Accentuation


# Remove Rich Text Tags


# To Hash


# To Hex


# Encrypt


# Decrypt


# Is Key Value Pair


# To Key Value Pair


# Has Key Value Tag


# Remove Repeated Values


# To String



# Operators

# Null Coalescing Operator


# Solve Math Expression


# Is Same Unique Net Id


# Is Host