查看“LlOverMyLand”的源代码
←
LlOverMyLand
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{{LSL Header|ml=*}}{{LSLC|Keywords}}{{LSLC|Flow Control}}{{LSLC|}} {{函数详情 |函数名 = Function: integer llOverMyLand( key id ); |参数= 参数: • key id – group, avatar or object UUID that is in the same region |返回值= 返回值: 返回一个整数布尔值,如果 id 在脚本所有者拥有的土地上,返回 true,否则为 false。 |注意事项= |示例= 示例一 <pre> //--// private land message //--// //-- list of people not to pester, lower case only list gLstIgnore = ["void singer"]; key gKeyAv; default{ state_entry(){ llOwnerSay( "I'll pester anyone on your land I can find," + " unless they're in your ignore list." ); llSensorRepeat( "", "", AGENT, 96, PI, 30 ); } sensor( integer vIntFound ){ do{ gKeyAv = llDetectedKey( --vIntFound ); //-- Decrement sensor variable to walk backwards through all detections //-- check if they are over our land if (llOverMyLand( gKeyAv )){ //-- the return value is automatically tested by the if statemnt //-- check if they are in the ignore list if (!~llListFindList( gLstIgnore, (list)llToLower( llDetectedName( vIntFound ) ) )){ //-- '!~llListFindList' == 'not found in the list' //-- pester everyone not in the ignore list !!! llInstantMessage( gKeyAv, "You are on private land, please leave this parcel" ); } } }while (vIntFound); } } </pre> 下面这个例子是前一个例子的变体。它会把每天的访客记录发给你。这对于确定你的包裹每天吸引多少流量,以及谁定期来访是很有用的。Llovermyland 函数用于防止脚本计算其他地块上的人数。 <pre> // This script will email you a daily count of new visitors and repeat visitors. // Visitors are counted once per email update cycle. // ----------------------------------- // Configuration: customize this script here. // Change this to your email address. string MyEmail = "you@example.com"; // This is a number 0 to 96 meters, anything farther away than that will not be noticed. float SensorRange = 96.0; // How often to send email updates. integer UpdateFrequency = 86400; // Number of seconds in 1 day. // ----------------------------------- // Internal Variables -- Do not change. list todayVisitors = []; list allVisitors = []; list repeatVisitors = []; list firstTimers = []; integer newVisitors = 0; integer returnVisitors = 0; string ParcelName; default { state_entry() { list parcelDetails = llGetParcelDetails(llGetPos(), [PARCEL_DETAILS_NAME]); ParcelName = llList2String(parcelDetails, 0); llSensorRepeat( "", "", AGENT, SensorRange, PI, 20); llSetTimerEvent(UpdateFrequency); // Email me a regular report. llOwnerSay("Visitor Log Started."); } sensor(integer avsFound) { key avKey; integer avNum; for(avNum=0; avNum<avsFound; avNum++) { avKey = llDetectedKey(avNum); if (llOverMyLand(avKey)) { string whom = llDetectedName(avNum); if (!~llListFindList(todayVisitors, [whom])) { // This person hasn't been seen yet today. todayVisitors += [whom]; if (~llListFindList(allVisitors, [whom])) { // This is a returning visitor. returnVisitors++; repeatVisitors += [whom]; } else { // This is a first-time visitor. newVisitors++; allVisitors = [whom] + allVisitors; firstTimers += [whom]; } } } } } timer() { list parcelDetails = llGetParcelDetails(llGetPos(), [PARCEL_DETAILS_NAME]); ParcelName = llList2String(parcelDetails, 0); string subj = "Visitor Log for " + ParcelName; string body = "Number of Visitors Total: " + (string)(newVisitors + returnVisitors) + "\nReturning Visitors: " + (string)returnVisitors + "\nNew Visitors: " + (string)newVisitors + "\n\nList of New Visitors:\n\t" + llDumpList2String(firstTimers, "\n\t") + "\n\nList of Returning Visitors:\n\t" + llDumpList2String(repeatVisitors, "\n\t"); newVisitors = 0; returnVisitors = 0; todayVisitors = []; repeatVisitors = []; firstTimers = []; if (llGetListLength(allVisitors)>500) { allVisitors = llList2List(allVisitors, 0, 499); } llEmail(MyEmail, subj, body); } } </pre> |相关函数= [[llReturnObjectsByID]] |相关事件= }}
该页面使用的模板:
模板:LSL Header
(
查看源代码
)
模板:LSLC
(
查看源代码
)
模板:LSLGC
(
查看源代码
)
模板:Multi-lang
(
查看源代码
)
模板:函数详情
(
查看源代码
)
返回至
LlOverMyLand
。
导航菜单
个人工具
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
导航
网站首页
知识百科
编辑帮助
最近更改
工具
链入页面
相关更改
特殊页面
页面信息