Skip to content

Instantly share code, notes, and snippets.

View sl-service-account's full-sized avatar

sl-service-account

  • Linden Lab
View GitHub Profile
integer gHasPerms = FALSE;
function printCameraInfo() {
float aspect = llGetCameraAspect();
float fov = llGetCameraFOV();
llOwnerSay("aspect = " + (string)aspect + " FOV = " + (string)fov);
}
default {
on_rez(integer a) {
string NOTECARD_NAME = "notecard";
key gLineCountId;
default {
state_entry() {
// Request number of notecard lines.
gLineCountId = llGetNumberOfNotecardLines(NOTECARD_NAME);
}
dataserver(key id, string data) {
@sl-service-account
sl-service-account / llcomputehash_demo.lsl
Created January 23, 2024 22:52
Demonstration of using the new llComputeHash method in LSL
default {
touch_start(integer count) {
string message = "your-test-message-here";
list algorithms = ["md5", "md5_sha1", "sha1", "sha224", "sha256", "sha384", "sha512"];
integer algorithmCount = llGetListLength(algorithms);
llOwnerSay("message='" + message + "'");
integer i = 0;
default {
state_entry() {
llSensorRepeat("", NULL_KEY, AGENT, 95, TWO_PI, 10);
}
sensor(integer count) {
integer i;
for (; i < count; ++i)
{
if (llIsFriend(llDetectedKey(i))) {
default {
touch_start(integer count) {
key id = llRezObjectWithParams("Rocket", [
REZ_FLAGS, REZ_FLAG_TEMP|REZ_FLAG_DIE_ON_COLLIDE|REZ_FLAG_BLOCK_GRAB_OBJECT|REZ_FLAG_DIE_ON_NOENTRY,
REZ_POS, <0.0, 0.0, 1.0>, TRUE, FALSE,
REZ_VEL, <10.0, 0.0, 0.0>, TRUE, FALSE,
REZ_SOUND_COLLIDE, "69d12eb6-3647-418a-b476-f7b883e0be15", 1.0
]);
}
}
@sl-service-account
sl-service-account / keybinding_uri.lsl
Created October 24, 2023 05:08
Second Life keybinding URI demonstration
default {
touch_start(integer num) {
llSay(0, "Use the following keys to " + "secondlife:///app/keybinding/push_forward");
}
}
default {
state_entry() {
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_CLICK_ACTION, CLICK_ACTION_NONE]);
}
}
@sl-service-account
sl-service-account / lsd_count_delete_found.lsl
Last active August 4, 2023 14:57
Count, delete multiple LSD values by pattern
default {
state_entry() {
// Add some LSD values starting with "foo" and some that don't
llLinksetDataWrite("foobar", "a");
llLinksetDataWrite("foobaz", "a");
llLinksetDataWrite("foobaa", "a");
llLinksetDataWrite("woofie", "100");
llLinksetDataWrite("fungus", "500");
integer fooCount = llLinksetDataCountFound("^foo");
@sl-service-account
sl-service-account / detect_animesh.lsl
Created August 3, 2023 22:21
Detect whether a prim is animesh
default {
state_entry() {
list params = llGetPrimitiveParams([PRIM_TYPE]);
integer primType = llList2Integer(params, 0);
// Figure out if prim is mesh or animesh
if (primType == PRIM_TYPE_SCULPT) {
integer sculptType = llList2Integer(params, 2);
if (sculptType & PRIM_SCULPT_FLAG_ANIMESH) {
llOwnerSay("I'm animesh!");
@sl-service-account
sl-service-account / detect_bot.lsl
Created June 13, 2023 21:06
Detect whether nearby agents are identified bots.
default {
state_entry() {
// Detect agents within a 96m radius
llSensorRepeat("", NULL_KEY, AGENT, 96.0, TWO_PI, 5.0);
}
sensor(integer count) {
// Check if detected agent(s) are bots
integer i;
for (; i < count; i++) {