The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Dev Tool] Simple Text Message Module
Abion47 Offline
Senior Member

Posts: 369
Threads: 22
Joined: Oct 2015
Reputation: 46
#1
[Dev Tool] Simple Text Message Module

Enough people have been asking about a SOMA equivalent for Amnesia's SetMessage function that I went ahead and created a module for it.

[Image: AiC97mf.jpg]

Installing the script into your mod is simple - just take the "script" folder from the mod package and copy it into the root folder of your mod, then make sure you add the line "<Directory Path="/script" AddSubDirs="true" />" to your mod's resources.cfg file (if you haven't already).

You will also need to add a new file inside your config folder called "Modules.cfg", then paste this text into that file.

Using the script is simple as well. For basic functionality, it shares the syntax from Amnesia:

SetMessage(const tString &in asText);
SetMessage(const tString &in asTextCategory, const tString &in asTextEntry);
SetMessage(const tString &in asText, float afMessageDuration);
SetMessage(const tString &in asTextCategory, const tString &in asTextEntry, float afMessageDuration);

So a very simple example of using the module (the code I used for the image above in fact) would be:

SetMessage("This is a simple message.");

For people who want to add a little more control to their messages, here is the full syntax for the functions as well:

void SetMessage(const tString &in asText,
    float afMessageDuration = 3.0f,
    eMessagePosition alMessagePosition = eMessagePosition_TopCenter,
    eMessageAlignment alMessageAlignment = eMessageAlignment_Default,
    cVector2f avMessageSize = cVector2f_MinusOne,
    cVector2f avMessageOffset = cVector2f_Zero);
  • asText: The message to be displayed.
  • afMessageDuration: The time, in seconds, for the message to be displayed. (Excluding the fade in/out time.)
  • alMessagePosition: The position of the text on the screen. (Defaults to dead center).
  • alMessageAlignment: The alignment of the text body. (Defaults to dependent on the message position.)
  • avMessageSize: The size, in group space (0.0-1.0), of the text body. (Defaults to roughly two-thirds the width of the screen.)
  • alMessageOffset: The offset, in group space (0.0-1.0), of the message text. (Defaults to no offset.)


void SetMessage(const tString &in asTextCategory,
    const tString &in asTextEntry,
    float afMessageDuration = 3.0f,
    eMessagePosition alMessagePosition = eMessagePosition_TopCenter,
    eMessageAlignment alMessageAlignment = eMessageAlignment_Default,
    cVector2f avMessageSize = cVector2f_MinusOne,
    cVector2f avMessageOffset = cVector2f_Zero);
  • asTextCategory: The text category to be using for this message.
  • asTextEntry: The text entry for the message to be displayed.
  • afMessageDuration: The time, in seconds, for the message to be displayed. (Excluding the fade in/out time.)
  • alMessagePosition: The position of the text on the screen. (Defaults to dead center).
  • alMessageAlignment: The alignment of the text body. (Defaults to dependent on the message position.)
  • avMessageSize: The size, in group space (0.0-1.0), of the text body. (Defaults to roughly two-thirds the width of the screen.)
  • alMessageOffset: The offset, in group space (0.0-1.0), of the message text. (Defaults to no offset.)

To sum that up, you can use either plain text or lang categories for the message text, input your own duration time, define where you want the message box to appear, how you want the text to be aligned, and put in your own custom offset/size for the box itself.

To get the module, you can either get it from the Steam Workshop or by downloading it directly from MediaFire.
(This post was last modified: 03-10-2016, 01:53 PM by Abion47.)
03-10-2016, 01:48 AM
Find


Messages In This Thread
[Dev Tool] Simple Text Message Module - by Abion47 - 03-10-2016, 01:48 AM



Users browsing this thread: 1 Guest(s)