User Tools

Site Tools


lslsnips

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
lslsnips [2025/12/07 13:03] – [Key2Number] mikolslsnips [2026/02/24 15:22] (current) miko
Line 50: Line 50:
 </code> </code>
 ===== SL to Telegram ===== ===== SL to Telegram =====
-<code>+<code lsl>
 string TELEGRAM_API_URL = "https://api.telegram.org/bot<YOUR-BOT-TOKEN>/sendMessage"; string TELEGRAM_API_URL = "https://api.telegram.org/bot<YOUR-BOT-TOKEN>/sendMessage";
 string chat_id = "<YOUR-CHAT-ID>"; string chat_id = "<YOUR-CHAT-ID>";
Line 81: Line 81:
 </code> </code>
 ===== SL2Discord =====  ===== SL2Discord ===== 
-<code>+<code lsl>
 string discord_web_hook = "wehhookURL"; // this is where your web hook url from discord goes string discord_web_hook = "wehhookURL"; // this is where your web hook url from discord goes
  
Line 107: Line 107:
 </code> </code>
 ===== Rezz at feet ==== ===== Rezz at feet ====
-<code>+<code lsl>
 integer canRezAt(vector pos) //can I rez at this place? integer canRezAt(vector pos) //can I rez at this place?
 { {
Line 149: Line 149:
 </code> </code>
 ===== Random giver ===== ===== Random giver =====
-<code>+<code lsl>
 //gimme random //gimme random
 integer random_integer(integer min, integer max) integer random_integer(integer min, integer max)
Line 158: Line 158:
 </code> </code>
 ===== Find in List ===== ===== Find in List =====
-<code>+<code LSL>
  
 // find stuff in my list or not // find stuff in my list or not
Line 294: Line 294:
 </code> </code>
 ===== Binary converter ===== ===== Binary converter =====
-<code>+<code lsl>
  
  
Line 503: Line 503:
 } }
 </code> </code>
-~~DISCUSSION~~+===== GetPrimInfo ===== 
 +<code> 
 +default 
 +
 +    touch_start(integer num_detected) 
 +    { 
 +        integer i; 
 +        for(i=0; i<num_detected; ++i) 
 +        { 
 +            llOwnerSay("/me Creator: "  + (string)llKey2Name(llGetCreator()) + 
 +            "\nCreatorKey:           + (string)llGetCreator() + 
 +            "\nObjectKey:            + (string)llGetKey() + 
 +            "\nObjectPrimCount:      + (string)llGetNumberOfPrims() + 
 +            "\nLinkNumber:           + (string)llDetectedLinkNumber(i) + 
 +            "\nLinkName:             + (string)llGetLinkName(llDetectedLinkNumber(i)) + 
 +            "\nLinkNumberKey:        + (string)llGetLinkKey(llDetectedLinkNumber(i)) + 
 +            "\nTouchFace:            + (string)llDetectedTouchFace(i) + 
 +            "\nTouchPos:             + (string)llDetectedTouchST(i) + 
 +            "\nScale (me): "            + (string)llGetScale() + 
 +            "\nMass (object): "         + (string)llGetMass() + 
 +            "\nLinkMass:             + (string)llGetObjectMass(llGetLinkKey(llDetectedLinkNumber(i))) + 
 +            "\nPos (root): "            + (string)llGetPos() + 
 +            "\nRot (root): "            + (string)llGetRot() + 
 +            "\nLocalPos (me): "         + (string)llGetLocalPos() + 
 +            "\nLocalRot (me): "         + (string)llGetLocalRot() + 
 +            "\nColor:                + (string)llGetColor(llDetectedTouchFace(i)) + 
 +            "\nAlpha:                + (string)llGetAlpha(llDetectedTouchFace(i))); 
 +        } 
 +    } 
 +
 +</code> 
 +===== RealEncryption ===== 
 +<code> 
 +string xorSalted(string msg, string salt) 
 +
 +    // Derive a numeric key from the salt 
 +    integer key = 0; 
 +    integer i; 
 +    integer slen = llStringLength(salt); 
 + 
 +    for (i = 0; i < slen; ++i) 
 +    { 
 +        key = key ^ llOrd(salt, i);   // XOR all salt chars together 
 +        key = (key * 31) & 0xFF;      // scramble it a bit 
 +    } 
 + 
 +    // Now XOR the message with the salted key 
 +    string out = ""; 
 +    integer mlen = llStringLength(msg); 
 + 
 +    for (i = 0; i < mlen; ++i) 
 +    { 
 +        integer c = llOrd(msg, i); 
 +        c = c ^ key;                  // XOR with salted key 
 +        out += llChar(c); 
 +    } 
 + 
 +    return out; 
 +
 +</code> 
 +🧪 How to use it 
 +<code> 
 +string encrypted = xorSalted("Hello World", "mySalt123"); 
 + 
 +string decrypted = xorSalted(encrypted, "mySalt123"); 
 +</code> 
 +🧠 Why this works 
 +The salt is turned into a derived key 
 +  * Even a small change in the salt produces a completely different output 
 +  * The cipher is reversible only if you know the salt 
 +  * It’s compact and fast enough for LSL 
 +  * This is the closest you can get to “real” salted encryption inside Second Life scripting.
lslsnips.1765112611.txt.gz · Last modified: by miko

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki