LSL Wiki Mirror : HowDoI

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings ::

How Do I...


...get a script to read from another file; IE: a notecard?

...give someone a folder full of inventory items?

...specify which folder I want the inventory items to end up in?
See llGiveInventoryList.

...make a gun?
See llRezObject and ExampleGun.

...find out if land is no-build/no-script, etc?
llGetParcelFlags and llGetRegionFlags

...get the length of a string?
See llStringLength.

...get the arc for a sensor that senses straight ahead?

....and also the arc for a sensor that scans around and above its task (but not underneath it) without changing the task's orientation?
(Specifically, when nobody's around to see a critter, I want to it to sleep to keep from lagging the server without making the critter look wrong from afar.)

....and also the arc for a sensor that scans straight below its task?
See llSensor. For a reduced arc, use a smaller value of radians for the arc parameter. To use the sensor in a different direction than east (forward), rotate the prim in that direction.

...make magical holes in walls that you can walk through?
See llSetPrimitiveParams. You can make holes in box prims by modifying its hollow under the Object tab in the Edit menu.
You can also use llSitTarget to jump through walls.

...make my script communications secure?
See Script security

...create a script that generates a random number?
integer rand(integer max)

{
    float f_max = (float)max;//we do this typecast explicitly (otherwise the compiler just fills it in for us.
    if(max != f_max)//max was an integer that couldn't be made into a float nicely.
        return (integer)(max * llFrand(1.0));//multiply max by a rand float with a 0->1 range.
    return (integer)llFrand(f_max);//the convert was clean so make LSL do the work.
}
This is a function that is called by: rand(50), which would return a random integer between 0 and 49 inclusive.

...make a script that changes the color of an item?
vector color = <1,0,0>; //The color you want the item to change when touched
default
{
    touch_start(integer total_number)
    {
        llSetLinkColor(LINK_SET, color, ALL_SIDES); //Sets the color on all the links
    }
}

...make an invisiprim...
See Invisiprim for an example script - Joker Opus

... get the direction an agent is facing (Not the direction of the head) ...

... have object A tell object B its position and rotation, and have object B replicate the positioning and rotation, aside from a small offset on the local Z axis ...
Get position with llGetPos rotation with llGetRot, cast them to strings, use llSay to communicate them, then in B's listener cast the message back to vector and rotation, adjust it and set it with llSetPos and llSetRot.

... move mutliple linked prims at once without them going out of sync ...

... Make a lift ...

... Modify a script while running ...

... Remove spam comments from the LSL Wiki Mirror ? ...

... Make an object move away from avatars, maintaining a minimum distance from all -- similar to a dangling carrot or running away like a scared animal. ...
See Sensors for the general principle, though not a specific method.

...Do the equivalent of an HTML A(nchor) in the object text? I want to make a portion of the text hovering over an object, set with llsetText(), clickable so that I can do something like, show the profile of the owner of the object, when I click his name. etc. ...


HomePage | Tutorial
There are 10 comments on this page. [Display comments/form]