Script - Scripted Message Gauge

From FreeSpace Wiki
Revision as of 19:08, 6 July 2014 by Axem (talk | contribs) (Correcting some minor terminology)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The Scripted Message Gauge is a LUA script that enables messages to be displayed in a different fashion. Instead of the default way of a message line appearing right away with a backlog, the message will be drawn one character at a time with a background that enables messages to be seen more easily against a bright background.

The script requires code added in rev 10756 or 3.7.2 RC3 or later.

This page will assist modders to install it, configure it, and use it.

Download Link

Download Link

Required File

All required files are included in the above download.

  • /config/
    • axmessage.cfg
  • /interface/
    • messagebox.png
  • /scripts/
    • dkjson.lua [[1]]
  • /tables/
    • axmsg-mod.tbm
    • axmsg-sct.tbm
    • parsecfg-sct.tbm
    • zLoadFirst-sct.tbm (written by Nuke)

Configuration Files

axmessage.cfg is a JSON configuration file

Default

TitleFont

Integer or String, Font index or name used for the displayed sender's name. Default is 3.

TextFont

Integer or String, Font index or name used for the displayed message text. Default is 1.

Image

Filename, Image to use as the background for the message text. Default is messagebox.

Speed

Integer, The time it will take 1 character to draw in seconds. Default is 0.03.

Length

Integer, The script uses length to guess how long a message should be displayed for. Normal behavior will have a message be displayed for (Length * Number of characters in message) seconds. Default is 0.07.

AfterVoice

Integer, If a non-generic voice file is used in a message, this is the amount of extra time the message will be visible for after the voice file is over. Default is 1.5.

TitleColor

RGBA, If monochrome is false, this is the RGBA color the sender's name will be.

TextColor

RGBA, If monochrome is false, this is the RGBA color the message text will be.


Position

Origin

Percent, Percent, Percent based positioning similar to how the new hud positioning works.

Offset

Integer, integer, The offset in pixels from the origin, similar to how the new hud positioning works.

HeadAni

Integer, integer, The offset in pixels for the talking head message gauges. This does not work (yet).


Backlog

Enabled

Boolean, activates the backlog feature. Previously received messages will have a similar behavior to the old message gauge.

Origin

Percent, Percent, Percent based positioning similar to how the new hud positioning works.

Offset

Integer, integer, The offset in pixels from the origin, similar to how the new hud positioning works.

Height

Integer, How height of the area that the backlog will be confined to. The message backlog will start at the bottom and gradually work its way up.

Offsets

Sender

X,Y offset where the Sender text will be drawn from the position

Text

X,Y offset where the message text will be drawn from the position

Monochrome

Boolean, turns monochrome on or off. See behavior for a detailed explanation

GenericFiles

Array, filenames, A list of files (minus the file extensions) that will cause the script to use generic guessing for the message length and not the actual voice file length. These are the message beeps and alarms when there's no voice acting.

MinVertRes

Integer, optional, the vertical resolution must be at least this for the script to activate.

Behavior

Message Length

There are a few ways the script calculates how long a message should be visible. If there is no voice file or the voice file is in the generic list, the message will be displayed for (Length * Number of Characters in Message). If a modifier makes the message longer, the length will be extended as well (but it will not be shortened).

If there is a VoiceFile attached to the message, the message will be displayed for (VoiceFile Length + AfterVoice).

Changing the Text Draw Speed in FRED

By putting !s and .s at the beginning of messages names in FRED, the text draw speed will be modified.

  • !!! = Draws instantly
  • !! = Draws 66% faster
  • ! = Draws 33% faster
  • . = Draws 33% slower
  • .. = Draws 66% slower
  • ... = Draws 100% slower

The characters must be at the start of the message. So

!!!Holley says sup

would work.

Holley says sup!!!

would not.

Monochrome Mode

If monochrome mode is false, the image is drawn as-is in full color without any game added-transparency. TitleColor and TextColor will be used to color the sender name and text.

If monochrome mode is true:

  • The image will be colored the same color as the talking head hud gauge. An additional dark gray copy of the image is drawn underneath to minimize washout.
  • The text will be colored the same as the default message lines hud gauge. The alpha is increased to max for maximum readability.
  • If the talking head hud gauge and message lines hud gauge are the same color (eg you selected Amber/Green/Blue in the HUD config) the text will be brightened so its slightly easier to read.

Limitations

The gauge does not brighten or dim with the Increase HUD Contrast command (L key).

The text doesn't scale like the rest of the retail hud. So using

$Scale Gauges: No

in a hud gauges table will do nothing. This may change in the future.

Using In-Game

The script needs no special activation. When the script initializes in a mission, it turns off the retail message lines gauge.

In order for the scripted messages gauge to be visible during in-game cutscenes where the disable-hud-except-messages is used, you need to use the included -mod.tbm file. It puts the control of HUD visibility on manual FREDder control, so the HUD may be visible during cutscenes where a camera sexp is used without any disable-hud sexps. Just add disable-hud or disable-hud-except-messages.