Life Script Quick Start



Disclaimer
Revision
Quick start
Help on functions
Editing a program
Compiliing a program

FAQ:
What are scripts?
What are intercepts?
What do I need to write scripts?
What do I need to compile scripts?
Can I convert scripts from .dat to .scr?
Where do I link scripts to their actors?
What is the size limit of a script file?
Do scripts work in multiplayer as well?
How can I add scripts to my mod?
Will Entron be released with all the script code?
About the code...
 
 

Disclaimer:
This program is distributed "as is." The author and the publisher will not held responsible for any incidental     damages caused to your computer by running this program. The program is distributed with no warranties and the author is not responsible for any technical support. The user must understand these terms before running Life.exe.

Life Script Compiler
Written and Compiled by Nawfel 'Topaz' Tricha
(c) 1999 Endor Productions. All rights are reserved.
Revision .1.8
The current revision is slightly different from the one we are using over here at Endor. The Endor version makes code 1/2 the size of the demo version and has about 70 more functions.
 

Quick Start:
    Start Life.EXE
    Action->Environment...
    Set your quake2 dir and your parameters
    Set Game to "Entron"
    Set Map to "eda"
    Set your Save Dir to your "~Quake2\entron\scripts\"
    Set your Load Dir to the directory where your scripts files (*.scr) are saved
    Set .SCR Editor to "notepad.exe" or if you have a better editor like notetab, you can select that too.
    Play Compile Error Sound will play the error sound if the file doesn't compile; otherwise, you will get a pop-up screen.

To see the help on all the functions:
Help->Command List
Click on the command list several times to scroll down one screen.

To edit a program:
File->Open and then open the .SCR file

To compile a program:
File->Compile and then the .SCR file
or compile <filename>
Compiling a .SCR file will save a .dat file in your Save directory, which should be set to ~quake2\entron\scripts for this demo.

What are scripts?
Scripts are sets of functions that are executed by a certain actor (entity) in the game. A script doesn't have any conditional
statement such as if (x == 3) goto suchandsuch; however, it has intercepts. Scripts can also contain  loops with the goto
statement.

What are intercepts?
Intercepts are conditional functions that trigger parts of the script if all the conditions in their parameters are true. The most
common intercepts are on_touch, on_see, on_pain, and on_block. These intercepts can be changed in real-time from the DLL
as long as they are put in the script in a coherent way. The script contains stacked loops, which means, an intercept could call
a loop, and once that loop is done, the execution goes back to where the intercept left the original loop.

What do I need to write scripts?
All you need to write scripts is a text editor. The script file should have the extension .scr. Once you save the script, you can
load the file from LifeScript and it will compile it into compressed binary instruction opcode as a .dat file.

How fast are scripts?
Scripts are very very fast. They can execute more than one instruction per frame per script. Which is as fast a DLL code itself. You can slow down your instructions using the wait command.

Can I convert scripts from .dat to .scr?
Yes it is possible, although tedious since optimization backtracking is in question, but I reserve the right not to include that function in LifeScript. If you want a script .dat source code, just ask me.

Where do I link scripts to their actors?
In a map editor, put the script file path (rooted at Quake2) and filename in the field scriptfile. That's all there is to it.

What is the size limit of a script file?
There is no size limit, you can have 1 meg .dat scripts which practically will reflect the characteristics of a human's 9 to 5 day of
work.

Do scripts work in multiplayer as well?
Sure they do. In fact, they work so well, you could have all the TF goodies hooked in one mod. You could have several programs running and several objectives on the same map. The EDA demo only showed the smallest part of the script code power.

How can I add scripts to my mod?
Unfortunately, the script code will not be available to mod authors as it is still undergoing legal issues. Professional developers can contact Endor Productions for more info on liscencing the interpreter. The EDA demo DLL is only 200k and it has all of the script code in it. It's is small efficient and fast.

Will Entron be released with all of the script code?
Entron will be released with the source code to everything in it. DLL, scripts, NNE, and AI code. The script interpreter will be stand alone and cannot be released, although .OBJ files will be available.

About the code:
All instructions should be in lower case. All instructions are ended with a semicolon (;) just like in C. All commands, labels,
strings and targetnames cannot have numeric characters. Unless they are quoted strings like in filename. You can also have
comment delimiters as in C++ (//). Anything that comes after the "//" will not be looked up by the compiler.
 



Here is a sample code of the booth guy in the Entron Death Match Arena demo, but first, you will need to know what the intercepts are in the code:
 
Intercept - DLL Call
Caller Listener
Blue Warrior Killed by Centurion
Blue Warrior
Booth Guy
Red Warrior Killed by Centurion
Red Warrior
Booth Guy
Murder
Client
Booth Guy
Red/Blue Warrior Wins
Referee
Booth Guy
Red Grenade Shower
Red
Referee
Blue Grenade Shower
Blue
Referee
Bribe Action
Client
Referee
Static Intercept Table for EDA demo.


Actor
 Script
 Control
Cameras None Referee - Client - BoothGuy
Referee
 referee2.dat
 referee2.dat
BoothGuy
 booth2.dat
 booth2.dat
BlueWarrior
 None
 DLL - Referee - BoothGuy 
RedWarrior
 None
 DLL - Referee - BoothGuy 
Client
 N/A
 DLL - Human
Killer
 None
 Referee
Assassin
None
DLL - BoothGuy
Exterminator
None
DLL - Referee
RedDoor None Referee
BlueDoor None Referee
ExtWall None Referee
ExtLight None Referee
Lights None Referee
Actors Table for EDA demo.


        // (c) 1998 Endor Productions. All rights reserved.
        // http://www.endorproductions.com/
        // Written by Nawfel Tricha.
        // Email: Topaz@endorproductions.com
        // Technical demonstration source code.
        // Please use LifeScript compiler 1.01 or above. (with updated intercepts)
        // You can download LifeScript from /mission/Life.EXE.
        // The current version of LifeScript on /Code/LifeScript/Program/Life.EXE is incompatible and will give you errors.
        // 12/19/98

        // BOOTHGUY SCRIPT (Third Revision)

        // DESCRIPTION: This is the script for the booth guy.
        // The booth guy will take care of the arena equipment. He will make sure the lights are off and the announcer
        // introduces the warriors, etc.
        // The boothguy script has 3 major parts:
        // First part:
        //  In the first part the booth guy controls the cameras and the announcer sound.
        // Second part (Loops):
        //  The second part is triggered a bit later when the booth guy will be occupied in the booth room acting
        //  like if he is preoccupied working on frontend.
        // Third part: (Intercept)
        //  The third part of the code will deal with blue/red warrior death. When a warrior dies, they will call the
        //  boothguy through an intercept, which in turn, calls the referee to ask him to stop controlling the cameras
        //  and let access to the boothguy. The boothguy turns the camera foxus to the dead guy, then the
        //  level is reloaded with "load_map(.self);" after a few seconds.
 

        // Code start below.
            wait(2);

        // Camera 8, fade slowly. For black screen.
            camera(8, .0001);

        // Play the announcer sound.
            say("demo/ann01.wav", 1, attn_none);
            wait(5);

        // Camera 1, fade normal.
            camera(21, .01);

        // Put the Scope Vision. Remove "script;" if you want normal vision.
            script;
            wait(1);

        // Game intercepts:
            on_use(bluewarrior, bluedied);
            on_use(redwarrior, reddied);
            on_use(.client, murder);
            on_use(referee, kill_wins);

        // Just loop back and fourth going in and out of the booth room.
        label@loop_start;
        // Go to the booth door:
            walk(boothdoor);
            stand;
            wait(2);
        // Go to the computer:
            walk(boothcomputer);
            stand;
            wait(2);
            rotate(<0, 270, 0>);
            wait(1);
        // Look at the ceiling and fiddle around:
            action(1);
            wait(3);
            stand;
            goto(loop_start);

        // When the blue warrior dies, he calls the boothguy in the code below defined by on_use;
        //
        //   BLUE IS DEAD
        //
            label@bluedied;
            use(referee, .self);
            wait(.3);
            use(referee, bluewarrior);
            stop;

        // When the red warrior dies, he calls the boothguy in the code below defined by on_use;
        //
        //   RED IS DEAD BABY, RED IS DEAD
        //
            label@reddied;
            use(referee, .self);
            wait(.3);
            use(referee, redwarrior);
            stop;

        // Murder Scene:
        label@murder;
        // Suspend cameras (see referee intercept for use by killer in referee.scr):
            use(referee, killer);
        // Bring the boohtguy and to his computer:
            run (boothcomputer);
            stand;
        // Bring the killer to the booth window:
            camera(13, .3);
            run_slave(killer, boothwindow);
            action_slave(killer, 1);
            look_at_slave(killer, boothguy);
        // "Hey, you are not allowed to be here!"
            look_at(killer);
            say("demo/bguy-1.wav", 1, attn_norm);
            action(6);
            wait(2);
        // "You better shut up and pray"
            action_slave(killer, 12);
            say_slave(killer, "demo/war-3.wav", 1);
            wait(2);
        // "Please, don't shoot...!"
            action(2);
            say("demo/bguy-2.wav", 1, attn_norm);
            wait(2);
            stand;
            wait(1);
        // "Don't worry, you won't feel a thing!"
            say_slave(killer, "demo/war-4.wav", 1);
            wait(4);
        // Killer shoots boothguy and kills him:
            say("demo/bguy-3.wav", 1, attn_norm);
            use(killer, .self);
            wait(5);
            run_slave(killer, boothdoor);
            load_map(.self);

        // Do nothing when dead:
            label@loop_dead;
            listen;
            wait(3000);
            goto(loop_dead);

        // Called from referee to change from win announcement to exterminator kills:
        label@kill_wins;
            on_use(bluewarrior, bluekilled);
            on_use(redwarrior, redkilled);
            return;

        // Blue has been killed by the exterminator:
        //
        //   BLUE IS DEAD
        //
        label@bluekilled;
            use(referee, .self);
            wait(2);
        // Control the dead camera from boothguy now:
            rotate_camera(extermintator, 60);
            wait(7);
        // Restart the level or any other level; "load_map(base2);" can work for example.
            load_map(.self);

        // Red has been killed by the exterminator:
        //
        //   RED IS DEAD BABY, RED IS DEAD
        //
        label@redkilled;
            use(referee, .self);
            wait(2);
        // Control the dead camera from boothguy now:
            rotate_camera(extermintator, 60);
            wait(7);
        // Restart the level or any other level; "load_map(base2);" can work for example.
            load_map(.self);
 


Written and compiled by Nawfel 'Topaz' Tricha.
LifeScript is a propriety of Endor productions. All rights of redistribution or modification are reserved.
(c) 1998-1999 Endor Productions. All rights reserved.

Minimal help will be given at the address below:
-Topaz@endorproductions.com