Difference between revisions of "LlRemoteLoadScriptPin/ja"

From Second Life Wiki
Jump to navigation Jump to search
m (Apply LSLG Template)
m
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{LSL_Function/inventory/ja|name|uuid=false|type=スクリプト}}{{Issues/SVC-3321}}
{{LSL_Function/give/ja|target|name|sim=*|uuid=false|type=script|prim=*}}{{Issues/SVC-3321}}
{{LSL_Function/ja
{{LSL_Function/ja
|func_id=253|func_sleep=3.0|func_energy=10.0
|func_id=253|func_sleep=3.0|func_energy=10.0
|func=llRemoteLoadScriptPin
|func=llRemoteLoadScriptPin
|p1_type=key|p1_name=target|p1_desc=同じリージョンにあるプリム
|func_desc=スクリプト '''name''' を '''target''' へコピーし、'''start_param''' を '''running''' に設定する。
|p1_type=key|p1_name=target|p1_desc
|p2_type=string|p2_name=name|p2_desc
|p2_type=string|p2_name=name|p2_desc
|p3_type=integer|p3_name=pin|p3_desc={{LSLG/ja|llSetRemoteScriptAccessPin}} によって設定された pin と値が一致しなければなりません。
|p3_type=integer|p3_name=pin|p3_desc={{LSLG/ja|llSetRemoteScriptAccessPin}} によって設定された pin と値が一致しなければなりません。
|p4_type=integer|p4_name=running|p4_desc=スクリプトを開始させるならば 0 以外を、開始しないならば 0 を設定する。
|p4_type=integer|p4_name=running|p4_desc=スクリプトを起動状態として設定するかの boolean 値。
|p5_type=integer|p5_name=start_param|p5_desc=スクリプト '''target''' で {{LSLG/ja|llGetStartParameter}} を実行すると返される値。
|p5_type=integer|p5_name=start_param|p5_desc=スクリプト '''target''' で {{LSLG/ja|llGetStartParameter}} を実行すると返される値。
|func_desc=スクリプト '''name''' を '''target''' へコピーし、'''running''' が 0 以外ならば開始パラメタ '''start_param''' で開始させる。
|func_footnote=このスクリプトの入っているオブジェクトのオーナーが '''target''' の修正権限を持っている場合に限り動作します。
|func_footnote=このスクリプトの入っているオブジェクトのオーナーが '''target''' の修正権限を持っている場合に限り動作します。
|return_text
|return_text
|spec
|spec
|caveats=
|caveats=
* '''name''' が '''target''' のインベントリに存在している場合、警告を出すことなく置き換えます。
* '''start_param''' の値はスクリプトがリセットされると失われます。
* '''start_param''' の値はスクリプトがリセットされると失われます。
* '''target''' が別のユーザに{{LSLGC|Attachment/ja|装備}}されたオブジェクトの場合、オブジェクトの修正権限の如何に関わらず、この関数はエラー表示を出さずに (バグ?) 失敗します。{{Footnote|{{LSLGC|Attachment/ja|装備}}したオブジェクトはそのオーナーだけが修正できます。|装備したオブジェクトはそのオーナーだけが修正できます。}}
* '''target''' が別のユーザに{{LSLGC/ja|Attachment|装備}}されたオブジェクトの場合、オブジェクトの修正権限の如何に関わらず、この関数はエラー表示を出さずに (バグ?) 失敗します。{{Footnote|{{LSLGC/ja|Attachment|装備}}したオブジェクトはそのオーナーだけが修正できます。|装備したオブジェクトはそのオーナーだけが修正できます。}}
* '''pin''' が一致しなかった場合、"Task ~Prim~ trying to illegally load script onto task ~Other_Prim~!" というエラーメッセージが {{LSLG/ja|DEBUG_CHANNEL}} で shout されます。"~Prim~" と "~Other_Prim~" はそれぞれ該当するプリム名に置き換えられます。
* '''pin''' が一致しなかった場合、"Task ~Prim~ trying to illegally load script onto task ~Other_Prim~!" というエラーメッセージが {{LSLG/ja|DEBUG_CHANNEL}} で shout されます。"~Prim~" と "~Other_Prim~" はそれぞれ該当するプリム名に置き換えられます。
* '''target''' が無効の場合、"Unable to add item!" というエラーメッセージが {{LSLG/ja|DEBUG_CHANNEL}} で shout されます。'''target''' が無効とされるのは以下のような場合です:
* '''target''' がスクリプトの所属先である場合 ('''target''' == {{LSLG/ja|llGetKey}}()) 、"Unable to add item!" {{LSLG/ja|DEBUG_CHANNEL}} で shout されます。
** {{LSLG/ja|llGetKey}} の戻り値と等しい。(訳注: すなわち自分自身にコピーを送ろうとしている。)
* スクリプトの入ったオブジェクトがグループに譲渡されている場合、たとえ '''target''' が同じグループに譲渡されていても、転送される '''name''' のスクリプトに謙譲権限が必要です。
* バージョン 1.25.4 においてこの関数は、フルパーミションのスクリプトでなければ、装備されたオブジェクトへコピー/移動することができませんでした。([https://jira.secondlife.com/browse/SVC-3725 SVC-3725])
* スクリプトが ('''running''' 、または実行中チェックボックス、または {{LSLG/ja|llSetScriptState}} ) 実行状態に設定されると、{{LSLG/ja|state_entry}} がキューに入ります。
** バージョン 1.25.4 においてこの関数は、送り先に対してコピーとトランスファー (およびそれ以上) の権限を持っていれば、スクリプトをコピー/移動できるようになりました。([https://jira.secondlife.com/browse/SVC-3738 SVC-3738])
* llRemoteLoadScriptPin() を使ったスクリプトの入ったオブジェクトがグループに譲渡されている場合、たとえ転送先のオブジェクトが同じグループに譲渡されていても、転送されるスクリプトにトランスファー権限が必要です。
|constants
|constants
|examples=
|examples=
<lsl>//Child Prim PIN setter
==== Basic Example ====
=====Pin setter=====
Simple script used for setting the pin for a prim, so you can later send scripts to it with llRemoteLoadScriptPin.
<source lang="lsl2">
integer PIN=1341134;
integer PIN=1341134;


default {
default {
state_entry() {
    state_entry() {
         llOwnerSay(llGetObjectName()+" : "+(string)llGetKey()+" は一致する PIN で指定されたスクリプトを受け入れる準備ができました。");
         llOwnerSay(llGetObjectName()+" : "+(string)llGetKey()+" は一致する PIN で指定されたスクリプトを受け入れる準備ができました。");
         llSetRemoteScriptAccessPin(PIN);
         llSetRemoteScriptAccessPin(PIN);
    }
}</source>
=====Script copier=====
<source lang="lsl2">
//子プリムの PIN をセットする
integer PIN=1341134;
default {
    state_entry() {
        //Remotely load the script name "some script"
        llRemoteLoadScriptPin( llGetLinkKey(2), "some script", PIN, TRUE, 0xBEEEEEEF );
    }
}</source>
==== Rez and copy a file from a control object ====
注意: 現在、開始メッセージに署名はありません。所有者のみが確認されます。
この例では、インベントリからプリムをrezし、その中に基本的な制御ファイルを持たせ、基本的なハンドシェイクを行ってピンを設定し、スクリプトを転送します。


転送が完了したら、rezしたプリム内のヘルパースクリプトは自動的に削除されます。
===== Control prim =====
<source lang="lsl2">
integer controlchan = 0;
integer controlid = -1;
start()
{
    llSetTimerEvent(0);
    talkingto = NULL_KEY;
    integer a = (integer)llFrand(43);
    controlchan = a * a;
    controlchan -= controlchan * 3;
    controlid = llListen(controlchan,"","","set-connect");
    llRezObject("card",llGetPos()+<0,0,0.1>,<0,0,0>,ZERO_ROTATION,a);
    llSetTimerEvent(60);
}
key talkingto = NULL_KEY;
integer busy = FALSE;
integer accesspin = 0;
default
{
    timer()
    {
        llSetTimerEvent(0);
        llOwnerSay("Lost connection!");
        llListenRemove(controlid);
        busy = FALSE;
     }
     }
}</lsl>
    listen(integer chan,string name,key id,string message)
    {
        if(chan == controlchan)
        {
            if(llGetOwnerKey(id) == llGetOwner())
            {
                if(talkingto == NULL_KEY)
                {
                    if(message == "set-connect")
                    {
                        llSetTimerEvent(0);
                        talkingto = id;
                        llListenRemove(controlid);
                        controlid = llListen(controlchan,"",talkingto,"ready");
                        llRegionSayTo(id,controlchan,"auto-connect");
                        llSetTimerEvent(60);
                    }
                } 
                else if(id == talkingto)
                {
                    if(message == "ready")
                    {
                        llSetTimerEvent(0);
                        accesspin = (integer)llFrand(2345)+213;
                        llListenRemove(controlid);
                        controlid = llListen(controlchan,"",talkingto,"pinset");
                        llSleep(1);
                        llRegionSayTo(talkingto,controlchan,(string)accesspin);
                        llSetTimerEvent(60);
                    }
                    else if(message == "pinset")
                    {
                        llSetTimerEvent(0);
                        llListenRemove(controlid);
                        llRemoteLoadScriptPin(talkingto,"demo.lsl",accesspin,1,0);
                        llSleep(3);
                        llRegionSayTo(talkingto,controlchan,"finished");
                        llOwnerSay("Transfer of file finished - control file should have auto deleted itself!");
                        busy = FALSE;
                    }
                }
            } 
        }
    }
    touch_end(integer a)
    {
        if(busy == FALSE)
        {
            busy = TRUE;
            if(llGetOwner() == llDetectedKey(0))
            {
                start();
            }
        }
    }
}
</source>
 
===== rezzed prim =====
<source lang="lsl2">
integer listen_id = -1;
integer listen_chan = -1;
key details_from = NULL_KEY;
default
{
    on_rez(integer a)
    {
        if(a == 0)
        {
            llOwnerSay("- Direct rez -");
        }
        else
        {
            llOwnerSay("- Awaiting config connection -");
            listen_chan = a * a;
            listen_chan -= listen_chan * 3;
            listen_id = llListen(listen_chan,"","","auto-connect");
            llWhisper(listen_chan,"set-connect");
            llSetTimerEvent(30);
        }
    }
    timer()
    {
        llOwnerSay("Failed to connect to rezzer deleting myself!");
        llSetTimerEvent(0);
        llDie();
    }
    listen(integer chan,string name,key id,string message)
    {
        if(llGetOwnerKey(id) == llGetOwner())
        {
            if(message == "auto-connect")
            {
                llSetTimerEvent(0);
                llListenRemove(listen_id);
                listen_id = llListen(listen_chan,"",id,"");
                llRegionSayTo(id,listen_chan,"ready");
                details_from = id;
                llSetTimerEvent(30);               
            }
            else if(details_from != NULL_KEY)
            {
                llSetTimerEvent(0); 
                if(message == "finished")
                {
                    llSetRemoteScriptAccessPin((integer)message);
                    llRemoveInventory(llGetScriptName());       
                }
                else
                {
                    llSetRemoteScriptAccessPin((integer)message);
                    llRegionSayTo(id,listen_chan,"pinset");
                }
                llSetTimerEvent(30); 
            }
        }
    }
}
</source>
 
|helpers
|helpers
|also_functions={{LSL DefineRow||{{LSLG/ja|llSetRemoteScriptAccessPin}}|送り先プリムの準備に使う}}
|also_functions={{LSL DefineRow||{{LSLG/ja|llSetRemoteScriptAccessPin}}|送り先プリムの準備に使う}}
{{LSL DefineRow||[[llSetScriptState]]|スクリプトの起動状態を設定する}}
{{LSL DefineRow||[[llResetOtherScript]]|プリムの他のスクリプトをリセットする}}
|also_tests
|also_tests
|also_events
|also_events
|also_articles
|also_articles
|history=
* 1.2.6 で追加
* SL 1.25.4 でこの関数はスクリプトがフルパーミッションでない限り、アタッチメントの中のスクリプトをコピー・移動しなくなった。([https://jira.secondlife.com/browse/SVC-3725 SVC-3725])
* SL 1.25.5 でこの関数は、送り先がコピーと謙譲権限をもつ (もしくはもっと限定された) 場合に限り、アタッチメントの中のスクリプトをコピー・移動できるようになった。([https://jira.secondlife.com/browse/SVC-3738 SVC-3738])
|notes
|notes
|cat1=Script
|cat1=Script

Latest revision as of 03:13, 8 October 2023

要約

関数: llRemoteLoadScriptPin( key target, string name, integer pin, integer running, integer start_param );

スクリプト nametarget へコピーし、start_paramrunning に設定する。

• key target 同じ 地域 にある プリムUUID
• string name プリムの インベントリ の中にあるscript
• integer pin llSetRemoteScriptAccessPin によって設定された pin と値が一致しなければなりません。
• integer running スクリプトを起動状態として設定するかの boolean 値。
• integer start_param スクリプト targetllGetStartParameter を実行すると返される値。

このスクリプトの入っているオブジェクトのオーナーが target の修正権限を持っている場合に限り動作します。

警告

  • この関数は 3.0 秒間、スクリプトを停止します。
  • target が 同じ人によって所有されておらず, かつ name が謙譲不可能の場合、 DEBUG_CHANNEL でエラーが叫ばれます。
  • name がコピー可能でない場合、 エラーがDEBUG_CHANNEL 上で叫ばれます。
  • target 同じ地域でない場合、 DEBUG_CHANNEL でエラーが叫ばれます。
  • スクリプトが持ち物間でコピーまたは移動された場合、これらの State は引き継がれません。メモリやイベントキューや実行位置は全て破棄されます。
  • name がプリムの中で見つからない場合、またはこれがscriptでない場合、エラーが DEBUG_CHANNEL 上で叫ばれます。
  • nametarget のインベントリに存在している場合、警告を出すことなく置き換えます。
  • start_param の値はスクリプトがリセットされると失われます。
  • target が別のユーザに装備されたオブジェクトの場合、オブジェクトの修正権限の如何に関わらず、この関数はエラー表示を出さずに (バグ?) 失敗します。[1]
  • pin が一致しなかった場合、"Task ~Prim~ trying to illegally load script onto task ~Other_Prim~!" というエラーメッセージが DEBUG_CHANNEL で shout されます。"~Prim~" と "~Other_Prim~" はそれぞれ該当するプリム名に置き換えられます。
  • target がスクリプトの所属先である場合 (target == llGetKey()) 、"Unable to add item!" が DEBUG_CHANNEL で shout されます。
  • スクリプトの入ったオブジェクトがグループに譲渡されている場合、たとえ target が同じグループに譲渡されていても、転送される name のスクリプトに謙譲権限が必要です。
  • スクリプトが (running 、または実行中チェックボックス、または llSetScriptState で) 実行状態に設定されると、state_entry がキューに入ります。

Important Issues

~ All Issues ~ Search JIRA for related Bugs
   stack trace error while running scripts after llRemoteLoadScriptPin

サンプル

Basic Example

Pin setter

Simple script used for setting the pin for a prim, so you can later send scripts to it with llRemoteLoadScriptPin.

integer PIN=1341134;

default {
    state_entry() {
        llOwnerSay(llGetObjectName()+" : "+(string)llGetKey()+" は一致する PIN で指定されたスクリプトを受け入れる準備ができました。");
        llSetRemoteScriptAccessPin(PIN);
    }
}
Script copier
//子プリムの PIN をセットする
integer PIN=1341134;

default {
    state_entry() {
        //Remotely load the script name "some script"
        llRemoteLoadScriptPin( llGetLinkKey(2), "some script", PIN, TRUE, 0xBEEEEEEF );
    }
}

Rez and copy a file from a control object

注意: 現在、開始メッセージに署名はありません。所有者のみが確認されます。

この例では、インベントリからプリムをrezし、その中に基本的な制御ファイルを持たせ、基本的なハンドシェイクを行ってピンを設定し、スクリプトを転送します。

転送が完了したら、rezしたプリム内のヘルパースクリプトは自動的に削除されます。

Control prim
integer controlchan = 0;
integer controlid = -1;
start()
{
    llSetTimerEvent(0);
    talkingto = NULL_KEY;
    integer a = (integer)llFrand(43);
    controlchan = a * a;
    controlchan -= controlchan * 3;
    controlid = llListen(controlchan,"","","set-connect");
    llRezObject("card",llGetPos()+<0,0,0.1>,<0,0,0>,ZERO_ROTATION,a);
    llSetTimerEvent(60);
}
key talkingto = NULL_KEY;
integer busy = FALSE;
integer accesspin = 0;
default
{
    timer()
    {
        llSetTimerEvent(0);
        llOwnerSay("Lost connection!");
        llListenRemove(controlid);
        busy = FALSE;
    }
    listen(integer chan,string name,key id,string message)
    {
        if(chan == controlchan)
        {
            if(llGetOwnerKey(id) == llGetOwner())
            {
                if(talkingto == NULL_KEY)
                {
                    if(message == "set-connect")
                    {
                        llSetTimerEvent(0);
                        talkingto = id;
                        llListenRemove(controlid);
                        controlid = llListen(controlchan,"",talkingto,"ready");
                        llRegionSayTo(id,controlchan,"auto-connect");
                        llSetTimerEvent(60);
                    }
                }   
                else if(id == talkingto)
                {
                    if(message == "ready")
                    {
                        llSetTimerEvent(0);
                        accesspin = (integer)llFrand(2345)+213;
                        llListenRemove(controlid);
                        controlid = llListen(controlchan,"",talkingto,"pinset");
                        llSleep(1);
                        llRegionSayTo(talkingto,controlchan,(string)accesspin);
                        llSetTimerEvent(60);
                    }
                    else if(message == "pinset")
                    {
                        llSetTimerEvent(0);
                        llListenRemove(controlid);
                        llRemoteLoadScriptPin(talkingto,"demo.lsl",accesspin,1,0);
                        llSleep(3);
                        llRegionSayTo(talkingto,controlchan,"finished");
                        llOwnerSay("Transfer of file finished - control file should have auto deleted itself!");
                        busy = FALSE;
                    }
                } 
            }   
        }
    }
    touch_end(integer a)
    {
        if(busy == FALSE)
        {
            busy = TRUE;
            if(llGetOwner() == llDetectedKey(0))
            {
                start();
            }
        }
    }
}
rezzed prim
integer listen_id = -1;
integer listen_chan = -1;
key details_from = NULL_KEY;
default
{
    on_rez(integer a)
    {
        if(a == 0)
        {
            llOwnerSay("- Direct rez -");
        }
        else
        {
            llOwnerSay("- Awaiting config connection -");
            listen_chan = a * a;
            listen_chan -= listen_chan * 3;
            listen_id = llListen(listen_chan,"","","auto-connect");
            llWhisper(listen_chan,"set-connect");
            llSetTimerEvent(30);
        }
    }
    timer()
    {
        llOwnerSay("Failed to connect to rezzer deleting myself!");
        llSetTimerEvent(0);
        llDie();
    }
    listen(integer chan,string name,key id,string message)
    {
        if(llGetOwnerKey(id) == llGetOwner())
        {
            if(message == "auto-connect")
            {
                llSetTimerEvent(0);
                llListenRemove(listen_id);
                listen_id = llListen(listen_chan,"",id,"");
                llRegionSayTo(id,listen_chan,"ready");
                details_from = id;
                llSetTimerEvent(30);                 
            }
            else if(details_from != NULL_KEY)
            {
                llSetTimerEvent(0);  
                if(message == "finished")
                {
                    llSetRemoteScriptAccessPin((integer)message);
                    llRemoveInventory(llGetScriptName());         
                }
                else
                {
                    llSetRemoteScriptAccessPin((integer)message);
                    llRegionSayTo(id,listen_chan,"pinset");
                } 
                llSetTimerEvent(30);  
            }
        }
    }
}

関連項目

関数

•  llSetRemoteScriptAccessPin 送り先プリムの準備に使う
•  llSetScriptState スクリプトの起動状態を設定する
•  llResetOtherScript プリムの他のスクリプトをリセットする

特記事項

経緯

  • 1.2.6 で追加
  • SL 1.25.4 でこの関数はスクリプトがフルパーミッションでない限り、アタッチメントの中のスクリプトをコピー・移動しなくなった。(SVC-3725)
  • SL 1.25.5 でこの関数は、送り先がコピーと謙譲権限をもつ (もしくはもっと限定された) 場合に限り、アタッチメントの中のスクリプトをコピー・移動できるようになった。(SVC-3738)

All Issues

~ Search JIRA for related Issues
   stack trace error while running scripts after llRemoteLoadScriptPin

脚注

  1. ^ 装備したオブジェクトはそのオーナーだけが修正できます。

Signature

function void llRemoteLoadScriptPin( key target, string name, integer pin, integer running, integer start_param );
この翻訳は 原文 と比べて古いですか?間違いがありますか?読みにくいですか?みんなで 修正 していきましょう! (手順はこちら)
この項目はあなたにとって参考にならない項目ですか?もしかしたらLSL Wikiの関連した項目が参考になるかもしれません。