-
Posts
912 -
Joined
-
Last visited
Content Type
Forums
Blogs
Knowledge Base
Everything posted by Xiija
-
just curious, why does 4 minus 0 = -4? lol i would have thought you would need to do integer RndX = -4 + (integer) llFrand(9.0);
-
nice, @Wandering Soulstar .. it didn't work for me tho hmmm another way would be... if ( (llDetectedLinkNumber(0) == 0) || (llDetectedLinkNumber(0) == 1 && llGetNumberOfPrims() > 1) ) { // do your thang }
-
it would look something like this, but this doesnt f**cking work string inventory; string object; vector relativePosOffset = <1.0, 0.0, 0.2>; vector relativeVel = <0.0, 0.0, 0.0>; rotation relativeRot = <0.707107, 0.0, 0.0, 0.707107>; integer startParam = 0; float scanDistance = 2.0; float SCAN_INTERVAL = 5.0; integer items_contained; string name; integer rezcount; string objname; integer CountItems() { return items_contained = llGetInventoryNumber( INVENTORY_ALL ); // --items_contained; } SayCount() { name = llGetObjectName(); llSetText(name + "\n" + "Has " + (string)items_contained + " items.", <0.0,1.0,0.0>, 1 ); } rezzit() { object = llGetInventoryName(INVENTORY_OBJECT,0); //get name of the 1st object in inventory vector myPos = llGetPos(); rotation myRot = llGetRot(); vector rezPos = myPos+relativePosOffset*myRot; vector rezVel = relativeVel*myRot; rotation rezRot = relativeRot*myRot; llRezObject(object, rezPos, rezVel, rezRot, startParam); //rez the 1st object ++rezcount; llOwnerSay("rezcount: " + (string)rezcount +"\nObj: " + object ); } default { touch_start(integer count) { rezzit(); } object_rez(key id) // as soon as something is rez'd , turn on sensor { if( rezcount == 1) { objname = object; } else { objname = object + " 1"; } llOwnerSay("Sensor for:..." + objname ); llSensorRepeat( objname , "" , (PASSIVE|SCRIPTED), 10.0, PI, 10.0 ); } sensor( integer detected ) { while(detected--) { llOwnerSay(llDetectedName(detected)); } } no_sensor() // when item is taken, if any are left in inv, rez another { if( CountItems() ) rezzit(); } }
-
something like... list liked = ["one", "Two", "three"]; default { state_entry() { llListen(10, "","", ""); } listen( integer channel, string name, key id, string message ) { if(message) { if (!~llListFindList(liked,[message])) { llOwnerSay("adding *" + message + "* to list..."); liked += message; } else { llOwnerSay("already on list..."); } } } }
-
If it is dedicated, and you don't need to worry about sim resets etc, you could just get the base prim's key and use pursue? ReturnHome() { llPursue(BASE_PRIM_KEY_HERE, [PURSUIT_OFFSET, <-1.0, -1.0, 0.0>, PURSUIT_FUZZ_FACTOR, 0.2]); }
-
may help? http://wiki.secondlife.com/wiki/CatEncryption
-
sounds something like.... HUD sends a "ping" with llRegionSay ( or llWhisper() = 10m, llSay() = 20m, llShout() = 100m?) on a timer. avi has the response object on, and it is listening on the same channel as the "ping'. object reads its NC and sends a reply back to the HUD ? HUD adds avi to a list so that it doesn't spam the owner.
-
You may need to mess with it a bit...... integer count; integer flag; default { state_entry() { llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS); } run_time_permissions(integer perm) { if(PERMISSION_TAKE_CONTROLS & perm) { llTakeControls( CONTROL_FWD | CONTROL_BACK | CONTROL_LEFT | CONTROL_RIGHT | CONTROL_ROT_LEFT | CONTROL_ROT_RIGHT | CONTROL_UP | CONTROL_DOWN | CONTROL_LBUTTON | CONTROL_ML_LBUTTON , TRUE, TRUE); } } control(key id, integer level, integer edge) { integer start = level & edge; integer end = ~level & edge; integer held = level & ~edge; integer untouched = ~(level | edge); if (held & CONTROL_DOWN) { if( flag == 0 ) { flag = 1; llSetTimerEvent( 0.5); } } if( end ) { llOwnerSay("end"); llSetTimerEvent( 0.0); count = 0; flag = 0; } } timer() { llSetTimerEvent( 1.0); ++count; llOwnerSay( (string)count); } }
-
i have an old unpacker that is free / open source.. dunno if lookin at the code will help ya... https://marketplace.secondlife.com/p/XMODS-Unpacker-Box-v-20/5872695
-
http://wiki.secondlife.com/wiki/LSL_Operators || .... && ....
-
example: string msg = "Get your bacon while it's hot!"; default { state_entry() { } touch_start(integer total_number) { list avatarsInRegion = llGetAgentList(AGENT_LIST_REGION, []); integer numOfAvatars = llGetListLength(avatarsInRegion); if (!numOfAvatars) { llOwnerSay("No avatars found within the region!"); return; } integer index; while (index < numOfAvatars) { key id = llList2Key(avatarsInRegion, index); llRegionSayTo(id, 0, "\nMessage of the Day: \n \n" + msg); string name = llKey2Name(id); // llOwnerSay("\n" + name + " [ " + (string)id + " ]"); // for debug? ++index; } } } or you could use a textbox for input
-
an example you can test with... integer count = 1; integer prims; default { state_entry() { } on_rez(integer param) { llSetLinkAlpha(LINK_SET, 0.0,ALL_SIDES); prims = llGetNumberOfPrims(); llSetTimerEvent( 0.5); } timer() { llSetLinkAlpha(count, 1.0,ALL_SIDES); count++; if( count == prims) { llSetTimerEvent( 0.0 ); } llSetTimerEvent(2.0 ); } }
-
You can prettify your code here... https://beautifier.io/ //* script_starts_here // integer run; vector COLOR_RED = < 1.0, 0.0, 0.0 > ; vector COLOR_BLUE = < 0.0, 0.0, 1.0 > ; integer x; default { touch_start(integer total_number) { if (llDetectedKey(0) == llGetOwner()) { if (run) { run = FALSE; llStopSound(); llSetLinkPrimitiveParamsFast(llGetLinkNumber(), [PRIM_GLOW, ALL_SIDES, FALSE, PRIM_POINT_LIGHT, FALSE, ZERO_VECTOR // COLOR , 0.0 // INTENSITY , 0.0 // RADIUS , 1 // FALLOFF ]); } else { run = TRUE; llLoopSound("Siren", 1.0); llSetTimerEvent(0.2); } } } timer() { x = !x; // ***** added varible X to toggle between blinks ***** if(x) { llSetLinkPrimitiveParamsFast(llGetLinkNumber(), [PRIM_GLOW, ALL_SIDES, 1, PRIM_POINT_LIGHT, TRUE, COLOR_RED // START COLOR , 1.0 // START INTENSITY , 10.0 // START RADIUS , 0.2 // START FALLOFF ]); } else { llSetLinkPrimitiveParamsFast(llGetLinkNumber(), [PRIM_GLOW, ALL_SIDES, 1, PRIM_POINT_LIGHT, TRUE, COLOR_BLUE // END COLOR , 1.0 // END INTENSITY , 10.0 // END RADIUS , 0.2 // END FALLOFF ]); } } } //* script_ends_here
-
:;see Innula's comments on how to fix your code:: to close on its own... llSetRot(llGetRot()*rot_xyzq); //Do the OPEN Rotation.. rot_xyzq = (ZERO_ROTATION / rot_xyzq); // reverse the rotation llSleep(3.0); llSetRot(llGetRot()*rot_xyzq); //Do the CLOSE Rotation.. to close by touch...define the closed rotation somewhere... rotation closed = llGetRot(); then in your touch event.. llSetRot( closed); ... or something like that?
-
moving child prim in relation to a rotated root
Xiija replied to VirtualKitten's topic in LSL Scripting
dunno if this helps but, do you need to change the origin point of your mesh? https://blender.stackexchange.com/questions/1291/change-pivot-or-local-origin-of-an-object https://lmhpoly.com/blender-tutorial-origin-point/ -
here is a small example to play with? If your lights are named with the convention: light, sw1 light,sw2 and your switches are named sw1 sw2 you could do something like... list lights; integer k; getLights() { integer prims=llGetNumberOfPrims(); integer x; for(x = 2; x <= prims;++x) { string lName = llGetLinkName(x); list tmp = llParseString2List(lName,[" " , ","],[" "]); string name = llList2String(tmp,0); string switch = llList2String(tmp,1); if ( name == "light") { lights += x; // store link number of the light lights += switch; // store the switch name which operates this light } } } doLights( integer linkNum , string linkName ) { if( ~llListFindList( lights, [linkName]) ) { integer index = llListFindList( lights, [linkName]); string lite = llList2String( lights, index - 1) ; llSetLinkPrimitiveParamsFast( (integer)lite, [PRIM_POINT_LIGHT, ( k = !k), <1,1,1>, 1.0, 4.0, 0.0]); } } default { state_entry() { getLights(); } touch_start(integer total_number) { integer link = llDetectedLinkNumber(0); list params = llGetLinkPrimitiveParams( link, [PRIM_NAME]); string linkName = llList2String(params,0); doLights( link, linkName ); } } Although using the integer .. k .. as a toggle might need some changing heh
-
integer g_chan = 0x80000000 | (integer)("0x"+(string)llGetOwner()) ; integer offset; if( offset = (integer)llGetObjectDesc() * -1 ) { g_chan += offset; } ... or, you could hard code offsets for your projects, and keep a notecard with all the offsets for each build you have made to avoid crosstalk between scripts.
-
the VICE SDK is here... VICE SDK mebbe the test target .lsl is close?
-
Need help with adding on/off on touch to this script please
Xiija replied to Jeweliette Darkfold's topic in LSL Scripting
Try formatting your code mebbe?.. it helps you see errors more clearly. an online site that may work is ... http://jsbeautifier.org/ // touch to toggle particle on/off integer isOn = 1; startParticle() { llParticleSystem ([ PSYS_PART_FLAGS, (0 | PSYS_PART_WIND_MASK | PSYS_PART_FOLLOW_VELOCITY_MASK), PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE, PSYS_PART_START_ALPHA, 1, PSYS_PART_END_ALPHA, 1, PSYS_PART_START_COLOR, < 1, 1, 1 > , PSYS_PART_END_COLOR, < 1, 1, 1 > , PSYS_PART_START_SCALE, < 4, 4, 0 > , PSYS_PART_END_SCALE, < 4, 4, 0 > , PSYS_PART_MAX_AGE, 5, PSYS_SRC_MAX_AGE, 0, PSYS_SRC_ACCEL, < 0, 0, -5 > , PSYS_SRC_BURST_PART_COUNT, 2, PSYS_SRC_BURST_RADIUS, 15, PSYS_SRC_BURST_RATE, 0.01, PSYS_SRC_BURST_SPEED_MIN, 0, PSYS_SRC_BURST_SPEED_MAX, 0, PSYS_SRC_ANGLE_BEGIN, 1, PSYS_SRC_ANGLE_END, 1, PSYS_SRC_OMEGA, < 0, 0, 0 > , PSYS_SRC_TEXTURE, (key) "6918812d-8e7f-b347-4732-456e7918624b", PSYS_SRC_TARGET_KEY, (key) "00000000-0000-0000-0000-000000000000" ]); } default { state_entry() { startParticle(); isOn = 1; } touch_start(integer num_detected) { if (isOn == 1) { llParticleSystem([]); isOn = 0; } else { startParticle(); isOn = 1; } } } -
just for the heck... vector scale; default { state_entry() { scale = llGetScale(); } touch_start(integer total_number) { llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_POS_LOCAL,llGetLocalPos()+< 0,(scale.y = -scale.y ),0>]); } }
-
You could use a list mebbe? Example code: list touches; integer face; default { state_entry() { integer numOfSides = llGetNumberOfSides(); integer x; for( ; x < numOfSides ; ++x) { touches += x; touches += (integer)0; } llOwnerSay("list is: \n" + llDumpList2String( touches, " , ") ); } touch_start(integer total_number) { face = llDetectedTouchFace(0); integer index; if( ~( index = llListFindList( touches, [face]) ) ) { integer check = llList2Integer( touches, index + 1); ++check; if( check > 10){ check = 1; } touches = llListReplaceList(touches, [(integer)check], index + 1, index + 1); llOwnerSay("list is: \n" + llDumpList2String( touches, " , ") ); } } }
-
I dunno about MOAP, i did it with prim textures using Tyche's code as a base. anyhoo, rez a prim, shrink to HUD size, add this script and add /wear ? /* Example script to apply a Region Map as a texture on a Prim Author: Tyche Shepherd Date: 2010-02-11 Copyright: Tyche Shepherd 2008-2010 License: Creative Commons Attribution 2.0 UK:England & Wales License Basically you can do anything with this script including making derivative commercial works as long as you credit Tyche Shepherd and gridsurvey.com . This credit should be distributed with any product. See http://www.gridsurvey.com/api.php for more details on this license as well as any caveats. The script sets up a listen when the container prim is touched. The user then speaks the name of the desired region on the channel (default is channel 87) A llHTTPRequest is sent to http://api.gridsurvey.com which returns the UUID of that Region's Map if it's found. The Container Prim's texture is then changed to this UUID The Listen times out after 10 seconds. The gridsurvey.com Region Database is normally updated on a daily basis with the latest Region Maps. */ getmap() { query_string="region=" + llEscapeURL(region) + "&item=objects_uuid"; //send the request to api.gridsurvey.com requestID = llHTTPRequest("http://api.gridsurvey.com/simquery.php", [ HTTP_METHOD, "POST", HTTP_MIMETYPE,"application/x-www-form-urlencoded" ], query_string); } mapview() { myPos = llGetPos(); poz = < (myPos.x/256) - 0.5, (myPos.y/256) - 0.5 ,0.0>; // map repeats are from -0.5 to 0.5 set = poz ; llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_TEXTURE, //set texture face, //on detected touch face map, //use this texture uuid <0.35,0.35,0.0>, //texture repeat set, // 0.0]); } key requestID; string query_string; string region; integer k; integer face = 4; string map; vector set ; vector myPos; vector poz; default { on_rez( integer param) { llResetScript(); } state_entry() { region = llGetRegionName(); getmap(); if(llGetAttached()) llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS); llSetTimerEvent(0.05); } http_response(key req_id, integer status, list meta, string body) { if (req_id == requestID) { if(llGetSubString(body, 0, 4)=="Error") { //the api returned an error so report it llSay(0, "errr \n" + body); } body = llStringTrim( body, STRING_TRIM); map = body; llSetLinkTexture(LINK_THIS,body, ALL_SIDES); } } // NO SCRIPT AREA HACK attach(key k) { if(k) llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS); } run_time_permissions(integer p) { if (p & PERMISSION_TAKE_CONTROLS) llTakeControls(CONTROL_FWD, TRUE, TRUE); } control(key k, integer l, integer e) {} // NO SCRIPT AREA HACK timer() { mapview(); } changed(integer change) { if (change & CHANGED_REGION) { llOwnerSay("Updating Region data..."); region = llGetRegionName(); getmap(); } } }
-