Author Topic: FRED message converter release candidate beta for v0.001a  (Read 1856 times)

0 Members and 1 Guest are viewing this topic.

Offline Shivan Hunter

  • 210
  • FRED needs lambdas!
FRED message converter release candidate beta for v0.001a
DOWNLOAD


This Java program converts a list of messages in a text file to a list of messages and events for a FS mission. It does NOT actually put them in a mission yet; it generates two txt files which you must copy and paste into the mission file using a text editor.


THE INPUT must be in this format:

Code: [Select]
MessageName: $MessageName
Sender: $Sender
Message: $Message
Persona: $Persona
AVI: $AVI
WAV: $WAV
team: $Team

Of these, only the MessageName and Message fields are required. The Sender defaults to #Command if it's not specified, and the event name is generated based on the message name (messagenameMSG).

An example would be:

Code: [Select]
MessageName: a message
Sender: Alpha 3
Message: Hey, there are Shivans out here!

MessageName: another message
Sender: Alpha 2
Message: Well do something about them!

THE OUTPUT to this would consist of two files, messages.txt and events.txt.

Messages.txt:

Code: [Select]
MESSAGE COUNT:2

$Name: a message
$Team: -1
$MessageNew: XSTR("hey, there are shivans out here!", -1)
$end_multi_text

$Name: another message
$Team: -1
$MessageNew: XSTR("well do something about them!", -1)
$end_multi_text

events.txt:

Code: [Select]
EVENT COUNT:2

$Formula: ( when
   ( true )
   ( send-message
      "alpha 3"
      "High"
      "a message"
   )
)
$Name: a messageMSG
$Repeat Count: 1
$Interval: 1
$Team: 0

$Formula: ( when
   ( true )
   ( send-message
      "alpha 2"
      "High"
      "another message"
   )
)
$Name: another messageMSG
$Repeat Count: 1
$Interval: 1
$Team: 0

The messages get copied into the messages section of the mission file and the events get copied into the events section. IN ADDITION, you must edit the message count and event count in the mission file: the number of messages (and thus the number to add to the one in the file) is at the top of each file for reference.

KNOWN FEATURES
that might be called bugs:

-The events have a condition of "True". They appear in the order the messages do in the input file, but you will have to chain them and/or set conditions yourself.

-The priority of the message is always "High". I should have set this as an optional field in the beginning but only noticed it as I was finishing up, so it's not included yet. You'll have to set it in FRED yourself.

-I have not tested this with the format screwed up, only with it correct. Basically, the parser starts a new message at "MessageName:", and anything out of place in that message would only screw up that message, unless you did something really heinous that I haven't anticipated.

-Not really a bug/oversight but a random note on how the parser works: The order in which the fields appear after "MessageName" does not matter, and if you set one twice the last value will be used instead of the first. I think. Again, I didn't test this.