ZetaWorlds Custom Script Functions

Index
  1. Preface LL-Delay
  2. OSSL Sound Functions Linkset
  3. osDetectedGroup osGroupKey2Name
  4. osGetAgentUserLevel
  5. osGetSimulatorCPUUsage
  6. osLoadURL
  7. osMakeScript
  8. osSetParcelDetails
  9. osStringStartsWith osStringEndsWith
  10. llDialog Groups
  11. osDateTime
  12. osPrimParticleSystem osPrimLinkParticleSystem osPrimLinkSetTextureAnim osPrimSetTextureAnim
  13. osGetRegionName
  14. osGetRegionSize
  15. osGetRegionCorner
  16. osTeleportAgent coordinates
  17. OS_NPC_ANNOUNCE NPC_CHANNEL constants
  18. osSendAlertModals

Important Information
ZetaWorlds custom script functions are not always available as some functions are more dangerous when not used correctly they require special permissions to be granted before use.
Functions not available will throw an OSSL permissions error and require the script to be reset manually, keep this in mind.
To request a function please submit a ticket.

  Preface LL-Delay

In the interest of maintaining overall performance and creating more predictable behavior all normal LSL functions, those starting with ll, are setup with specific delays to each function. This delay allows the function to run and complete without another function overlapping or calls being dropped when too much is executed at once. These limits were set a long time ago and since then a lot has changed and performance is now less an issue. We still maintain these delays however, as some functions can drop calls. In some cases reducing the delays can yield more flexibility when creating scripts, but some functions remain barely able to execute even with the delay intact. Changing or even removing a limit has been made possible by making all the hardcoded limits configurable and so can now be changed if required. With the strict advice that this creates uncharted territory and can have detrimental results, it is possible to change a functions delay upon request.

  OSSL Sound Functions Linkset

OSSL features a set of functions not too different from the basic LSL sound functions, with the big difference that these new functions offer support for linksets aka multiple prims. This means it is possible to remotely start a sound in a different linked prim or stop all sounds in all prims at once.

Functions that support this are:

osLoopSound
osPlaySound
osStopSound
osLoopSoundMaster
osLoopSoundSlave
osTriggerSound
osTriggerSoundLimited
osPreloadSound
osAdjustSoundVolume
osSetSoundRadius

Usage of the constants LINK_SET, LINK_THIS, LINK_ALL_OTHERS as well as direct link numbers for the first parameter of these functions is now possible.

  osDetectedGroup osGroupKey2Name

Similarly to llDetectedKey and llKey2Name these functions offer the ability to detect the group of an actor, prim or avatar, when events are called.
Resolving the returned group key or any group key back to its name.


osDetectedGroup(integer detected)
osGroupKey2Name(key group_key)

  osGetAgentUserLevel

OpenSim has user levels that usually define certain admin powers. Level 200-250 is usually set for grid admins, while normal users are of level 0. With this function the user level of a user can be fetched.

osGetAgentUserLevel(key avatar_key)

  osGetSimulatorCPUUsage

Functions for returning the memory usage of a given simulator already exist, but there was previously no function to return the other important metric, CPU usage. This function adds the ability to call for a count of CPU resources.
The function causes a point to be set internally after which the CPU usage is recorded. After a delay a second point is set and the recorded CPU usage is averaged. Recording multiple CPU resource points is required due to CPU usage being in flux constantly and any shorter timing would result in inaccurate results.
Note: Running this function takes 5000ms(5 seconds) to execute during which the script does not continue running!
Note: Due to the heavy nature of this function it is not enabled for everyone and can only be used by the owner of a simulator!

osGetSimulatorCPUUsage()

  osLoadURL

Functionally the same as llLoadURL with the difference that no ownership check is performed allowing group owned objects to call this function.

  osMakeScript

OSSL features a way to generate notecards inside prim inventory, but no function to create scripts. Using normal LSL scripts can be copied, moved across linksets and even started remotely, but creating scripts is not possible. With this function a script can be created from a string, it is placed inside the prim inventory, but not started. Start can be achieved as usual using Script Pin functionality.
Note: Due to this function causing a massive security risk and potential for asset data corruption it is disabled by default!

osMakeScript(string ScriptName, string ScriptContents)

  osSetParcelDetails

