LlGetFreeURLs

来自人工智能助力教育知识百科
跳转至: 导航搜索

Template:Needs Translation/


函数名
Function: integer llGetFreeURLs( )
参数:
返回值:返回一个整数,它是可用url的数量。如果附加了URL,则返回所有者的剩余URL。否则,返回sim的可用URL。
注意事项
注意事项
  • 如果从附件调用,则无法在sim中获得免费url的号码;它将始终返回代理剩余的url计数。
示例
这个脚本将指出sim当前可用的HTTP-In url的数量。
default
{
    touch_start(integer num_detected)
    {
        integer numberOfFreeURLs = llGetFreeURLs();
 
        if(numberOfFreeURLs)
            llSay(0,  "There are " + (string)numberOfFreeURLs + " available HTTP-In URLs left for this sim.");
 
        else
            llSay(0, "WARNING: There are no HTTP-In URLs available anymore.");
    }
}
// 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!");
    }
}
相关函数
llRequestURL

llRequestSecureURL llReleaseURL llHTTPResponse llGetHTTPHeader

相关事件