Messages.lua: Difference between revisions

From Spring
Jump to navigationJump to search
Knorke (talk | contribs)
<code> -> <pre>
Flozi (talk | contribs)
Line 8: Line 8:


==Example==
==Example==
The shortest example I found was in the Airraid game:
===Single Message===
Example taken from [[Air Raid]]


<pre>
<code><pre>
return {
return {
"Player %1(%s) is down!"
"Player %1(%s) is down!"
}
}
</pre>
</pre></code>


But there can be multiple messages as this (shortend) example from the zeroK game shows:
===Multiple Messages===
Example taken from [http://code.google.com/p/zero-k/ zeroK]


<pre>
<code><pre>
local messages = {
local messages = {
         [ [[Team%i(%s) is no more]] ] = {
         [ [[Team%i(%s) is no more]] ] = {
Line 30: Line 32:
                 "Team%i (%s) beheld Satan as he fell from heaven LIKE LIGHTNING!",
                 "Team%i (%s) beheld Satan as he fell from heaven LIKE LIGHTNING!",
                 "Team%i (%s) is out of existence",
                 "Team%i (%s) is out of existence",
        },
                ...
        [ [[Team%i is no more]] ] = {
         },
         },
}
}
return messages
return messages
</pre>
</pre></code>


[[Category:Game development]]
[[Category:Game development]]
[[Category:gamedata]]
[[Category:gamedata]]

Revision as of 14:52, 2 April 2011

What and & Where is it?

messages.lua is a file in the gamedata\ folder of a Spring Game. It defines what messages are shown when a player dies. (and perhaps other messages too but nobody knows for sure) Before the introduction of Lua it was once called messages.tdf with a slighly different synthax. (this still works)

Details

In the message string %i is replaced with the teamnumber and %s is replaced with the players name.

Example

Single Message

Example taken from Air Raid

return {
	"Player %1(%s) is down!"
}

Multiple Messages

Example taken from zeroK

local messages = {
        [ [[Team%i(%s) is no more]] ] = {
                --AA/BA
                "Team%i (%s) has been obliterated",
                "Team%i (%s) has been liquidated",
                "Team%i (%s) has been eradicated",
                "Team%i (%s) has been terminated",
                "Team%i (%s) has bowed out",
                "Team%i (%s) has gone to a better place",
                "Team%i (%s) beheld Satan as he fell from heaven LIKE LIGHTNING!",
                "Team%i (%s) is out of existence",
                ...
        },
}
return messages