LlGetFreeURLs: Difference between revisions
Jump to navigation
Jump to search
Kireji Haiku (talk | contribs) m minor readability improvements |
Kireji Haiku (talk | contribs) added warning about taking all URLs and example showing how (not) to |
||
| Line 9: | Line 9: | ||
|constants | |constants | ||
|examples= | |examples= | ||
{{LSL Tip|Never ever forget to release a URL again which you have requested! URLs are region resources just like prims. If you take them all you can get into big trouble with the sim owner and/or estate managers.}} | |||
This script will say the number of currently available HTTP-In URLs left for the sim. | This script will say the number of currently available HTTP-In URLs left for the sim. | ||
<lsl> | <lsl> | ||
| Line 25: | Line 26: | ||
} | } | ||
</lsl> | </lsl> | ||
<lsl> | |||
// WARNING: | |||
// | |||
// This script is only for proof-of-concept (demo purposes). | |||
// DO NOT use it if you don't have the sim owners and/or | |||
// estate managers OK to test this script. | |||
// This script can possibly block HTTP communication from and to the sim. | |||
// ...bringing down all networked vendors and/or similar machines. | |||
// | |||
// This script allocates all available URLs. | |||
// Deleting the script and/or derezzing the object containing the script, | |||
// will release all previously taken URLs. | |||
default | |||
{ | |||
state_entry() | |||
{ | |||
llRequestURL(); | |||
} | |||
http_request(key request_id, string method, string body) | |||
{ | |||
if (method == URL_REQUEST_DENIED) | |||
llSetText("No free URLs!", <1.0, 0.0, 0.0>, 1.0); | |||
else if (method == URL_REQUEST_GRANTED) | |||
{ | |||
llSetText( (string)llGetFreeURLs() + " URLs left\n" + body, <1.0, 1.0, 1.0>, 1.0); | |||
llRequestURL(); | |||
} | |||
else if (method == "GET") | |||
llHTTPResponse(id, 200, "Hello there!"); | |||
} | |||
} | |||
</lsl | |||
|helpers | |helpers | ||
|also_functions= | |also_functions= | ||
Revision as of 10:25, 8 October 2012
| LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: integer llGetFreeURLs( );| 0.0 | Forced Delay |
| 10.0 | Energy |
Returns an integer that is the number of available URLs.
Examples
| Important: Never ever forget to release a URL again which you have requested! URLs are region resources just like prims. If you take them all you can get into big trouble with the sim owner and/or estate managers. |
This script will say the number of currently available HTTP-In URLs left for the sim. <lsl> default {
touch_start(integer num_detected)
{
integer numberOfFreeURLs = llGetFreeURLs();
if(numberOfFreeURLs)
llSay(PUBLIC_CHANNEL, "There are " + (string)numberOfFreeURLs + " available HTTP-In URLs left for this sim.");
else
llSay(PUBLIC_CHANNEL, "WARNING: There are no HTTP-In URLs available anymore.");
}
} </lsl> <lsl> // WARNING: // // This script is only for proof-of-concept (demo purposes). // DO NOT use it if you don't have the sim owners and/or // estate managers OK to test this script. // This script can possibly block HTTP communication from and to the sim. // ...bringing down all networked vendors and/or similar machines. // // This script allocates all available URLs. // Deleting the script and/or derezzing the object containing the script, // will release all previously taken URLs.
default
{
state_entry()
{
llRequestURL();
}
http_request(key request_id, string method, string body)
{
if (method == URL_REQUEST_DENIED)
llSetText("No free URLs!", <1.0, 0.0, 0.0>, 1.0);
else if (method == URL_REQUEST_GRANTED)
{
llSetText( (string)llGetFreeURLs() + " URLs left\n" + body, <1.0, 1.0, 1.0>, 1.0);
llRequestURL();
}
else if (method == "GET")
llHTTPResponse(id, 200, "Hello there!");
}
}
</lslSee Also
Functions
| • | llRequestURL | |||
| • | llRequestSecureURL | |||
| • | llReleaseURL | |||
| • | llHTTPResponse | |||
| • | llGetHTTPHeader |
Articles
| • | LSL http server |