SLS覚書
■データ型
No. | 型の名称 | 型の説明 | 備考 |
1 | string | "文字列" | |
2 | integer | 整数値 | |
3 | float | 不動小数点数 | |
4 | vector | 3次元座標やRGBに使う。x,y,zともにfloat | |
5 | rotation | 向きや回転を表す | |
6 | list | [値1, 値2, ... , 値Z] | 配列。任意型を格納可能。ネストは不可。 |
7 | key | 32桁の16進数 | アバターやオブジェクトを一意で表す値。UUID。 |
■演算子
型変換はキャストで行う | 例) integer value = 100; string str = (string)value; |
文字列の結合は+記号で行う | 例) string str = "ABC" + "DEF"; |
いっぺんに代入可能 | 例) x = y = z = 100; |
■vector演算の定数
No. | 記述 | 意味 |
1 | PI | π |
2 | TWO_PI | 2π |
3 | DEG_TO_RAD | PI/180 |
4 | RAD_TO_DEG | 180/PI |
■真偽値
真 0以外
偽 0
■無条件分岐
@で始まる識別子はラベルとなる。 | 例) @label |
jump命令で無条件分岐可能。 | 例) jump label |
■ふつ〜の関数
No. | 関数 | 働き |
1 | llSay(integer channel, string message) llWhisper(integer channel, string message) llShout(integer channel, string message) | 話す、囁く、叫ぶ (チャット) 通常会話のチャネルは0番。 |
2 | llGetPos() | 座標値を取得する |
3 | llRezObject(string inventory, vector pos, vector vel, rotaton rot, integer param) llRezAtRoot(string inventory, vector pos, vector vel, rotation rot, integer param) | オブジェクトを出現(rez)させる |
4 | llOwnerSay(string message) llRegiaonSay(integer channel, string message) | オーナーのみにSay SIM全域にSay |
5 | llSetText(string text, vector color, float alpha) | テキスト表示 |
6 | string llStringToBase64(string str) string llBase64ToString(string str) | stringとBase64文字列との変換 |
7 | string llEscapeURL(string str) string llUnescapeURL(string str) | stringとURLエンコード文字列との変換 |
8 | llSetSitText(string text) llSetTouchText(string text) | パイメニューの表示を変更 |
9 | integer llStringLength(sting str) string llGetSubString(string str, integer start, integer end) llInsertString(string dst, integer position, string str) string llDeleteSubString(string src, integer start, integer end) integer llSubStringIndex(string source, string pattern) | 文字列処理 |
10 | float llFrand(float max) | 乱数発生(0.0〜MAX) |
11 | integer llFloor(float val) | 切捨て(valを超えない最大の整数値に) |
12 | key llGetKey() string llGetObjectName() string llGetObjectDesc() key llGetCreator() key llGetOwner() integer llGetStatus(integer status) | オブジェクトの情報を取得 |
13 | llSetStatus(integer status, integer value) | オブジェクトのステータスを設定 |
14 | string llKey2Name(key id) | key値からオブジェクト名を取得 |
15 | integer llGetNumberOfSides() llSerColor(vector color, integer face) llGetColor(integer face) llSetAlpha(float alpha, integer face float llGetALpha(integer side) llSetTexture(string textureName, integer face) string llGetTexture(integer face) | オブジェクトへの色、透明度、テクスチャの設定 ALL_SIDESですべての面 |
16 | llDialog(key avatar_id, string message, list buttons, integer channel) | 指定アバターへのダイアログ表示 |
17 | llSetPos(vector pos) vector llGetPos() llSetScale(vector scale) vector llGetScale() llSetRot(rotation rot) rotation llGetRot() | オブジェクトの位置、サイズ、回転 |
18 | vector llGetRootPosition() vector llGetLocalPos() rotation llGetRootRotation() rotation llGetLOcalRot() | リンクされたオブジェクトの位置、回転を取得 |
19 | llTargetOmega(vector axis, float spinrate, float gain) | 軸を中心に永遠に回転運動 |
20 | integer llGetPermissions() key llGetPermissionsKey() | 現在のパーミッション取得状況を知る |
21 | llStartAnimation(string anim) llStopAnimation(string anim) | アバターへをアニメーション開始、終了させる |
22 | ||
23 | ||
24 | ||
25 | ||
26 |
■イベントハンドラ
No. | イベント | イベントハンドラ |
1 | 状態遷移した | state_entry() state_end() |
2 | 触わられた(Touch) | touch_start(integer 現在触っている人数) touch(integer 現在触っている人数) touch_end(integer 現在触っている人数) |
3 | Sayされた | listen(integer channel, string name, key id, string message) |
4 | セットした時刻が経過した | timer() |
5 | 添付(Attach)された | attach(key id) |
6 | 移動された | moving_start() moving_end() |
7 | お金が支払われた | money(key id, integer amount) |
8 | 指定した座標に到達した | at_target(integer tnum, vector targetpos, vector ourpos) not_at_target() |
9 | 指定した向きに到達した | at_rot_target(integer tnum, rotation targetrot, rotation ourrot) not_at_rot_targer() |
10 | オブジェクトが出現(rez)した | on_rez(integer start_param) |
11 | 衝突された | collision_start(integer total_number) collision(integer total_number) collision_end(integer total_number) |
12 | センサー範囲に入られた | sensor(integer total_number) no_sensor() |
13 | idで定義した関数でイベントが発生した | dataserver(key id, string data) |
14 | パーミッション要求に返答された | run_time_permissions(integer perm) |
15 | ||
16 | ||
17 | ||
18 |
■イベント発生条件、発生条件指定用の関数
No. | 対応するイベント | 関数 |
1 | listen(...) | llListen(integer channel, string name, key id, string message) llListenRemove(integer listenNumber) llListenControl(integer listenNumber, integer active) |
2 | timer() | llSetTimerEvent(float sec) |
3 | at_target(...) not_at_target() | integer llTarget(vector position, float range) llTargetRemove(integer tnumber) |
4 | at_rot_target(...) not_at_rot_target() | integer llRotTarget(rotation rot, float error) llRotTargetRemove(integer rnumber) |
5 | sensor(...) no_sensor() | llSensor(string name, key id, integer type, float range, float arc) llSensorRepeat(string name, key id, integer type, float range, float arc, float sec) |
6 | dataserver(...) | key llGetNotecardLine(string noteName, integer lineNumber) key GetNumberOfNotecardLines(string noteName) |
7 | run_time_permissions(...) | llRequastPermissions(key agent_id, integer perm) |
8 | ||
9 | ||
10 |
■Detection系関数群
touch_start(), touch(), touch_end()のイベント発生時において使用可能な、触ってきたアバターの情報を得るための関数群。
No. | 関数 | 得られる情報 |
1 | string llDetectedName(integer number) | 名前 |
2 | key llDetectedKey(integer number) | UUID |
3 | vector llDetectedPos(integer number) | 座標 |
4 | rotation llDetectedRot(integer number) | Rotation |
5 | integer llDetectedType(integer number) | 種類 (AGENT, ACTIVE, PASSIVE, SCRIPTED) |
■パーミッション定数
No. | ||
1 | PERMISSION_TRIGGER_ANIMATION | |
2 | PERMISSION_ATTACH | |
3 | PERMISSION_TRACK_KAMERA | |
4 | PERMISSION_TAKE_CONTROL | |
5 | ||
6 | ||
7 | ||
8 | ||
9 | ||
10 |