“LlRequestPermissions”的版本间的差异
(未显示同一用户的3个中间版本) | |||
第80行: | 第80行: | ||
</pre> | </pre> | ||
|相关函数= | |相关函数= | ||
− | [[]] | + | [[llGetPermissions]] - 获得已授予的权限 |
− | [[]] | + | [[llGetPermissionsKey]] - 获取授予权限的化身。 |
− | |||
|相关事件= | |相关事件= | ||
+ | [[run_time_permissions]] - 允许接收事件 | ||
}} | }} | ||
附录:(表格) | 附录:(表格) | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
− | ! | + | ! colspan="2" |Constants |
− | ! | + | ! Action |
− | ! | + | ! Category |
+ | ! Granter | ||
+ | ! Automatically granted when… | ||
|- | |- | ||
− | | | + | | [[PERMISSION_DEBIT]] |
− | | | + | | 0x2 |
− | | | + | | 从代理人的账户中取钱 |
+ | | [[Money]] | ||
+ | | Owner | ||
+ | | | ||
|- | |- | ||
− | | | + | | [[PERMISSION_TAKE_CONTROLS]] |
− | | | + | | 0x4 |
− | | | + | | take agent's [[controls]] |
+ | | [[Control]] | ||
+ | | Anyone | ||
+ | | sat on, attached | ||
+ | |- | ||
+ | | [[PERMISSION_TRIGGER_ANIMATION]] | ||
+ | | 0x10 | ||
+ | | start or stop [[Animations]] on agent | ||
+ | | [[Animation]] | ||
+ | | Anyone | ||
+ | | sat on, attached | ||
+ | |- | ||
+ | | [[PERMISSION_ATTACH]] | ||
+ | | 0x20 | ||
+ | | [[attach]]/[[detach]] from agent | ||
+ | | [[Attachment]] | ||
+ | | [[Owner]] or [[Anyone]] | ||
+ | | attached | ||
+ | |- | ||
+ | | [[PERMISSION_CHANGE_LINKS]] | ||
+ | | 0x80 | ||
+ | | change [[links]] | ||
+ | | [[Link]] | ||
+ | | Owner | ||
+ | | | ||
+ | |- | ||
+ | | [[PERMISSION_TRACK_CAMERA]] | ||
+ | | 0x400 | ||
+ | | track the agent's [[camera]] [[position]] and [[rotation]] | ||
+ | | [[Camera]] | ||
+ | | Anyone | ||
+ | | sat on, attached | ||
+ | |- | ||
+ | | [[PERMISSION_CONTROL_CAMERA]] | ||
+ | | 0x800 | ||
+ | | control the agent's camera ([[must be sat on or attached; automatically revoked on stand or detach]]) | ||
+ | | [[Camera]] | ||
+ | | Anyone | ||
+ | | sat on,attached | ||
+ | |- | ||
+ | | [[PERMISSION_TELEPORT]] | ||
+ | | 0x1000 | ||
+ | | [[teleport]] the agent | ||
+ | | [[Teleport]] | ||
+ | | Anyone | ||
+ | | | ||
+ | |- | ||
+ | | [[PERMISSION_SILENT_ESTATE_MANAGEMENT]] | ||
+ | | 0x4000 | ||
+ | | [[manage estate access]] without notifying the owner of changes | ||
+ | | [[Estate]] | ||
+ | | Owner | ||
+ | | | ||
+ | |- | ||
+ | | [[PERMISSION_OVERRIDE_ANIMATIONS]] | ||
+ | | 0x8000 | ||
+ | | configure the overriding of default [[animations]] on agent | ||
+ | | [[Animation]] | ||
+ | | Anyone | ||
+ | | attached | ||
+ | |- | ||
+ | | [[PERMISSION_RETURN_OBJECTS]] | ||
+ | | 0x10000 | ||
+ | | Used by [[llReturnObjectsByOwner]] and [[llReturnObjectsByID]] to return objects from parcels | ||
+ | | [[Cleanup]] | ||
+ | | Owner, Group Owner | ||
+ | | | ||
|} | |} |
2020年8月5日 (三) 04:26的最新版本
首页 | 函数 | 事件 | 类型 | 操作符 | 常数 | Flow Control | Script Library | Categorized Library | Tutorials |
函数名 |
---|
Function: llRequestPermissions( key agent, integer permissions ); |
参数:• key agent – 在同一区域的化身UUID
• integer permissions – 权限掩码(包含请求权限的位域) |
返回值:向代理请求运行某些类函数的权限。
脚本继续执行,不等待响应。当给出响应时,将在事件队列中放置一个run_time_permissions事件。 |
注意事项 |
---|
一个对话框将显示给代理,以授予这些权限,除非自动授予,如附录所示。
如果对象附加到代理,“自动”权限被授予请求而不通知。 权限可以跨状态更改持久化。 不管授予是否是自动的,您都应该始终使用run_time_permissions事件。授予权限需要时间,在调用run_time_permissions处理程序之前,不应该假定它已经完成。 菜单选项“停止动画我”将释放某些权限(PERMISSION_TRIGGER_ANIMATION和PERMISSION_OVERRIDE_ANIMATIONS),如果拥有这些权限的脚本与代理在同一区域,并且脚本没有附加到权限授予者。 权限不会累积。 如果在之前对该函数的调用中请求了权限并授予了该权限,那么在随后的调用中没有请求,该权限将被释放(丢失)。 要同时请求两个或多个权限,请使用位或操作符,例如: llRequestPermissions(AvatarID, PERMISSION_TAKE_CONTROLS (PERMISSION_TRIGGER_ANIMATION)) 对每个脚本分别请求和授予权限,即使它们位于相同的对象中。 目前根本不可能请求没有权限(见下面的问题);作为一种解决方案,llResetScript可以使用。 脚本一次只能持有一个代理的权限。要拥有多个代理的权限,您必须使用多个脚本。 授予权限的结果会立即影响llGetPermissions和llGetPermissionsKey的返回,尽管run_time_permissions事件正在排队,或者如果对象的事件队列已满,则会删除该事件。 权限请求对话框永远不会超时。 如果一个脚本发出两个权限请求,最后一个响应将被视为已授予的权限。 查看器将任何代理对任何其他代理的权限请求限制为10秒内5个对话框。 权限请求和改变状态… 请求处于一种状态的权限,然后在代理响应之前更改状态,将导致在代理响应之后以新状态触发run_time_permissions。 只请求在一种状态下自动授予的权限,然后立即更改状态,将永远不会触发run_time_permissions。 |
示例 |
---|
请求允许动画化身
default { touch_start(integer detected) { llRequestPermissions(llDetectedKey(0), PERMISSION_TRIGGER_ANIMATION); } run_time_permissions(integer perm) { if (perm & PERMISSION_TRIGGER_ANIMATION) { llStartAnimation("sit"); llOwnerSay("animation will end in 5 seconds"); llSetTimerEvent(5.0); } } timer() { llSetTimerEvent(0.0); llStopAnimation("sit"); } } 要同时请求两个(或更多)权限,请使用按位或操作符。 llRequestPermissions(AvatarID, PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION); - or - integer perms = PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION; llRequestPermissions(AvatarID, perms); |
相关函数 |
---|
llGetPermissions - 获得已授予的权限
llGetPermissionsKey - 获取授予权限的化身。 |
相关事件 |
---|
run_time_permissions - 允许接收事件 |
附录:(表格)
Constants | Action | Category | Granter | Automatically granted when… | |
---|---|---|---|---|---|
PERMISSION_DEBIT | 0x2 | 从代理人的账户中取钱 | Money | Owner | |
PERMISSION_TAKE_CONTROLS | 0x4 | take agent's controls | Control | Anyone | sat on, attached |
PERMISSION_TRIGGER_ANIMATION | 0x10 | start or stop Animations on agent | Animation | Anyone | sat on, attached |
PERMISSION_ATTACH | 0x20 | attach/detach from agent | Attachment | Owner or Anyone | attached |
PERMISSION_CHANGE_LINKS | 0x80 | change links | Link | Owner | |
PERMISSION_TRACK_CAMERA | 0x400 | track the agent's camera position and rotation | Camera | Anyone | sat on, attached |
PERMISSION_CONTROL_CAMERA | 0x800 | control the agent's camera (must be sat on or attached; automatically revoked on stand or detach) | Camera | Anyone | sat on,attached |
PERMISSION_TELEPORT | 0x1000 | teleport the agent | Teleport | Anyone | |
PERMISSION_SILENT_ESTATE_MANAGEMENT | 0x4000 | manage estate access without notifying the owner of changes | Estate | Owner | |
PERMISSION_OVERRIDE_ANIMATIONS | 0x8000 | configure the overriding of default animations on agent | Animation | Anyone | attached |
PERMISSION_RETURN_OBJECTS | 0x10000 | Used by llReturnObjectsByOwner and llReturnObjectsByID to return objects from parcels | Cleanup | Owner, Group Owner |