INTRODUCTION
Having experienced some difficulties with writing my own MML scripts for Aleph One from scratch, I've decided to make a library of as many scripts as I could acquire. I find that seeing what the completed script looks like makes it very easy to see what I can change to suit my scenario's needs, but without a proper visual aid, I'm lost. Hopefully, this MML library will help others with their scenario scripting.
This library is not intended to override Loren Petrich's official MML documentation, but it does supplement it by providing examples of many available MML scripts. I've set up the example scripts to follow the same order as Loren's documentation for comprehensive cross-reference purposes. The scripts work, though they will most probably require tweaking and other work to be rendered suitable for any map, scenario, or other conversion project. The lists of indexes and elements have not been included, so the original documentation is very much required to personalize your own scripts.
Please note that I've removed the following lines of script from the examples, so be advised that they are the very first and very last things you should include in your MML scripts:
<marathon> and </marathon>
Another point to note is that in the MML documentation, many elements are referred to as such:
1000. ...
1001. ...
1002. ...
etc...
To properly implement these various items and elements to any given script, item 1005 for example, would be simply refered to as 5.
If you have any MML script examples that you would like to contribute, please email them to me. A description of what the script is/does would also be handy.
Special thanks to Loren Petrich for both creating MML, and taking the time to reply to many scripting problems I've encountered. Hopefully this will help take a load off his busy scedule.
String-Set Element: <stringset>
Interface-Stuff Element: <interface>
Overhead-Map Element: <overhead_map>
Infravision Element: <infravision>
Motion-Sensor Element: <motion_sensor>
Animated-Textures Element: <animated_textures>
Control-Panels Element: <control_panels>
Platforms Element: <platforms>
Liquids (Medias) Element: <liquids>
Sounds Element: <sounds>
Fader Element: <faders>
Player Element: <player>
View Element: <view>
Weapons Element: <weapons>
Items Element: <items>
Scenery Element: <scenery>
Landscapes Element: <landscapes>
Texture-Loading Element: <texture_loading>
OpenGL-Rendering Element: <opengl>
Dynamic-Limits Element: <dynamic_limits>
Player-Name Element: <player_name>
Keyboard-Defaults Element: <keyboard>
Cheating Element: <cheats>
Level Scripting
More Scripts
Here are scripts not covered in the original documentation:
Texture Replacement
Sprite Replacement
Fog
This script comes complete with each build of Aleph One, and consequently requires no examples. This script replaces all the stringsets originally found in Marathon. Altering these strings can allow for interesting custom hacks that no longer require the use of ResEdit, or any comparable resource editor.
Hamish Sanderson has created very concise documentation about this type of hacking in his Marathon "EditNotes". Look for this documentation at Gary Simmons' Marathon Page. (Look under the 'Anvil Tips' section.) Although the location and file format of the stringset has changed, Hamish's documentation will still help you to configure this MML script.
These scripts allow modifications to the HUD. Here is an example of the full script on a weapon (results will vary on this example depending on your Shapes file):
<interface>
<weapon index="1" shape="37" start_y="440"
end_y="475" start_x="203" end_x="455" top="361"
left="335">
<ammo index="0" type="2" left="335" top="407"
across="10" down="1" delta_x="5" delta_y="14"
bullet_shape="31" empty_shape="32" right_to_left="0"/>
<ammo index="1" type="2" left="263" top="407"
across="10" down="1" delta_x="5" delta_y="14"
bullet_shape="31" empty_shape="32" right_to_left="1"/>
</weapon>
</interface>
Here is a script that: (1) alters the location and size of the player's energy shield; (2) changes the colour of the screen in various places from black to a reddish hue; (3) changes the colour of the inventory list's text; and (4) changes the font style of the weapon name.
<interface>
<rect index="2" top="453" left="4" bottom="464"
right="190"/><!-- Shield (*)
-->
<color index="2" red=".7" green=".2" blue=".3"/><!--
Black -->
<color index="3" red=".7" green=".7" blue=".5"/><!--
Inv Text -->
<font index="1" style="4"/><!-- Weapon Name -->
</interface>
(*For a thorough explanation on modifying the buttons in the control screen, click HERE.)
This is a fun one to play with. It can have a dramatic effect on th feel of a new scenario. The following script does many things:
(1) it allows everything possible to be seen in the overhead map view;
(2) it removes corpses from collection 9 (Pfhor Fighter) from the map view;
(3) it makes thicker map lines for solid lines, which increase in thickness
as the scale increases;
(4) it changes the colours of normal polygons and the map's title;
(5) it alters the style and size of map annotations and the map title (in this
example, the map annotations also change at different scales).
<overhead_map>
<aliens on="true"/>
<items on="true"/>
<projectiles on="true"/>
<paths on="true"/>
<assign_dead coll="9" type="-1"/>
<line type="0" scale="0" width="2"/>
<line type="0" scale="1" width="3"/>
<line type="0" scale="2" width="4"/>
<line type="0" scale="3" width="5"/>
<color index="0" red="0.4" green="0.4" blue=".8"/>
<color index="17" red="0.5"
green="0.2" blue=".1"/>
<font index="0" size="12" style="0"/><!--
Annotation 0 -->
<font index="1" size="12" style="1"/><!--
Annotation 1 -->
<font index="2" size="12" style="4"/><!--
Annotation 2 -->
<font index="3" size="12" style="0"/><!--
Annotation 3 -->
<font index="4" size="18" style="16"/><!--
Map Title -->
</overhead_map>
The script for infravision allows you to change the infravision colours of each Shape collection individually. Here is an exmple where a handful of collections have been altered (somewhat randomly):
<infravision>
<assign coll="1" color="0"/>
<assign coll="2" color="1"/>
<assign coll="3" color="2"/>
<assign coll="4" color="3"/>
<assign coll="5" color="2"/>
</infravision>
This script changes all Pfhor fighters to a yellow square blip on the motion sensor. The numbers for monsters available are in Appendix 2.
<motion_sensor>
<assign monster="8" type="2"/>
<assign monster="9" type="2"/>
<assign monster="10" type="2"/>
<assign monster="11" type="2"/>
</motion_sensor>
To clarify: type="0" is friendly green square, type="1" is alien red triangle, type="2" is hostile yellow square. It doesn't seem possible to change the player's [monster="0"] own motion sensor blip.
Animated textures cause an animation to occur when a texture used in an animation script is placed on a wall. This script can also work in conjunction with Texture Replacement. All textures must exist in their own bitmap slot in the Shapes file. Here is a random example that will likely look very odd in gameplay, which uses the Walls 4 collection:
<animated_textures>
<sequence coll="20" numticks="3">
<frame index="10"/>
<frame index="11"/>
<frame index="12"/>
<frame index="13"/>
</sequence>
</animated_textures>
This script causes Sewage switches to accept S'pht cards instead of uplink chips:
<control_panels>
<panel index="30" pitch="1.1" item="24">
<sound type="2" which="11"/>
</panel>
</control_panels>
NO EXAMPLES YET.
This MML script comes with the every build of Aleph One, and consequently requires no example. Using Loren's MML documentation, you should be able to figure it out. Well, this script removes the underwater ambient sound and can be adapted to add the breathing sound:
<liquids>
<liquid index="0">
<sound type="6" which="-1"/>
</liquid>
</liquids>
NO EXAMPLES YET.
This script removes the blue tint in the underwater view:
<faders>
<liquid index="0" fader="0" opacity="0">
</liquid>
</faders>
There are many options for modifying the player scripts. This script is formatted a little differently from most of the others in that some elements can be put directly into the <player> tag, rather than between <player> and </player>. See the full documentation to see which fall under child element tags.
Here is the script used to (1) enable the 'guided' projectile tag [as found in the Physics Model]; (2) allow regular oxygen depletion in a vacuum or under liquid; and (3) allow oxygen replenishment when the player is not under a liquid or in a vacuum:
<player guided="true" oxygen_deplete="1" oxygen_replenish="1"/>
This script changes Goo to space; the damage is loss of air:
<player>
<damage index="19" fade="-1" death_sound="8"
death_action="7"/>
</player>
This script affects the player's field of view when switching between views with or without the HUD:
<view>
<fov fix_h_not_v="true"/>
</view>
This script removes the teleportation effect:
<view fold_effect="false" static_effect="false"/>
Here is a script that swaps the weapon order around:
<weapons>
<order index="1" weapon="2"/>
<order index="2" weapon="1"/>
<order index="3" weapon="3"/>
<order index="4" weapon="4"/>
<order index="5" weapon="6"/>
<order index="6" weapon="5"/>
<order index="7" weapon="7"/>
<order index="8" weapon="9"/>
<order index="9" weapon="8"/>
</weapons>
Here is a script that turns powerups into ammo types:
<items>
<item index="11" type="1"/>
<item index="17" type="1"/>
<item index="24" type="1"/>
<item index="35" type="1"/>
</items>
Here is an example of the MML script for alterations to 2 items:
<items>
<item index="0" singular="0" plural="0" maximum="1"
invalid="0"/>
<item index="1" singular="2" plural="3" maximum="2"
invalid="0">
<shape coll="7" seq="0"/>
</item>
</items>
This makes the Jjaro ceiling light breakable:
<scenery>
<object index="50" flags="5" destruction="27"/>
</scenery>
It is possible to increase the vertical viewing angle of the player in the Physics Model. However, you'll need this script in order for heightened landscape images to be viewed properly. Otherwise, odd clipping will occur (for both reasons: (1) if this script isn't available; and (2) if a higher landscape image hasn't been created to encompass the increased viewing angle):
<landscapes>
<landscape coll="27" horiz_exp="1" vert_exp="1"
vert_repeat="false" ogl_asprat_exp="0"/>
</landscapes>
NO EXAMPLES YET.
This is a huge section, really. There are three sub-sections listed at the bottom of this page (texture replacement, sprite replacement, and fog) dealing with Open GL elements.
Click HERE for a thorough explanation of glow mapping, and how to create some effects with them.
NO EXAMPLES YET.
This script is included in the original MML documentation.
NO EXAMPLES YET.
Here is an example of a functional cheat script. Try it out and modify it as you see fit:
<cheats on="true" mac_keymod="1024">
<keyword index="4">h</keyword>
<keyword index="16">b</keyword>
<keyword index="17">g</keyword>
<keyword index="18">n</keyword>
</cheats>
Level scripting allows for an almost unlimited number of level-specific MML modifications to be accomplished. Level-specific MML simply overrides the default MML scripts (found in the 'Scripts' folder in the Aleph One folder) for the specific level that it is assigned to.
These scripts must be placed in a merged or unmerged map file, in a TEXT resource. Besides resource 128, all other resources follow the exact same format as regular MML.
This script for resource 128 directs each level to another specific resource number in the TEXT resource:
<marathon_levels>
<level index="0">
<mml resource="1000"/>
</level>
<level index="1">
<mml resource="1001"/>
<mml resource="1002"/>
</level>
</marathon_levels>
Resource 1000, for example, which is linked to level 0 in this instance, would have regular MML scripts inserted. Note that level 1 has two 'mml resource' links. This will allow you to use multiple scripts per level - very handy if you want to use some scripts on more than one level, like a stylesheet.
Here is a script to add background music to a level:
<marathon_levels>
<level index="0">
<mml resource="1000"/>
</level>
<level index="1">
<mml resource="1001"/>
<music file="Music/Leela.mp3"/>
</level>
</marathon_levels>
The music file is an MP3 track called "Leela.mp3", found in a folder within the Aleph One folder named "Music".
More Scripts
Special thanks to Raul Bonilla for his help with much of this section. These are some enigmatic scripts that seem to enjoy hiding from the general public. They all fall under OpenGL, but I devoted this small section for them instead.
This script is used to implement high-resolution wall textures. It also contains alpha masks and glowmapping image information:
<opengl>
<texture coll="20" bitmap="12"
normal_image="Images/Textures/Glass.png"
normal_mask="Images/Textures/Glass_Mask.png"
opac_type="1"
/>
<opengl>
You need to indicate the shapes collection (from the 'Shapes' file) and the particular bitmap in that collection. If you want the wall texture to be semitransparent, you'll need an alpha mask, which must be a completely separate image file. This is a black and white, or greyscale, image used instead of the blue colour found in the Shapes file. Black is transparent, white is opaque, and shades of grey are semitransparent depending on their value. If the results aren't quite what you expected, try changing the 'opac_type' around.
Having an alpha mask allows for faded semitransparent wall textures - a very, very cool effect.
I'm not entirely familiar with glowmaps, so I won't even try to explain... For a more extensive list of OpenGL options (which there are many), see the original documentation.
Sprite Replacement is pretty much identical to Texture Replacement:
<opengl>
<texture coll="1" bitmap="5" normal_image="Images/Weapons/Big_Gun.png"
normal_mask="Images/Weapons/Big_Gun.png"
opac_type="1"/>
</opengl>
Unfortunately, the interface (HUD) collection is currently not compatible with this script. (Dammit...)
I've seen examples where the fog script was put in a map's level-specific script within the <marathon_levels> tags. This didn't work when I tried it, but here is the script that does work:
<opengl>
<fog on="true" depth="4">
<color red=".3" green=".3" blue=".3"/>
</fog>
</opengl>
"True" enables fog; "false" disables it. If the fog is disabled, you don't need to specify the colour. The depth is quite important; 1 will give you very thick fog in which you can only see about 1 WU in front of you (ergo the number '1' -?), whereas a higher number will lessen the fog's intensity.
Pfhortran can allow you to trigger the state of the fog, so its colour and intensity alters during gameplay. I wish I knew how to use Pfhortran...