LSL学习笔记(3)
Notecards are limited in size to 64KiB of text.
Notecards can be read using
llGetNotecardLine() unless they contain any inventory items as described above.
Function
|
Description
|
llGetNotecardLine
|
读取所指定的notecard里的某一行的data。当返回data时会trigger dataserver event.
|
llGetNumberOfNotecardLines
|
获取所指定的notecard包含的行数。返回行数时会trigger dataserver event.
|
llGiveInventory
|
把一个notecard送给a user。执行该方法时,该notecard的内容就会在一个popup notecard window里显示出来,该user可以选择是keep还是discard该notecard。这也是一个常用的显示text的方法。
|
Event
|
Description
|
changed
|
当1个notecard被添加到object,或从object里删除,或对object里的notecard进行了修改,都会trigger该event。当然其他inventory item发生增删改的情况也会trigger该event,而不仅仅是for notecard。
|
dataserver
|
Triggered when calls to llGetNotecardLine or llGetNumberOfNotecardLines returns data. 当然还有其他request data返回时也会trigger该event,我们后面会讲解
|
Constant
|
Value
|
Look At
|
Hex
|
INVENTORY_ALL
|
-1
|
all inventory items
|
|
INVENTORY_ANIMATION
|
20
|
animations
|
0x14
|
INVENTORY_BODYPART
|
13
|
body parts
|
0x0D
|
INVENTORY_CLOTHING
|
5
|
clothing
|
0x05
|
INVENTORY_GESTURE
|
21
|
gestures
|
0x15
|
INVENTORY_LANDMARK
|
3
|
landmarks
|
0x03
|
INVENTORY_NOTECARD
|
7
|
notecards
|
0x07
|
INVENTORY_OBJECT
|
6
|
objects
|
0x06
|
INVENTORY_SCRIPT
|
10
|
scripts
|
0x0A
|
INVENTORY_SOUND
|
1
|
sounds
|
0x01
|
INVENTORY_TEXTURE
|
0
|
textures
|
0x00
|
Remember:
错误的requests会失败,但不会抛出任何error,而且不会触发dataserver() event (例如:如果a notecard line is requested, 但所提供的指向a notecard的key是错误的,那么request data失败).integergLine = 0;// current line number
keygQueryID;// id used to identify dataserver queries
default{
state_entry() {
gQueryID = llGetNotecardLine(“notecard1”, gLine);// request first line
}
dataserver(keyquery_id,stringdata) {
if(query_id == gQueryID) {
if(data != EOF) {// not at the end of the notecard
llSay(0, (string)gLine+": "+data);// output the line
// increase line count
++gLine;
// request next line
gQueryID = llGetNotecardLine(“notecard1, gLine);
}
}
}
}
default{
state_entry() {
llGetNumberOfNotecardLines("somenotecard");
}
dataserver(keyqueryid,stringdata) {
// note how the returned value is already a string
llSay(0,"This notecard has "+ data +" lines.");
// if you want to use it as a number, you will have to cast it to an integer:
integerlines = (integer)data;
}
}
Constant
|
Value
|
Indicates
|
|
CHANGED_INVENTORY
|
0x1
|
changed object inventory (could include an item being added, removed, or renamed, or a notecard being edited and saved).
|
Details
|
CHANGED_COLOR
|
0x2
|
changed object color or transparency
|
|
CHANGED_SHAPE
|
0x4
|
changed object shape (box to cylinder, for example), cut, hollow amount/shape, twist, top size, or shear
|
|
CHANGED_SCALE
|
0x8
|
changed object scale.
|
Details
|
CHANGED_TEXTURE
|
0x10
|
changed object texture: offset, repeats, rotation, and reflection/bump maps (but not transparency -- that's CHANGED_COLOR)
|
|
CHANGED_LINK
|
0x20
|
linking or delinking (also when an avatar sits on or unsits from the object).
|
Details
|
CHANGED_ALLOWED_DROP
|
0x40
|
An item was dropped (into this object's inventory) that was only allowed by the llAllowInventoryDrop function. This allows the object to identify items dropped by anyone who doesn't have modify permissions on the object.
|
|
CHANGED_OWNER
|
0x80
|
The ownership of the object changed. This value is passed when an object is deeded to a group, when an object is purchased, or when a newly-purchased object is rezzed.
|
Details
|
CHANGED_REGION
|
0x100
|
The object changed regions/sims.
|
Details
|
CHANGED_TELEPORT
|
0x200
|
The object has been teleported.
|
Details
|
Details
Constant or Value: | changed() is triggered: | changed() is not triggered: |
CHANGED_INVENTORY |
|
|
CHANGED_SCALE |
|
|
CHANGED_LINK |
|
|
CHANGED_OWNER |
|
|
CHANGED_REGION |
|
|
CHANGED_TELEPORT |
|
(As of Second Life 1.16.0 (5) this is not accurate. Teleporting into no-script land will cause the event to trigger once you move onto script-enabled land, as though you had just teleported.) |
Aside from the above, the changed() event is also not triggered:
- when an object changes position. (Use moving_start() and moving_end().)
- when an object changes rotation.
- when changing the object's name or description.
- when changing the object's group. (not deeding the object to a group -- that'll trigger CHANGED_OWNER)
- when toggling "Share with group", "Allow anyone to move", "Allow anyone to copy", setting the object "For Sale", changing any of the sale settings, or setting "Next owner can:".
- when toggling "Lock", "Physics", "Temporary" or "Phantom".
- when setting prim material.
- when using llSetText.
- when using llParticleSystem.
- in a worn attachment when the owner attaches or detaches it. (Use attach().)
- in a worn attachment when the wearer sits on something.
- when the object is selected/edited.
- The change parameter describes only what type of change happened, not the difference between the original and changed versions of the object. If you need to determine exactly what changed, the script must store the relevant properties and compare the values from before and after the change.
- Prim/object position and rotation are not currently detected when changed but can be via a timer and llGetRot and llGetPos. Position changes can also be detected by using the moving_start and moving_end events.
- When an avatar sits on an object, they seem to become part of the linkset.
- A changed() event is raised with CHANGED_LINK as the parameter when an avatar sits on an object or un-sits. To find out what happened, use llAvatarOnSitTarget which returns the NULL_KEY if no avatar is sitting on the object, or the key of the avatar that is sitting at the sit target.
default{
state_entry() {
// needed for llAvatarOnSitTarget to work
llSitTarget(<0, 0, 0.1>, ZERO_ROTATION);
}
changed(integerchange) {// something changed
if(change & CHANGED_LINK) {// and it was a link change
// llSleep(0.5); // llUnSit works better with this delay
keyav = llAvatarOnSitTarget();
if(av) {// somebody is sitting on me
llSay(0,"Get off!");// say in chat when person is remove from prim
llUnSit(av);// unsit him
}
}
}
}
LSL学习笔记(3)相关推荐
- 一文弄懂元学习 (Meta Learing)(附代码实战)《繁凡的深度学习笔记》第 15 章 元学习详解 (上)万字中文综述
<繁凡的深度学习笔记>第 15 章 元学习详解 (上)万字中文综述(DL笔记整理系列) 3043331995@qq.com https://fanfansann.blog.csdn.net ...
- Linux学习笔记(二)|常用命令
Linux学习笔记(二)常用命令 1.文件处理命令 1.1命令格式与目录处理 -ls 功能描述:显示目录文件 原意:list 所在路径:/bin/ls 语法: ls-a 显示所有文件,包括隐藏文件 l ...
- LINUX学习笔记共五部分
LINUX学习笔记1--LINUX系统命令 1. 界面切换: a) 进入字符界面:按住ctrl+alt+F1: 1. 首先需要进入用户登入,输入用户名和 ...
- OPTEE学习笔记 - AArch64 RPC(一)
前文OPTEE学习笔记 - REE与TEE通信记录了AArch32的RPC调用流程,这边总结一下OPTEE AArch64的RPC调用流程,基于optee 3.11版本以及TF-A 2.4 REE侧E ...
- OPTEE学习笔记 - AArch64 RPC(二)
在前面的文章OPTEE学习笔记 - AArch64 RPC(一)中我们分析了fast call的AArch64 RPC.本文基于前文,分析一下std call的实现. 正常执行流程 我们以optee_ ...
- ARM汇编语言学习笔记
汇编是对寄存器操作的,不知道一些和主控制器相关的寄存器的作用,根本无法理解某些指令,所以先自己学习相关寄存器和工作模式. 下面是<ARM 嵌入式体系结构与接口技术(Cortex-A8 版) &g ...
- Solaris 10 学习笔记
{转}Solaris 10 学习笔记 Solaris 10 安装并运行Solarids 10的硬件环境 1. SPARC平台 2. X86平台 3. ...
- Centos学习笔记
CENTOS学习笔记: 一.shell 脚本基础-bash变量和逻辑运行 1. 终端:附着在终端上的接口程序 GUI:KDE ,GNone,Xfce CLI: /etc/shells bash zsh ...
- PyTorch 学习笔记(六):PyTorch hook 和关于 PyTorch backward 过程的理解 call
您的位置 首页 PyTorch 学习笔记系列 PyTorch 学习笔记(六):PyTorch hook 和关于 PyTorch backward 过程的理解 发布: 2017年8月4日 7,195阅读 ...
- 容器云原生DevOps学习笔记——第三期:从零搭建CI/CD系统标准化交付流程
暑期实习期间,所在的技术中台-效能研发团队规划设计并结合公司开源协同实现符合DevOps理念的研发工具平台,实现研发过程自动化.标准化: 实习期间对DevOps的理解一直懵懵懂懂,最近观看了阿里专家带 ...
最新文章
- ros 消息队列与缓冲区_Spring Boot消息队列系统:RocketMQ初入门
- Gentoo 安装日记 21 (第一次重启)
- 『Golang』Martini框架入门
- www.how2j.com_HOW-TO:快速开始使用Spring 4.0,以构建简单的REST-Like API(演练)
- 前端又省事了,Chrome直接支持lazyload延迟加载
- knime二次开发节点的项目结构
- ExtJs2.0学习系列(11)--Ext.XTemplate
- MTK 驱动---(8)emmc 介绍
- access成绩为非负数_初一数学期末复习,有理数应用题专训,正负数实际意义是关键...
- Runnable Thread分析比较
- opencv检测相交点_OpenCV学习18--霍夫变换检测直线
- DevExpress WinForm 控件汉化方法 代码(一)
- 用JavaScript写抖音很火的罗盘时钟,附源码
- html中怎么让图片做背景透明背景图片,透明背景图片怎么做?
- 将一般算术表达式转化为逆波兰表达式,并求逆波兰表达式的值。
- Feign集成Hystric报错
- WEditor USB device is offline
- Android性能优化之页面优化
- 阿里云IoT平台APP配网入口
- Sublime插件安装与提高Verilog编写效率插件推荐