Nothing changed with the function itself, simply missing constants for: PARCEL_DETAILS_ALLOW_PUBLISH and PARCEL_FOR_SALE were added.

  osStringStartsWith osStringEndsWith

As the name suggests these functions can analyze a string through a substring either at the end of beginning of the provided string. Returns true or false depending on whether the string is found.

osStringStartsWith(string input, string startsWith)
osStringEndsWith(string input, string endsWith)

  llDialog Groups

Normally llDialog returns some funky data when called inside an object owned by a group. This was fixed to properly display the group name instead. This comes after a rather strange fix for this from OpenSim core team.

  osDateTime

Allows conversion of a unix epoch(time since 1.1.1970 in seconds) to a date format(dd.MM.yyyy hh-mm-ss). Most date formatting should be available as this function directly uses the C# date library.

osDateTime(string format, integer epoch)

  osPrimParticleSystem osPrimLinkParticleSystem osPrimLinkSetTextureAnim osPrimSetTextureAnim

Similar to their normal LSL counterparts with the addition of the first parameter allow entry of an object uuid as the target.

osPrimParticleSystem(key objectUUID, list rules)
osPrimLinkParticleSystem(key objectUUID, integer linknumber, list rules)
osPrimSetTextureAnim(key objectUUID, integer mode, integer face, integer sizex, integer sizey, float start, float length, float rate)
osPrimLinkSetTextureAnim(key objectUUID, integer linknumber, integer mode, integer face, integer sizex, integer sizey, float start, float length, float rate)

  osGetRegionName

Using the absolute grid coordinate system which is the regions southwest position multiplied by 256 e.g. 7000,7000 => 1792000,1792000 this function will return the region name that is occupied by this coordinate. Any coordinate the region occupies should work.

osGetRegionName(integer regionGridX, integer regionGridY)

  osGetRegionSize

Returns the size of any region if you know what it is called.

osGetRegionSize(string regionName)

  osGetRegionCorner

Returns the lower left or southwest corner of a given region. This is the coordinate the region is registered at whether it be a normal region or a var region.

osGetRegionCorner(string regionName)

  osTeleportAgent coordinates

Adding another option to osTeleportAgent to allow teleportation based on global grid coordinates rather than region coordinates. This means this function can now use the direct input from adding the local region corner for llGetRegionCorner and the returned vector from retrieving the inventory data of a landmark. Normally this function requires additional math to convert the global position to the actual coordinate the region is registered at, meaning the southwest corner of a var region for example. This math has been moved into the function itself thus input is easier to establish. It also does away with the need for the local position offset, which is normally a vector of the offset from the zero position on the region.

Example:


key tempkey;
default
{
    touch_start(integer touche)
    {
        llRequestInventoryData("Landmark name in inventory");
        tempkey = llDetectedKey(0);
    }
    dataserver(key id, string data)
    {
        vector newpos = (vector)data;
        vector curpos = llGetRegionCorner();
        integer nX = curpos.x + newpos.x;
        integer nY = curpos.y + newpos.y;
        integer nZ = curpos.z + newpos.z;
        osTeleportAgent(tempkey, nX, nY, nZ, <0,0,0>);
    }
}

It is also possible to add the vectors up directly and infer the positions using the vectors individual parts: e.g. combinedpos.X, combinedpos.Y ...

osTeleportAgent(key agent, integer regionGlobalX, integer regionGlobalY, integer regionGlobalZ, vector lookat)

  OS_NPC_ANNOUNCE NPC_CHANNEL constants

osNPCMoveToTarget has been extended with with the OS_NPC_ANNOUNCE constant for its options list. Supplying this constant causes the NPC to announce reaching the set target. It will shout its uuid as well as the position from the target and set target to the region chat, which can be listened to via the NPC_CHANNEL(channel -55365) in a normal listen event. Since NPCs do not trigger events back to the scripts that spawned them and adding that functionality would add significant overhead this is the best option to receive feedback of whether the NPC has reached its target or not.

  osSendAlertModal

Sends a modal to the specific avatar with a message and, depending on type, with either a button to dismiss(int type = 1) or automatic decay after a couple seconds(int type = 0).

osSendAlertModal(key avatar_key, string message, int type)