User Tools

Site Tools


xg:colored_xg_sector_lighting_example

XG sector lighting examples

A XG sector type can be used to define different colored lights/tints within a sector.

About XG value functions

To begin with this will look somewhat complicated until you learn what the various symbols in a function script mean (these symbols and more are described in detail on the Sector Types page).

We suggest you start off with the simpler stuff (such as the Bright Green example further down) and then move on from there.

The basic concept is that all sector lighting effects are NOT static even if they appear to be. For example even a sector with a non-animated blue tint is infact animated but the user doesn't see this animation. From the engines point of view it is animating blue → blue → blue… all the user sees is blue.

The animation of the light is described using what is called a function - a series of symbols which are interpreted by the engine one by one like a script, except that only one symbol is interpreted per tic.

Bright green

This will give the sector a green tint which is defined within (Green fn). You can mix and match (Red, Green and Blue fn) for mixed colors and results.

   Sector Type {
     ID = 5010
     Comment = "Green sector light"
     Red fn = "a"
     Green fn = "z"
     Blue fn = "a"
   }

Red, slowly fading in/out

This creates a slow fading in/out red light (looped) in sectors with the 9006 special. The Blue function is linked directly to the Green function (Blue fn = “=g”) so it is the same as having written “a >az<” for the Blue function. Both Green fn min tics and Green fn max tics equal 35 meaning that it takes 35 tics (one second) to do a full cycle (from > to < in the function script) and that no random timing occurs.

   Sector Type { ID = 9006
     Comment = "Slow fading Red light"
     Green fn = "a >az<"
     Green fn min tics = 35
     Green fn max tics = 35
     Blue fn = "=g"
   }

Function script meaning ("a >az<")

Begin at a (0). Set the loop start postion >. Fade to a (0). Fade to z (255). Set the loop end position <. When the script reaches the end loop postion < it loops back to the start loop position >.

Slowly fading: blue → red → yellow

This creates a slow fading Blue to Red to Yellow (looped) light in sectors with the 9005 special. It takes 70 tics (two seconds) for each function script to do a full cycle and because the min max values are all the same no randomness occurs.

   Sector Type { ID = 9005
     Comment = "Slow fading Blue > Red > Yellow light"
     Red fn = "a >azz<"
     Red fn min tics = 70
     Red fn max tics = 70
     Green fn = "a >aaz<"
     Green fn min tics = 70
     Green fn max tics = 70
     Blue fn ="a >zaa<"
     Blue fn min tics = 70
     Blue fn max tics = 70
   }

Function script meaning ("a >azz<")

Begin at a (0). Set the loop start postion >. Fade to a (0). Fade to z (255). Fade to z (255). Set the loop end position <. When the script reaches the end loop postion < it loops back to the start loop position >.

Randomly flickering yellow light

   Sector Type { ID = 9004
     Comment = "Randomly Flickering Yellow light"
     Red fn = "a >tz?32A<"
     Red fn min tics = 70
     Red fn max tics = 70
     Green fn = "m >mz<"
     Green fn min tics = 70
     Green fn max tics = 70
     Blue fn = "=r"
   }

See also

xg/colored_xg_sector_lighting_example.txt · Last modified: 2017-03-22 07:10 by skyjake