Don't click here unless you want to be banned.

LSL Wiki : Functions

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl338.us.archive.org

Functions


A function can be thought of as a machine into which input is provided, and which returns output. By using functions, the same blocks of code can be used over and over again, simply by referencing them.

LSL comes with over 310 built-in functions that allow scripts and objects to interact with their environment. All of the built-in functions start with "ll" -- those are lower-case 'L's, for "Linden Library".

The user can define functions (even with return values) as long as the name does not conflict with a reserved word, a built-in constant, or a built-in function.

Example
This example calls the llSay function which is used to send chat text to the specified channel.
llSay(0, "Hello world!");

Note: As SL has matured, several functions have been deprecated. Be sure to use the correct function since deprecated functions are unreliable and may be removed completely at a future date.

Categorical


  • Land (Ground/Terrain/Parcel)
  • Light
  • Link
  • List
  • Math
  • Particle
  • Primitive/Object
  • Script
  • Sensor
  • Simulator (Environment/Region/World)

  • Sound
  • String (Text/Name)
  • Teleport
  • Texture
  • Time
  • Transformation: Rotation/Scaling/Translation
  • Vehicle
  • Video
  • Weather
  • XML-RPC

  • Alphabetical

    A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z

    A

    llAbs
    llAcos
    llAddToLandBanList (1.8)
    llAddToLandPassList
    llAdjustSoundVolume
    llAllowInventoryDrop
    llAngleBetween
    llApplyImpulse
    llApplyRotationalImpulse
    llAsin
    llAtan2
    llAttachToAvatar
    llAvatarOnSitTarget
    llAxes2Rot
    llAxisAngle2Rot

    B

    llBase64ToInteger (1.5)
    llBase64ToString
    llBreakAllLinks
    llBreakLink

    C

    llCeil
    llClearCameraParams (1.9)
    llCloseRemoteDataChannel
    llCloud
    llCollisionFilter
    llCollisionSound
    llCollisionSprite
    llCos
    llCreateLink
    llCSV2List

    D

    llDeleteSubList
    llDeleteSubString
    llDetachFromAvatar
    llDetectedGrab
    llDetectedGroup
    llDetectedKey
    llDetectedLinkNumber
    llDetectedName
    llDetectedOwner
    llDetectedPos
    llDetectedRot
    llDetectedTouchBinormal (1.21)
    llDetectedTouchFace (1.21)
    llDetectedTouchNormal (1.21)
    llDetectedTouchST (1.21)
    llDetectedTouchUV (1.21)
    llDetectedType
    llDetectedVel
    llDialog
    llDie
    llDumpList2String

    E

    llEdgeOfWorld
    llEjectFromLand
    llEmail
    llEscapeURL (1.7)
    llEuler2Rot

    F

    llFabs
    llFloor
    llForceMouselook
    llFrand

    G

    llGetAccel
    llGetAgentInfo
    llGetAgentLanguage
    llGetAgentSize
    llGetAlpha
    llGetAndResetTime
    llGetAnimation
    llGetAnimationList (1.4)
    llGetAttached
    llGetBoundingBox (1.5)
    llGetCameraPos (1.7)
    llGetCameraRot (1.7)
    llGetCenterOfMass
    llGetColor
    llGetCreator (1.5)
    llGetDate
    llGetEnergy
    llGetForce
    llGetFreeMemory
    llGetGeometricCenter (1.5)
    llGetGMTclock (1.5)
    llGetHTTPHeader (1.27)
    llGetInventoryCreator (1.6)
    llGetInventoryKey
    llGetInventoryName
    llGetInventoryNumber
    llGetInventoryPermMask (1.6)
    llGetInventoryType (1.7)
    llGetKey
    llGetLandOwnerAt
    llGetLinkKey
    llGetLinkName
    llGetLinkNumber
    llGetLinkPrimitiveParams (1.38)
    llGetListEntryType
    llGetListLength
    llGetLocalPos
    llGetLocalRot
    llGetMass
    llGetNextEmail
    llGetNotecardLine
    llGetNumberOfNotecardLines (1.5)
    llGetNumberOfPrims (1.5)
    llGetNumberOfSides
    llGetObjectDetails (1.18.3)
    llGetObjectDesc (1.5)
    llGetObjectMass
    llGetObjectName
    llGetObjectPermMask (1.6)
    llGetObjectPrimCount (1.13)
    llGetOmega
    llGetOwner
    llGetOwnerKey
    llGetParcelDetails (1.13)
    llGetParcelFlags (1.9)
    llGetParcelMaxPrims (1.13)
    llGetParcelPrimCount (1.13)
    llGetParcelPrimOwners (1.13)
    llGetPermissions
    llGetPermissionsKey
    llGetPos
    llGetPrimitiveParams (1.5)
    llGetRegionCorner
    llGetRegionFlags (1.9)
    llGetRegionFPS
    llGetRegionName
    llGetRegionTimeDilation
    llGetRootPosition (1.5)
    llGetRootRotation (1.5)
    llGetRot
    llGetScale
    llGetScriptName
    llGetScriptState
    llGetSimulatorHostname (1.5.1)
    llGetStartParameter
    llGetStatus
    llGetSubString
    llGetSunDirection
    llGetTexture
    llGetTextureOffset
    llGetTextureRot
    llGetTextureScale
    llGetTime
    llGetTimeOfDay
    llGetTimestamp (1.5)
    llGetTorque
    llGetUnixTime (1.9)
    llGetVel
    llGetWallclock
    llGiveInventory
    llGiveInventoryList
    llGiveMoney
    llGodLikeRezObject
    llGround
    llGroundContour
    llGroundNormal
    llGroundRepel
    llGroundSlope

    H

    llHTTPResponse (1.27)
    llHTTPRequest (1.10)

    I

    llInsertString
    llInstantMessage
    llIntegerToBase64 (1.5)

    K

    llKey2Name

    L

    llLinkParticleSystem (1.38)
    llList2CSV
    llList2Float
    llList2Integer
    llList2Key
    llList2List
    llList2ListStrided
    llList2Rot
    llList2String
    llList2Vector
    llListFindList
    llListInsertList
    llListRandomize
    llListReplaceList
    llListSort
    llListStatistics (1.9)
    llListen
    llListenControl
    llListenRemove
    llLoadURL
    llLog
    llLog10
    llLookAt
    llLoopSound
    llLoopSoundMaster
    llLoopSoundSlave

    M

    llMakeExplosion (deprecated)
    llMakeFire (deprecated)
    llMakeFountain (deprecated)
    llMakeSmoke (deprecated)

    llMapDestination (1.8)
    llMD5String
    llMessageLinked
    llMinEventDelay
    llModifyLand
    llModPow (1.6.2)
    llMoveToTarget

    O

    llOffsetTexture
    llOpenRemoteDataChannel
    llOverMyLand
    llOwnerSay (1.6)

    P

    llParcelMediaCommandList (1.6)
    llParcelMediaQuery (1.6)
    llParseString2List
    llParseStringKeepNulls (1.5.5)
    llParticleSystem
    llPassCollisions
    llPassTouches
    llPlaySound
    llPlaySoundSlave
    llPointAt
    llPow
    llPreloadSound
    llPushObject

    R

    llRefreshPrimURL (1.7)
    llRegionSay 1.16.0(5)
    llReleaseCamera
    llReleaseControls
    llReleaseURL (1.27)
    llRemoteDataReply
    llRemoteDataSetRegion
    llRemoteLoadScript (removed)
    llRemoteLoadScriptPin
    llRemoveFromLandBanList (1.8)
    llRemoveFromLandPassList (1.8)
    llRemoveInventory
    llRemoveVehicleFlags
    llRequestAgentData
    llRequestInventoryData
    llRequestPermissions
    llRequestSecureURL (1.27)
    llRequestSimulatorData (1.6)
    llRequestURL (1.27)
    llResetOtherScript
    llResetScript
    llResetTime
    llRezAtRoot (1.5.6)
    llRezObject
    llRot2Angle
    llRot2Axis
    llRot2Euler
    llRot2Fwd
    llRot2Left
    llRot2Up
    llRotBetween
    llRotLookAt
    llRotTarget
    llRotTargetRemove
    llRotateTexture
    llRound

    S

    llSameGroup
    llSay
    llScaleTexture
    llScriptDanger
    llSendRemoteData
    llSensor
    llSensorRemove
    llSensorRepeat
    llSetAlpha
    llSetBuoyancy
    llSetCameraAtOffset
    llSetCameraEyeOffset
    llSetCameraParams (1.9)
    llSetClickAction (1.19.1)
    llSetColor
    llSetDamage
    llSetForce
    llSetForceAndTorque
    llSetHoverHeight
    llSetLinkAlpha (1.5)
    llSetLinkColor
    llSetLinkPrimitiveParams (1.13.4)
    llSetLinkPrimitiveParamsFast (1.38)
    llSetLinkTexture (1.13.4)
    llSetLinkTextureAnim (1.38)
    llSetLocalRot (1.5.4)
    llSetObjectDesc (1.5)
    llSetObjectName
    llSetParcelMusicURL (1.4)
    llSetPayPrice (1.7)
    llSetPos
    llSetPrimURL (1.7)
    llSetPrimitiveParams
    llSetRemoteScriptAccessPin
    llSetRot
    llSetScale
    llSetScriptState
    llSetSitText
    llSetSoundQueueing
    llSetSoundRadius
    llSetStatus
    llSetText
    llSetTexture
    llSetTextureAnim
    llSetTimerEvent
    llSetTorque
    llSetTouchText
    llSetVehicleFlags
    llSetVehicleFloatParam
    llSetVehicleRotationParam
    llSetVehicleType
    llSetVehicleVectorParam
    llShout
    llSin
    llSitTarget
    llSleep
    llSound (deprecated)
    llSoundPreload (deprecated)
    llSqrt
    llStartAnimation
    llStopAnimation
    llStopHover
    llStopLookAt
    llStopMoveToTarget
    llStopPointAt
    llStopSound
    llStringLength
    llStringToBase64
    llStringTrim
    llSubStringIndex

    T

    llTakeCamera (deprecated)
    llTakeControls
    llTan
    llTarget
    llTargetOmega
    llTargetRemove
    llTeleportAgentHome
    llTextBox
    llToLower
    llToUpper
    llTriggerSound
    llTriggerSoundLimited

    U

    llUnescapeURL (1.7)
    llUnSit

    V

    llVecDist
    llVecMag
    llVecNorm
    llVolumeDetect

    W

    llWater
    llWhisper
    llWind

    X

    llXorBase64StringsCorrect (1.9)
    llXorBase64Strings (deprecated)


    User-Defined Functions | Events | Functions and Parameters only
    Comments [Hide comments/form]
    I merged yours into this page, Ezhar. You're right, there were a couple calls I'd missed.
    -- CatherineOmega (2003-12-22 01:26:43)
    :p you guys missed llSetSoundRadius ^_^
    -- ChristopherOmega (2004-01-15 22:52:16)
    should rename this page to library calls or something, so can leave the functions name to talk about what a function is and how to make one
    -- HiroYamamoto (2004-01-22 15:08:36)
    And technically they're "procedures," but whatever. =P
    -- GuzarFonzarelli (2004-01-22 18:48:51)
    Procedures? Isnt that basicly what everything is?

    I personally would dub these "Low Level/Core Library Calls"

    That's one definitition I think the 'll' is for before each of these; to represent 'low-level', could also be 'linden labs' :-)
    -- ChristopherOmega (2004-02-17 20:47:52)
    Well, yea, LSL is a procedural programming language.
    -- GuzarFonzarelli (2004-02-17 22:35:33)
    Cory calls them "functions" or "function calls". He wrote it, so I follow his example. I don't care if they should be called something else, as far as I'n concerned, in LSL, they're called functions. :)
    -- CatherineOmega (2004-03-06 21:53:17)
    I think we need to disambiguate the difference between backend "ll" functions, and user-defined functions. Having only one "functions" page, IMHO... is confusing :-
    -- ChristopherOmega (2004-05-09 04:46:21)
    Tweaked the function alphabetical list table so it doesn't require as much vertical scrolling, moved function categories above alphabetised list table, and put "Deprecated." and "Not implemented." lowercase (removed periods) and in parentheses to remain consistent with "new" notes. With all the redundancy, asterisks and/or superscript numbers could be used to reference a legend, too...
    -- EepQuirk (2005-01-12 13:33:27)
    Hank it's not cool to list joke functions here.
    -- BlindWanderer (2005-02-27 13:54:30)
    Have a sense of humor. One Pizza function joke that's a joke against Snow Crash, geeze.
    -- HankRamos (2005-02-27 17:59:05)
    The joke is fine. The vast majority of SL residents haven't even heard of the Snow Crash, fewer still read it. A joke function doesn't belong mixed in with the real functions. Another example of a joke function is llDetectedSex which is listed in very few places.

    Forum Thread
    -- BlindWanderer (2005-02-27 18:30:40)
    The function index page is unneccessary. Everyone knows that this page just has one long list of functions, so what's the problem? However, I did move the categorical listing down to the bottom.
    -- KeknehvPsaltery (2005-06-22 17:46:51)
    Geez, RJ, you act like you have to scroll SO much to get past the categories when they're in 3 columns and not that much to scroll past regardless...
    -- EepQuirk (2005-07-08 13:50:48)
    The Function page is my Homepage, that should give you some idea how important it is. However I liked it better when the categories were at the top of the page.. more like a table of contents of functions, which goes at the start, then the list after.

    9 times in 10, I come here and have scroll all the way to bottom to click on the category because as you said earlier, "Everyone knows that this page just has one long list of functions" if I knew the function I was looking for, I'd just type it in at the top of my browser.
    -- LukeRamona (2005-08-05 20:37:11)
    The table columns are pretty much equal now but it required splitting up some sections. Is it that hard for you to scroll up/down a page length?
    -- EepQuirk (2006-02-21 16:16:00)
    Um, the anchors take you to the beginning of the alphabetized section so I don't know what screwed up browser you're using that takes you to R when you click S but it works fine for me--and the center column looks the same length as the left column (but I just checked with stylesheets on--I usually have them off here because I don't like the white background--and the center column IS shorter for some reason; spacing gets screwed up with stylesheets on). Odd you think the page gets worse and worse yet to me it gets better and better... Anyway, I added some anchors to take you to the column tops. <eyeroll>
    -- EepQuirk (2006-02-22 03:40:33)
    As there is no ammenity in the wiki formating guildlines for equalizing columns on long pages where they are sorted & catagorized alphabeticly, I have restored it's old formating as it was grandfathered. I have added the 1.9 preview functions.
    -- BlindWanderer (2006-02-24 15:52:32)
    Whatever. Added 4th column to even the columns better without breaking up letters (<gasp!> OH THE HORROR!). Design is relative. I WAS KISSing the design by making it SIMPLE to navigate through sections and reducing the amount of vertical scrolling. Perhaps a smaller font (like Tahoma 8pt I use on my 3D game comparison table) would be better to cram more functions on a visible page (screen resolution-dependant, of course).
    -- EepQuirk (2006-02-24 22:28:20)
    I like the 4 columns, looks good at my resolution.
    -- BlindWanderer (2006-02-24 23:49:37)
    4 columns works for me and is a solid compromise. I'm happy. Thanks.
    -- ReadyJack (2006-02-25 13:23:44)
    "A function is a programming algorythm (sic) or "a procedure within an application.""

    This may well be, but how does this actually help a user viewing this page? Either they already know what a function is, and the differences between a function and a procedure, or they have no idea what any of that means at all. Keeping the explanation simpler makes sense, because it addresses what a function actually does, rather than simply listing a bunch of terms which aren't strictly relevant.
    -- CatherineOmega (2006-03-08 17:10:02)
    Why haven't you complained about technical definitions on other pages, Catherine? Technical definitions help the user learn the technical terms and what LSL may call them instead. GuzarFonzarelli mentions "functions" being technically named "procedures" (which can be referenced as being a replacement term for "functions"). Keeping the explanation simpler is for simpler-minded people; I prefer more technical explanations because I want to learn the lingo and how it relates to LSL. Understanding the technical lingo can aid in understanding how something works; not everything has to be regurgitated into baby talk and made personal like "you" this, "we're" that.
    -- EepQuirk (2006-03-08 20:32:25)
    Eep, I'm not complaining because it's a technical explanation, but because it's not a technical explanation; it's a rather poor dictionary definition. If you want to get really into the details and terminology, then yeah, that's probably worth doing, though not on this page. However, just referencing Dictionary.com isn't helpful. People either already know the definition, or if they don't, they're unlikely to get "application" or "procedure" either.

    Further, "functions" and "procedures" aren't the same thing. A function returns a value, whereas a procedure does not. However, this difference doesn't matter in the greater scheme of things. It's more straightforward to refer to both as "functions" for LSL's purposes.
    -- CatherineOmega (2006-03-08 21:25:30)
    So reword it then--but keep the technical terms. :P
    -- EepQuirk (2006-03-08 22:43:45)
    It's not a useful definition. Algorithm suggestest math is involved; that something is being computed, which may or may not be the case. Procedure is usualy reserved for taking about a single operation, or an order of operations; this usage of the term is vauge. Operators in them selves are really just functions. At this point we have strayed away from what we mean by function. Defining operators as functions is syntaticly hidden in LSL it will just confuse people. By bringing procedure into this we have complicated the definition. Technicaly accurate but confusing, my vote to strike.

    The definition below it maybe be lacking in big words but gets the job done.
    -- BlindWanderer (2006-03-09 16:22:32)
    I agree with Cat. This is not the place for discussing religious issues. There's no practical reason for differentiating between the words here or mentioning the word procedure. Since there's no clear resolution the best we could hope for would be to give an understanding of why people argue about it and I don't see how that info helps a new scripter. The way to help new scripters on this point is to be clear and consistent by always using the word function . Functions are a hard thing for new scripters to grok. Simple is good.

    Here's my go at a def (it's too long though and I'd rather not have it on this page):

    In LSL a function is an arbitrarily named block of code enclosed in two braces. Functions allow code to be re-used by replacing a code sequence with a 'call' to the function name. Functions reduce duplication of identical code by allowing the same code sequence to be called multiple times or from different spots in the code.

    Scripters can define new functions once in the code and can call a function from any point following. Users may define any new function name that is not a reserved word (built-in Linden Lab function, LSL keyword or pre-defined constant). LSL comes with over 280 built-in functions that allow scripts and objects to interact with their environment. All of the built-in functions start with "ll" (those are lower-case 'L's, as in "Linden Lab").

    Functions can accept input variables defined after the function name and may return output of a type defined in front of the function name. Variables passed in are local to the function and changes to those variables within the function do not affect values at the point where the function is called. Functions may also act on and modify global variables (see scope). Changes to global variables within a function affect the value for the whole script.

    More generally functions represent a generic way to perform a specific action. In good programming practice a function does one thing well. A well done function further supports code re-use because it can be easily copied into a new script. For this reason the use of global variables in functions is discouraged except when required as globals complicate the process of moving code between scripts.

    Another reason to avoid globals in functions is that globals violate the 'encapsulation' provided by functions. Functions can be used to simplify code make the flow of execution easier to understand and the code easier to maintain. If a function uses all local variables you only need to look in the function definition to know what impact it has on the script as a whole. This makes finding problems and fixing them easier. By using global variables in multiple functions it becomes much more difficult to determine where a problem is and how to fix it as multiple functions may be acting on the same variable.


    ...bah...most of this is covered elsewhere. Maybe I'll put some on the user defined functions page and review the scope page.
    -- ReadyJack (2006-03-18 12:06:44)
    Is there a reason llCSV2List is not alphabeticly under "cr"? I would just change this but I want to make sure there isn't some naming convention or reason why it's not sorted properly.
    -- OzSpade (2006-05-05 19:18:28)
    Huh? llCSV2List is after llCreateLink for me. What do you mean "under 'cr'"?
    -- EepQuirk (2006-05-06 01:40:45)
    Someone edited it and fixed it. :P
    -- OzSpade (2006-05-06 02:27:02)
    I don't see how that could occur since the edits shown since you posted the comment resulted in no differences from an edit BEFORE your comment...
    -- EepQuirk (2006-05-07 15:34:25)
    I'd like to standardize all the function pages so that their syntax and results are clearly stated in the first two lines, leaving the rest of the page for further elaboration and examples. Does anyone have any objections to this?
    -- KeknehvPsaltery (2006-07-18 10:24:26)
    Not at all. The only person who would be against making the useful a more useful tool would be Eep, and that curse has been lifted.
    -- DolusNaumova (2006-07-18 16:49:22)
    Nope, go right ahead :)
    -- ChristopherOmega (2006-07-18 18:23:04)
    I hope it's ok that I added Functions and Parameters only (functionsnutshell) to this page (next to user-defined functions and events). I personally find a basic function list in that format useful sometimes.
    -- JothephNemeth (2007-08-12 15:09:06)
    Attach a comment to this page: