Introduction to the Jinx 8 Environment
Before we can go into the new scripting methodology offered by Jinx 8, it is first important to know the differences between the Jinx 8 environment and the game script environment.
Script Identity
Jinx 8 scripts run at a higher identity than normal game scripts - while the
actual identity number(s) are mostly irrelevant to us (if you wish to know, as
of writing this documentation, Jinx 8 scripts run at identity 7 and normal
game scripts run at identity 2), it is more important to know what extra
privileges this gives Jinx 8 scripts over normal game scripts.
Unlike game scripts, Jinx 8 scripts have mostly (see below for exceptions) full access to the full game APIs without limitations. This means you can use certain functions not normally possible to use from either game scripts or even the command bar.
Some examples of extended functionality introduced by higher identity include:
-
Ability to use protected services like
VirtualUserServiceandCoreGui. (abiet there are far better alternatives for both we will introduce later) -
Ability to modify the 'protected' instance tree and properties.
-
Ability to use protected functions like the
UserSettingsAPIs orgame:GetObjects, commonly used to load external instances by Jinx 8 scripts.
While Jinx 8 tries to provide the most access as possible to scripts executed by it, some functions are deemed off limits and are not allowed to be called by Jinx 8 scripts. These functions include:
-
Functions that allow stealing from the Jinx 8 user who executed the script, or access to private information of the Jinx 8 user that should not be accessible from scripts.
-
Functions that have known security issues. (Ex: a function that has a known memory corruption vulnerability that could lead to arbitrary code execution on the user executing the script)
-
Functions that provide unrestricted authenticated HTTP request access, which allows the 1st point to occur. Jinx 8 provides facilities to allow unauthenticated web requests.
Jinx 8 Additions
Along with script identity, Jinx 8 also introduces many custom functions that
allow for enhanced functionality and access by Jinx 8 scripts. We will
introduce many of these functions to you later in this guide, but we will start
with a commonly used (and simple) one for Jinx 8 scripts: getgenv. Getgenv
allows you to get the 'global environment', a shared top-level environment
between Jinx 8 scripts. You can use this to set globals that will be used by
all Jinx 8 scripts. Do note that getgenv is not shared to game scripts -
you can instead use getrenv if you wish to do that.
An example is shown below for getgenv:
getgenv().test = 123
print(test) --> 123
Then, from another Jinx 8 script:
print(test) --> 123
As you can see, the value will stay within the globals table between each Jinx 8 script. You can add as many of these globals as you like.
Miscellaneous Changes
There are also many miscellaneous changes between Jinx 8 scripts and game scripts. These changes are listed below:
-
Jinx 8 scripts are not attached to a
scriptglobal. While Jinx 8 still provides ascriptglobal for each script, it is only provided for compatibility reasons and is deprecated for all future use. Setting theDisabledproperty on the Jinx 8scriptglobal will do nothing due to the Jinx 8 script not being connected to it. You should never touch this global in scripts you make. -
sharedand_G, two tables commonly used by game scripts are not connected to Jinx 8 scripts. Instead, Jinx 8 scripts have their ownsharedand_Gtables, likegetgenv. If you wish to access the game scriptsharedand_Gtables, usegetrenv()._Gand vice versa. Please note the considerations in the Jinx 8 security model if you wish to do this. -
Jinx 8 provides many internal protections against implicit environment leaks to game scripts. Please see the Jinx 8 security model for more information.
Now that you have a general idea of the Jinx 8 Environment, we can now move on to the major programming concept behind Jinx 8 - supervisor-based programming.