sys_trial(STRING* section, STRING* name, var days)
Returns the number of days left on a demo version of the application.
This instruction can be used to create demo
applications that expire after some time, and can be unlocked by the user with
||Name of the registry section for storing the trial information
(e.g. "Software\\myGame"), STRING* or char*.
||Name of the registry key for storing the trial information,
STRING* or char*.
||Number of days for the trial period.
Trial days remaining, or < 0 when
the trial period is expired or an attempt was made to hack the registry.
- This function stores the date of its first execution in the registry,
as well as in saved games.
Further calls to this function will merely calculate the number of
days since the first execution.
- Editing the registry in order to extend the trial period is detected
and results in expiration of the trial period. The only method for
extending a trial period is changing the system date while still
in trial mode. Once the trial period is expired, it can't be renewed.
- One of the methods to detect registry hacking is storing additional
information in saved games. For this to work, it is recommended
to perform a game_load function
before calling sys_trial, for instance to load user settings.
Internet download services like Share-It can generate keys or passwords that can be read in the script. The script can then determine whether the key or password is correct, and skip sys_trial in that case. This way a trial version can be unlocked to a full version.
game_load("ini",0); // load user settings
if (!game_is_unlocked()) // call provider algorithm for checking the key or password
if (0 > sys_trial("Software\\myCompany\\myApp","install",30)) // 30 days trial period expired?
sys_exit("Sorry - trial version expired!");
// run game