diff --git a/builtins.txt b/builtins.txt index 177e800..4f88e49 100644 --- a/builtins.txt +++ b/builtins.txt @@ -1,4 +1,4 @@ -// Generated by LSL2 Derived Files Generator. Database version: 0.0.20231212001; output module version: 0.0.20230603000 +// Generated by LSL2 Derived Files Generator. Database version: 0.0.20240415000; output module version: 0.0.20230603000 integer llAbs( integer val ) float llAcos( float val ) void llAddToLandBanList( key avatar, float hours ) @@ -34,6 +34,7 @@ float llCloud( vector offset ) void llCollisionFilter( string name, key id, integer accept ) void llCollisionSound( string impact_sound, float impact_volume ) void llCollisionSprite( string impact_sprite ) +string llComputeHash( string data, string algorithm ) float llCos( float theta ) void llCreateCharacter( list options ) key llCreateKeyValue( string k, string v ) @@ -87,8 +88,10 @@ string llGetAnimation( key id ) list llGetAnimationList( key id ) string llGetAnimationOverride( string anim_state ) integer llGetAttached( ) -list llGetAttachedList( key agent ) +list llGetAttachedList( key avatar ) list llGetBoundingBox( key object ) +float llGetCameraAspect( ) +float llGetCameraFOV( ) vector llGetCameraPos( ) rotation llGetCameraRot( ) vector llGetCenterOfMass( ) @@ -113,6 +116,7 @@ vector llGetGeometricCenter( ) string llGetHTTPHeader( key request_id, string header ) string llGetInventoryAcquireTime( string item ) key llGetInventoryCreator( string item ) +string llGetInventoryDesc( string itemname ) key llGetInventoryKey( string name ) string llGetInventoryName( integer type, integer number ) integer llGetInventoryNumber( integer type ) @@ -126,6 +130,7 @@ string llGetLinkName( integer linknumber ) integer llGetLinkNumber( ) integer llGetLinkNumberOfSides( integer link ) list llGetLinkPrimitiveParams( integer linknumber, list rules ) +integer llGetLinkSitFlags( integer link ) integer llGetListEntryType( list src, integer index ) integer llGetListLength( list src ) vector llGetLocalPos( ) @@ -139,13 +144,14 @@ vector llGetMoonDirection( ) rotation llGetMoonRotation( ) void llGetNextEmail( string address, string subject ) key llGetNotecardLine( string name, integer line ) +string llGetNotecardLineSync( string name, integer line ) key llGetNumberOfNotecardLines( string name ) integer llGetNumberOfPrims( ) integer llGetNumberOfSides( ) list llGetObjectAnimationNames( ) string llGetObjectDesc( ) list llGetObjectDetails( key id, list params ) -key llGetObjectLinkKey( key id, integer link ) +key llGetObjectLinkKey( key object_id, integer link ) float llGetObjectMass( key id ) string llGetObjectName( ) integer llGetObjectPermMask( integer mask ) @@ -206,7 +212,7 @@ integer llGetUnixTime( ) integer llGetUsedMemory( ) string llGetUsername( key id ) vector llGetVel( ) -list llGetVisualParams( key id, list params ) +list llGetVisualParams( key agentid, list params ) float llGetWallclock( ) void llGiveInventory( key destination, string inventory ) void llGiveInventoryList( key target, string folder, list inventory ) @@ -224,6 +230,7 @@ integer llHash( string val ) string llInsertString( string dst, integer position, string src ) void llInstantMessage( key user, string message ) string llIntegerToBase64( integer number ) +integer llIsFriend( key agent ) list llJson2List( string json ) string llJsonGetValue( string json, list specifiers ) string llJsonSetValue( string json, list specifiers, string value ) @@ -242,16 +249,16 @@ void llLinkStopSound( integer link ) integer llLinksetDataAvailable( ) integer llLinksetDataCountFound( string pattern ) integer llLinksetDataCountKeys( ) -integer llLinksetDataDelete( string keyname ) +integer llLinksetDataDelete( string name ) list llLinksetDataDeleteFound( string pattern, string pass ) -integer llLinksetDataDeleteProtected( string keyname, string password ) +integer llLinksetDataDeleteProtected( string name, string password ) list llLinksetDataFindKeys( string pattern, integer start, integer count ) list llLinksetDataListKeys( integer start, integer count ) -string llLinksetDataRead( string keyname ) -string llLinksetDataReadProtected( string keyname, string password ) +string llLinksetDataRead( string name ) +string llLinksetDataReadProtected( string name, string password ) void llLinksetDataReset( ) -integer llLinksetDataWrite( string keyname, string value ) -integer llLinksetDataWriteProtected( string keyname, string value, string password ) +integer llLinksetDataWrite( string name, string value ) +integer llLinksetDataWriteProtected( string name, string value, string password ) string llList2CSV( list src ) float llList2Float( list src, integer index ) integer llList2Integer( list src, integer index ) @@ -264,6 +271,7 @@ rotation llList2Rot( list src, integer index ) string llList2String( list src, integer index ) vector llList2Vector( list src, integer index ) integer llListFindList( list src, list test ) +integer llListFindListNext( list src, list test, integer n ) integer llListFindStrided( list src, list test, integer start, integer end, integer stride ) list llListInsertList( list dest, list src, integer start ) list llListRandomize( list src, integer stride ) @@ -296,7 +304,7 @@ void llMoveToTarget( vector target, float tau ) key llName2Key( string name ) void llNavigateTo( vector point, list options ) void llOffsetTexture( float u, float v, integer face ) -integer llOpenFloater( string title, string url, list params ) +integer llOpenFloater( string floater_name, string url, list params ) void llOpenRemoteDataChannel( ) integer llOrd( string val, integer index ) integer llOverMyLand( key id ) @@ -333,7 +341,7 @@ void llRemoveInventory( string item ) void llRemoveVehicleFlags( integer flags ) integer llReplaceAgentEnvironment( key agent_id, float transition, string environment ) integer llReplaceEnvironment( vector position, string environment, integer track_no, integer day_length, integer day_offset ) -string llReplaceSubString( string source, string search, string replace, integer count ) +string llReplaceSubString( string src, string pattern, string replacement_pattern, integer count ) key llRequestAgentData( key id, integer data ) key llRequestDisplayName( key id ) void llRequestExperiencePermissions( key agent, string name ) @@ -342,7 +350,7 @@ void llRequestPermissions( key agent, integer perm ) key llRequestSecureURL( ) key llRequestSimulatorData( string simulator, integer data ) key llRequestURL( ) -key llRequestUserKey( string name ) +key llRequestUserKey( string username ) key llRequestUsername( key id ) void llResetAnimationOverride( string anim_state ) void llResetLandBanList( ) @@ -354,6 +362,7 @@ integer llReturnObjectsByID( list objects ) integer llReturnObjectsByOwner( key owner, integer scope ) void llRezAtRoot( string inventory, vector pos, vector vel, rotation rot, integer param ) void llRezObject( string inventory, vector pos, vector vel, rotation rot, integer param ) +void llRezObjectWithParams( string itemname, list params ) float llRot2Angle( rotation rot ) vector llRot2Axis( rotation rot ) vector llRot2Euler( rotation q ) @@ -403,6 +412,7 @@ integer llSetLinkMedia( integer link, integer face, list params ) void llSetLinkPrimitiveParams( integer linknumber, list rules ) void llSetLinkPrimitiveParamsFast( integer linknumber, list rules ) void llSetLinkRenderMaterial( integer link, string material, integer face ) +void llSetLinkSitFlags( integer link, integer flags ) void llSetLinkTexture( integer linknumber, string texture, integer face ) void llSetLinkTextureAnim( integer link, integer mode, integer face, integer sizex, integer sizey, float start, float length, float rate ) void llSetLocalRot( rotation rot ) @@ -440,7 +450,7 @@ void llSetVehicleType( integer type ) void llSetVehicleVectorParam( integer param, vector vec ) void llSetVelocity( vector velocity, integer local ) void llShout( integer channel, string msg ) -string llSignRSA( string privkey, string message, string hashalg ) +string llSignRSA( string private_key, string msg, string algorithm ) float llSin( float theta ) integer llSitOnLink( key agent_id, integer link ) void llSitTarget( vector offset, rotation rot ) @@ -467,7 +477,7 @@ float llTan( float theta ) integer llTarget( vector position, float range ) void llTargetOmega( vector axis, float spinrate, float gain ) void llTargetRemove( integer number ) -void llTargetedEmail( integer target, string header, string body ) +void llTargetedEmail( integer target, string subject, string message ) void llTeleportAgent( key avatar, string landmark, vector position, vector look_at ) void llTeleportAgentGlobalCoords( key agent, vector global_coordinates, vector region_coordinates, vector look_at ) void llTeleportAgentHome( key id ) @@ -484,12 +494,13 @@ key llUpdateKeyValue( string k, string v, integer checked, string original_value float llVecDist( vector v1, vector v2 ) float llVecMag( vector v ) vector llVecNorm( vector v ) -integer llVerifyRSA( string pubkey, string message, string signature, string hashalg ) +integer llVerifyRSA( string public_key, string msg, string signature, string algorithm ) void llVolumeDetect( integer detect ) void llWanderWithin( vector center, vector radius, list options ) float llWater( vector offset ) void llWhisper( integer channel, string msg ) vector llWind( vector offset ) +vector llWorldPosToHUD( vector pos ) string llXorBase64( string str1, string str2 ) string llXorBase64Strings( string str1, string str2 ) string llXorBase64StringsCorrect( string str1, string str2 ) @@ -794,6 +805,7 @@ const integer MASK_EVERYONE = 3 const integer MASK_GROUP = 2 const integer MASK_NEXT = 4 const integer MASK_OWNER = 1 +const string NAK = "\n\n" const string NULL_KEY = "00000000-0000-0000-0000-000000000000" const integer OBJECT_ACCOUNT_LEVEL = 41 const integer OBJECT_ANIMATED_COUNT = 39 @@ -1051,6 +1063,7 @@ const integer PRIM_SHINY_HIGH = 3 const integer PRIM_SHINY_LOW = 1 const integer PRIM_SHINY_MEDIUM = 2 const integer PRIM_SHINY_NONE = 0 +const integer PRIM_SIT_FLAGS = 50 const integer PRIM_SIT_TARGET = 41 const integer PRIM_SIZE = 7 const integer PRIM_SLICE = 35 @@ -1172,6 +1185,25 @@ const integer REMOTE_DATA_REQUEST = 2 const integer REQUIRE_LINE_OF_SIGHT = 2 const integer RESTITUTION = 0x4 const integer REVERSE = 0x4 +const integer REZ_ACCEL = 5 +const integer REZ_DAMAGE = 8 +const integer REZ_FLAGS = 1 +const integer REZ_FLAG_BLOCK_GRAB_OBJECT = 128 +const integer REZ_FLAG_DIE_ON_COLLIDE = 8 +const integer REZ_FLAG_DIE_ON_NOENTRY = 16 +const integer REZ_FLAG_NO_COLLIDE_FAMILY = 64 +const integer REZ_FLAG_NO_COLLIDE_OWNER = 32 +const integer REZ_FLAG_PHANTOM = 4 +const integer REZ_FLAG_PHYSICAL = 2 +const integer REZ_FLAG_TEMP = 1 +const integer REZ_LOCK_AXES = 11 +const integer REZ_OMEGA = 7 +const integer REZ_PARAM = 0 +const integer REZ_POS = 2 +const integer REZ_ROT = 3 +const integer REZ_SOUND = 9 +const integer REZ_SOUND_COLLIDE = 10 +const integer REZ_VEL = 4 const integer ROTATE = 0x20 const integer SCALE = 0x40 const integer SCRIPTED = 0x8 @@ -1202,6 +1234,10 @@ const integer SIM_STAT_SCRIPT_RUN_PCT = 25 const integer SIM_STAT_SLEEP_MS = 23 const integer SIM_STAT_SPARE_MS = 22 const integer SIM_STAT_UNACKED_BYTES = 17 +const integer SIT_FLAG_ALLOW_UNSIT = 2 +const integer SIT_FLAG_NO_COLLIDE = 16 +const integer SIT_FLAG_SCRIPTED_ONLY = 4 +const integer SIT_FLAG_SIT_TARGET = 1 const integer SIT_INVALID_AGENT = -4 const integer SIT_INVALID_LINK = -5 const integer SIT_INVALID_OBJECT = -7 diff --git a/fndata.txt b/fndata.txt index 12effe0..f6f67a5 100644 --- a/fndata.txt +++ b/fndata.txt @@ -1697,6 +1697,40 @@ void llSetRenderMaterial(string material, integer face) void llSetLinkRenderMaterial(integer link, string material, integer face) +string llComputeHash(string data, string algorithm) +- SEF if alg == "md5" || alg == "md5_sha1" || alg == "sha1" || alg == "sha224" || alg == "sha256" || alg == "sha384" || alg == "sha512" +# otherwise error + +float llGetCameraAspect() +# No error if PERMISSION_TRACK_CAMERA not granted, hence SEF +- SEF + +float llGetCameraFOV() +# No error if PERMISSION_TRACK_CAMERA not granted, hence SEF +- SEF + +string llGetInventoryDesc(string itemname) +# May produce error (if item doesn't exist), hence not SEF + +integer llGetLinkSitFlags(integer link) +- SEF + +string llGetNotecardLineSync(string name, integer line) +# May produce error (if notecard doesn't exist), hence not SEF + +integer llIsFriend(key agent) +- SEF + +integer llListFindListNext(list src, list test, integer n) +- SEF + +void llRezObjectWithParams(string itemname, list params) + +void llSetLinkSitFlags(integer link, integer flags) + +vector llWorldPosToHUD(vector pos) +- SEF + ################################################################### # Events are SEF if a script with an empty event can't be diff --git a/lslopt/lslbasefuncs.py b/lslopt/lslbasefuncs.py index 9525f44..b0f986f 100644 --- a/lslopt/lslbasefuncs.py +++ b/lslopt/lslbasefuncs.py @@ -1159,6 +1159,37 @@ def llChar(code): return u'' if code == 0 else u'\uFFFD' return unichr(code) +def InternalGetAlg(alg): + hash = None + if alg == u'md5': + hash = hashlib.md5() + elif alg == u'sha1': + hash = hashlib.sha1() + elif alg == u'sha224': + hash = hashlib.sha224() + elif alg == u'sha256': + hash = hashlib.sha256() + elif alg == u'sha384': + hash = hashlib.sha384() + elif alg == u'sha512': + hash = hashlib.sha512() + return hash + +def llComputeHash(data, alg): + data = bytewrap(uniwrap(fs(data)).encode('utf8')) + alg = fs(alg) + hash = InternalGetAlg(alg if alg != u'md5_sha1' else u'md5') + if hash is None: + raise ELSLCantCompute # spews error + hash.update(data) + ret = hash.hexdigest() + if alg == u'md5_sha1': + # md5_sha1 consists of concatenating the MD5 and the SHA-1 + hash = InternalGetAlg(u'sha1') + hash.update(data) + ret += hash.hexdigest() + return ret.decode('utf8') + def llCos(f): f = ff(f) if math.isinf(f): @@ -1308,19 +1339,7 @@ def llHMAC(pwd, data, alg): pwd = bytewrap(uniwrap(fs(pwd)).encode('utf8')) data = bytewrap(uniwrap(fs(data)).encode('utf8')) alg = fs(alg) - hash = None - if alg == u'md5': - hash = hashlib.md5() - elif alg == u'sha1': - hash = hashlib.sha1() - elif alg == u'sha224': - hash = hashlib.sha224() - elif alg == u'sha256': - hash = hashlib.sha256() - elif alg == u'sha384': - hash = hashlib.sha384() - elif alg == u'sha512': - hash = hashlib.sha512() + hash = InternalGetAlg(alg) if hash is None: raise ELSLCantCompute # spews error # Calculate the HMAC here, to avoid requiring yet another module @@ -1536,6 +1555,12 @@ def llListFindList(lst, elems): return i return -1 +def llListFindListNext(src, test, n): + src = fl(src) + test = fl(test) + n = fi(n) + raise eLSLCantCompute # TODO: Implement llListFindListNext + def llListFindStrided(src, test, start, end, stride): src = fl(src) test = fl(test) diff --git a/lslopt/lslextrafuncs.py b/lslopt/lslextrafuncs.py index e72e1fe..438f27a 100644 --- a/lslopt/lslextrafuncs.py +++ b/lslopt/lslextrafuncs.py @@ -325,6 +325,12 @@ def llGetLinkName(link): return NULL_KEY raise ELSLCantCompute +def llGetLinkSitFlags(link): + link = fi(link) + if link > 256 or (link < 0 and link != -4): + return 0 + raise ELSLCantCompute + def llGetObjectLinkKey(id, link): # TODO: Investigate behaviour with invalid key, invalid link etc. raise ELSLCantCompute @@ -355,4 +361,10 @@ def llGetVisualParams(id, params): # return [u""] * len(params) raise ELSLCantCompute +def llIsFriend(id): + id = fk(id) + if not cond(id): + return 0 + raise ELSLCantCompute + # TODO: Add more predictable functions. diff --git a/lslopt/lslfuncopt.py b/lslopt/lslfuncopt.py index 087f08a..e7bc4c2 100644 --- a/lslopt/lslfuncopt.py +++ b/lslopt/lslfuncopt.py @@ -113,16 +113,18 @@ primParamsTypes = \ , 42: 'sfff' # 42=PRIM_PROJECTOR , 43: 'i' # 43=PRIM_CLICK_ACTION , 44: 'iffi' # 44=PRIM_REFLECTION_PROBE - # GLTF parameters admit an empty string in any of the places except the - # first integer (face number). We're not prepared to deal with that. -# , 45: 'isvvf' # 45=PRIM_GLTF_NORMAL -# , 46: 'isvvfv' # 46=PRIM_GLTF_EMISSIVE -# , 47: 'isvvfff' # 47=PRIM_GLTF_METALLIC_ROUGHNESS -# , 48: 'isvvfvfifi' # 48=PRIM_GLTF_BASE_COLOR - , 45: 'i*' # 45=PRIM_GLTF_NORMAL - , 46: 'i*' # 46=PRIM_GLTF_EMISSIVE - , 47: 'i*' # 47=PRIM_GLTF_METALLIC_ROUGHNESS - , 48: 'i*' # 48=PRIM_GLTF_BASE_COLOR + # GLTF parameters admit an empty string in any of the places. We're not + # prepared to deal with that. +# , 45: 'svvf' # 45=PRIM_GLTF_NORMAL +# , 46: 'svvfv' # 46=PRIM_GLTF_EMISSIVE +# , 47: 'svvfff' # 47=PRIM_GLTF_METALLIC_ROUGHNESS +# , 48: 'svvfvfifi' # 48=PRIM_GLTF_BASE_COLOR + , 45: '*' # 45=PRIM_GLTF_NORMAL + , 46: '*' # 46=PRIM_GLTF_EMISSIVE + , 47: '*' # 47=PRIM_GLTF_METALLIC_ROUGHNESS + , 48: '*' # 48=PRIM_GLTF_BASE_COLOR + , 49: 's' # 49=PRIM_RENDER_MATERIAL + , 50: 'i' # 50=PRIM_SIT_FLAGS } # llGetPrimitiveParams parameters with arguments. F=face, L=link. @@ -137,6 +139,11 @@ primParamsArgs = \ , 36: 'F' # PRIM_SPECULAR , 37: 'F' # PRIM_NORMAL , 38: 'F' # PRIM_ALPHA_MODE + , 45: 'F' # PRIM_GLTF_NORMAL + , 46: 'F' # PRIM_GLTF_EMISSIVE + , 47: 'F' # PRIM_GLTF_METALLIC_ROUGHNESS + , 48: 'F' # PRIM_GLTF_BASE_COLOR + , 49: 'F' # PRIM_RENDER_MATERIAL } # llGetPrimMediaParams and llGetLinkMedia return types diff --git a/unit_tests/expr.suite/llcomputehash.lsl b/unit_tests/expr.suite/llcomputehash.lsl new file mode 100644 index 0000000..0a1a7ed --- /dev/null +++ b/unit_tests/expr.suite/llcomputehash.lsl @@ -0,0 +1,15 @@ +[ llComputeHash("", "md5") +, llComputeHash("", "sha1") +, llComputeHash("", "md5_sha1") +, llComputeHash("", "sha224") +, llComputeHash("", "sha256") +, llComputeHash("", "sha384") +, llComputeHash("", "sha512") +, llComputeHash("Ħ", "md5") +, llComputeHash("Ħ", "sha1") +, llComputeHash("Ħ", "md5_sha1") +, llComputeHash("Ħ", "sha224") +, llComputeHash("Ħ", "sha256") +, llComputeHash("Ħ", "sha384") +, llComputeHash("Ħ", "sha512") +] \ No newline at end of file diff --git a/unit_tests/expr.suite/llcomputehash.out b/unit_tests/expr.suite/llcomputehash.out new file mode 100644 index 0000000..ca90650 --- /dev/null +++ b/unit_tests/expr.suite/llcomputehash.out @@ -0,0 +1,15 @@ +[ "d41d8cd98f00b204e9800998ecf8427e" +, "da39a3ee5e6b4b0d3255bfef95601890afd80709" +, "d41d8cd98f00b204e9800998ecf8427eda39a3ee5e6b4b0d3255bfef95601890afd80709" +, "d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f" +, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" +, "38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b" +, "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e" +, "e1fe0df9eb70ed8c9c60281bb6a3e3b7" +, "bee331b7d5ed49c3ac53bc7a2df8777de5af1a1f" +, "e1fe0df9eb70ed8c9c60281bb6a3e3b7bee331b7d5ed49c3ac53bc7a2df8777de5af1a1f" +, "a8c63c508a22184977bf8446e1220563f5135e6d51d51bd922278676" +, "e8abcd2ef6814eecb90f27f31f682bd478a951d06ef04790a5f7746317620bbd" +, "3e238ff4e19caef99cd9ed3d08ce6f7ad01564d81b34fd613fcc65ffeac622964456b697a7acbc7ad8f7bbe5090a4afc" +, "c69a989ca93f0f0a998d59cc08380daa2c8ca48d3b103f8bc8b0599bd0655fc0d4562d9841ef619730af19a619724e595bb87087356a65b3d41193f28eb677f9" +] \ No newline at end of file diff --git a/unit_tests/regression.suite/computable.lsl b/unit_tests/regression.suite/computable.lsl index 2eb46ce..9c6e505 100644 --- a/unit_tests/regression.suite/computable.lsl +++ b/unit_tests/regression.suite/computable.lsl @@ -24,6 +24,11 @@ default , llGetColor(9) , llGetDisplayName("") , llGetStatus(STATUS_CAST_SHADOWS) + , llIsFriend(".") + , llGetLinkSitFlags(257) + , llGetLinkSitFlags(-1) + , llGetLinkSitFlags(-2) + , llGetLinkSitFlags(-3) ]); llSetPrimitiveParams(llGetAgentList(3, [])); llSetPrimitiveParams(llGetAnimationList("")); diff --git a/unit_tests/regression.suite/computable.out b/unit_tests/regression.suite/computable.out index 3d5bd0f..d214e9e 100644 --- a/unit_tests/regression.suite/computable.out +++ b/unit_tests/regression.suite/computable.out @@ -23,6 +23,11 @@ default , <1., 1., 1.> , "" , 0 + , 0 + , 0 + , 0 + , 0 + , 0 ]); llSetPrimitiveParams((list)"INVALID_SCOPE"); llSetPrimitiveParams([]);