A Squawk mod is a High Frontier mod that can generate new messages for the Squawker feed. These can appear either in the main menu feed, or in colony management mode.
Example 1
This example generates squawks in the main menu feed. To try this out, save it in a text file named something like "squawktest1.hfmod", and put it in the Mods folder.
// First test of a squawk mod
title: Squawk Test 1
type: squawk
author: {
name: Joe Strout
email: support@highfrontier.com
www: http://HighFrontier.com
}
context: MainMenu
// Note that MainMenu squawk mods only need one batch of squawks,
// but it must still be formatted as an (unkeyed) collection.
{
when: RandomPercent < 50
squawks: {
This is a [cool|awesome|nifty|custom] squawk!
Mods rock!
[Making|Creating] mods is [crazy|super] fun!
{ text: Is this [mod|thing] on?; icon: FaceWorried; user: ModMan }
}
}
Example 2
This example adds squawks in colony management mode, if the gravity is unusually low.
// Second test of a squawk mod.
// This one squawks in manage mode!
title: Squawk Test 2
type: squawk
author: {
name: Joe Strout
email: support@highfrontier.com
www: http://HighFrontier.com
}
context: ManageMode
// This batch deals with gravity near zero.
{
when: gravity < 0.1
urgency: 70
squawks: {
I'm [flying|floating|soaring]!
Things go up, and they don't come down!
What goes up doesn't come down!
}
}
// This batch deals with lunar gravity (0.16 or thereabouts).
{
when: {
gravity >= 0.1
gravity < 0.2
}
urgency: 50
squawks: {
[This|It] feels [just|exactly] like the Moon!
{ text: I feel like Neil Armstrong!; icon: FaceLaughing }
This [place|colony] would be [great|perfect] for training for the Moon.
}
}
Conditions
Squawks in management mode may be dependent on conditions you define via the "when" key, as shown in the second example above. The "when" value may be either a single condition, or a list of conditions. Each condition is a variable, an operator, and a value (in that order).
Currently available variables are as follows:
- gravity: the gravity level where the simulated resident is standing; 1.0 means 1 Earth gravity.
- random: a pseudorandom number from 0.0 to 1.0
- randomPercent: a pseudorandom number from 0.0 to 100.0
Available operators are the numeric comparison operators from C-derived languages, i.e. ==, !=, <=, >=, <, and >.
Additional variables could certainly be added — please contact us to let us know what you need!
