New engine features |
Top Previous Next |
sys_setstr, sys_getstr, sys_setvar, sys_getvar
These new instructions allow us to write and read strings and numerical values (variables) to the registry.
sys_setstr("Software\\MyGreatGame", "ToughPasswords", "1234");
region_get
This instruction returns the size of the specified region.
VECTOR region_min, region_max;
function region_startup() { wait (-5); // wait until the level is loaded region_get("reg_000", 1, region_min, region_max); // make sure to use your own region name }
PANEL* time_pan = { layer = 15; digits(10, 10, "Minimum region coordinate on the x axis: %.f", *, 1, region_min.x); digits(10, 30, "Minimum region coordinate on the y axis: %.f", *, 1, region_min.y); digits(10, 50, "Minimum region coordinate on the z axis: %.f", *, 1, region_min.z); digits(10, 80, "Maximum region coordinate on the x axis: %.f", *, 1, region_max.x); digits(10, 100, "Maximum region coordinate on the y axis: %.f", *, 1, region_max.y); digits(10, 120, "Maximum region coordinate on the z axis: %.f", *, 1, region_max.z); flags = SHOW; }
str_trim
Removes the spaces at the beginning and at the end of a string.
#include <strio.c> // need to include this because the str_trim function is included inside it
var size_before, size_after;
STRING* test_str = " 3 spaces at the beginning and 2 at the end ";
function trim_startup() { wait (-5); // wait until the level is loaded size_before = str_len(test_str); str_trim(test_str); // remove the useless spaces size_after = str_len(test_str); }
PANEL* time_pan = { layer = 15; digits(10, 10, "Number of characters before trimming: %.f", *, 1, size_before); digits(10, 30, "Number of characters after trimming: %.f", *, 1, size_after); flags = SHOW; }
|