Advertisement
itoibo

LSL Pastebin Example by ChatGPT

Jan 13th, 2025
934
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. string apiUrl = "https://pastebin.com/api/api_post.php";
  2. string apiKey = "your_api_key_here"; // Replace with your actual API key
  3. string pasteTitle = "Example Paste from LSL";
  4. string pasteContent = "This is a test paste created from an LSL script.";
  5. string pasteFormat = "text"; // Change to your preferred format
  6. integer pastePrivacy = 0;   // 0 = Public, 1 = Unlisted, 2 = Private
  7. string pasteExpire = "10M"; // Expiration time (N = Never, 10M = 10 Minutes, etc.)
  8.  
  9. default
  10. {
  11.     state_entry()
  12.     {
  13.         llOwnerSay("Starting paste creation...");
  14.        
  15.         string postData = llDumpList2String([
  16.             "api_dev_key=" + apiKey,
  17.             "api_option=paste",
  18.             "api_paste_code=" + llEscapeURL(pasteContent),
  19.             "api_paste_name=" + llEscapeURL(pasteTitle),
  20.             "api_paste_format=" + pasteFormat,
  21.             "api_paste_private=" + (string)pastePrivacy,
  22.             "api_paste_expire_date=" + pasteExpire
  23.         ], "&");
  24.        
  25.         llHTTPRequest(apiUrl, [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded"], postData);
  26.     }
  27.  
  28.     http_response(key id, integer status, list metadata, string body)
  29.     {
  30.         if (status == 200)
  31.         {
  32.             llOwnerSay("Paste created successfully: " + body);
  33.         }
  34.         else
  35.         {
  36.             llOwnerSay("Failed to create paste. Status: " + (string)status + ", Response: " + body);
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement