Skip to content

Sandbox

necro1895 edited this page Apr 18, 2017 · 10 revisions

Tables

There must be an empty line between the content and the table:

Tables Are Cool
col 3 is right-aligned $1600
col 2 is centered $12
zebra stripes are neat $1

Formulars

F1

Images

Blockquotes

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

Lists

Code Blocks

Sample C++ Code

glm::quat set_heading_pitch_roll( const double3& pos, const float3& hpr )
{
    double3 up = glm::normalize(pos);
 
    quat qu = glm::to_quat(glm::make_quat_zy_align_up(double3(0,0,1), up));
    float3 xup = qu * float3(0,1,0);

    //qu = tangential facing north

    quat qh = glm::make_quat(-hpr.x, xup) * qu;
    float3 xwest = qh * float3(-1,0,0);

    quat qp = glm::make_quat(-hpr.y, xwest) * qh;
    float3 xfwd = qp * float3(0,0,-1);

    quat qr = glm::make_quat(-hpr.z, xfwd) * qp;

    return qr;
}

Simple Panorama Script

var $con;  
var fov         = 90.0;
var range       = 360.0;
var steps       = range / fov; 
var dRad        = fov / range * Math.PI * 2;
var hpr         = $con.get_hpr();
var latlon      = $con.get_camera_angles();
var idx         = 0;
var name        = "panorama";
var extension   = ".png";

//=== Main method
function start(fov, range)
{
    if (idx == 0)
        $con.pause_time(true);

    $con.capture_screen(name + pad(idx,3) + extension);
    $con.set_camera_angles(latlon.lon, latlon.lat, {"x":hpr.x + idx * dRad, "y": 0, "z": 0}); 
    idx++;
    
    if (idx > steps + 2)
    {
        $con.set_camera_angles(latlon.lon, latlon.lat, hpr);
        $con.pause_time(false);
        $con.stop();
    }
}

//=== Pads number values to a certain length with '0'
function pad(value, length) 
{
    return (value.toString().length < length) ? pad("0"+value, length):value;
}

Simple Screenshot Script

The following script shows how to load and execute scripts in outerra. This simple script takes screen captures each ingame minute and saves it at C:\Users\<user>\Outerra\screenshots

var $con;                                   //Initializing the console object	
var timeDay = $con.get_time();              //Store current timestamp
var fname = "capture_";                     //Prefix of file
var fext = "";                              //File extension (jpg if empty)
var fpd = 24 * 60;                          //Frames per day -> defines how many steps the job will have
var msPerDay = 1000 * 60 * 60 * 24 * 1.0;   //Number of miliseconds per day
var step = msPerDay / fpd * 1.0;            //Number of miliseconds per step
var counter = 0;                            //Loop counter which will be used for naming the file

//=== Main method, start the capture process and shifts the time of day
function start()
{
    //=== Pausing the game if start() was called the first time
    if (counter == 0)
        $con.pause_time(true);
	
    $con.set_time(timeDay.tday + step * counter, timeDay.dyear);    //Shifts the datetime 
    $con.capture_screen(fname + pad(counter, 6) + fext);            //Takes the screenshot
    counter++;
    fpd--;

    //=== Stop the invocation after fpd times through start()
    if (fpd == 0)
    {
        $con.pause_time(false);                     //Unpauses the game
        $con.stop();                                //Stops the invocation, so start() wont be called any more
        $con.set_time(timeDay.tday, timeDay.dyear); //Resets the time to the timestamp when the script was loaded
    }
}

//=== Pads number values to a certain length with '0'
function pad(value, length) 
{
    return (value.toString().length < length) ? pad("0"+value, length):value;
}
$con.set_camera_angles(camangles.lon, camangles.lat, {"x":a.x + 3.1415 * 8/4, "y": a.y, "z":a.z}); $con.capture_screen("angles008.png");```