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
|
integer gLine = 0; // current line number
key gQueryID; // id used to identify dataserver queries
default {
state_entry() {
gQueryID = llGetNotecardLine(“notecard1”, gLine); // request first line
}
dataserver(key query_id, string data) {
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(key queryid, string data) {
// 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:
integer lines = (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
|
Constant or Value: | changed() is triggered: | changed() is not triggered: |
CHANGED_INVENTORY |
|
|
CHANGED_SCALE |
|
|
CHANGED_LINK |
|
|
CHANGED_OWNER |
|
|
CHANGED_REGION |
|
|
CHANGED_TELEPORT |
|
|
default {
state_entry() {
// needed for llAvatarOnSitTarget to work
llSitTarget(<0, 0, 0.1>, ZERO_ROTATION);
}
changed(integer change) { // something changed
if (change & CHANGED_LINK) { // and it was a link change
// llSleep(0.5); // llUnSit works better with this delay
key av = 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
}
}
}
}