Difference between revisions of "Touch start/ja"

From Second Life Wiki
Jump to navigation Jump to search
m
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{LSL Event/ja
{{Issues/SVC-3017/ja}}{{LSL_Event/ja|event_id=2|event_delay|event=touch_start
|event_id=2
|event_delay
|event=touch_start
|p1_type=integer
|p1_type=integer
|p1_name=num_detected
|p1_name=num_detected
|p1_desc=最後のクロック周期までにタッチして探知されたエージェントの数
|p1_desc=最後のクロック周期に検出されたエージェントの数
|event_desc=エージェントがタスクを起動することによって作動します。
|event_desc=エージェントがタスクのクリックを開始したときに発生します。
|constants
|constants
|spec
|spec
|caveats
|caveats=* プリムの [[face|面]] で [[Navigating Shared Media|Shared Media]] が動作していて、アバターのビューワがその機能をサポートしている場合、 LSL スクリプトはこの面に対するタッチを検出しません。以前のビューワでのタッチされたものは検出します。
|examples=エージェントのキーを探知するのに、0からnum_detected - 1の数値を使用することができます。
|examples=0 から num_detected - 1 までループさせて、検出したエージェントのキーを取得してみましょう:
<lsl>default
<source lang="lsl2">default
{  
{  
     touch_start(integer num_detected)
     touch_start(integer num_detected)
Line 19: Line 16:
             llWhisper(0, "Touched by " + llKey2Name(llDetectedKey(i)));
             llWhisper(0, "Touched by " + llKey2Name(llDetectedKey(i)));
     }
     }
}</lsl>
}</source><source lang="lsl2">// If using a touch to change states be careful about the touch_ event order...
 
// On clicking a prim with touch events we trigger touch_start (as), touch (during) and touch_end (as released).
 
// The chain of events is established in the script as touch_start is triggered that remains intact until either
 
// touch_end is triggered or a new touch_start (discounting resets, deletions, taking to inventory etc.).
 
default
{
    touch_start(integer nd)
    {
        llSay(0, "You just started touching me so I'm going to the other state...");
        state other;
    }
// A very rapid click would (and does if your VERY quick) beat the state change so the script would/does not behave as expected.
}
state other
{
    touch_end(integer nd)
    {
// The average click will have you catapult through this state with nothing but a chatted message to remember it by.
        llSay(0, "The touch that brought you here just ended so I'm going back to default...");
        state default;
    }
}</source>
|helpers
|helpers
|also_header
|also_header
|also_events=
|also_events=
{{LSL DefineRow||[[touch/ja|touch]]|}}
{{LSL DefineRow||[[touch]]|}}
{{LSL DefineRow||[[touch_end/ja|touch_end]]|}}
{{LSL DefineRow||[[touch_end]]|}}
|also_functions=
|also_functions=
{{LSL DefineRow||[[llSetTouchText/ja|llSetTouchText]]|}}
{{LSL DefineRow||[[llSetTouchText]]|}}
{{LSL DefineRow||[[llPassTouches/ja|llPassTouches]]|}}
{{LSL DefineRow||[[llPassTouches]]|}}
{{LSL DefineRow||[[LlDetectedTouchFace]]|}}
{{LSL DefineRow||[[LlDetectedTouchST]]|}}
{{LSL DefineRow||[[LlDetectedTouchUV]]|}}
{{LSL DefineRow||[[LlDetectedTouchPos]]|}}
{{LSL DefineRow||[[LlDetectedTouchNormal]]|}}
{{LSL DefineRow||[[LlDetectedTouchBinormal]]|}}
|also_articles
|also_articles
|also_footer
|also_footer

Latest revision as of 10:29, 21 February 2016

説明

! イベント: touch_start( integer num_detected ){ ; }

エージェントがタスクのクリックを開始したときに発生します。

• integer num_detected 最後のクロック周期に検出されたエージェントの数

警告

  • タッチ系 イベント がない state からタッチ系イベントがある state に遷移すると、最初のタッチ系イベントは失われます。これは 3 つのタッチ系イベント全て (touch_start, touch, touch_end) にあてはまります。 SVC-3017 を参照してください。
  • プリムの Shared Media が動作していて、アバターのビューワがその機能をサポートしている場合、 LSL スクリプトはこの面に対するタッチを検出しません。以前のビューワでのタッチされたものは検出します。

サンプル

0 から num_detected - 1 までループさせて、検出したエージェントのキーを取得してみましょう:

default
{ 
    touch_start(integer num_detected)
    {
        integer i = 0;
        for(; i<num_detected; ++i)
            llWhisper(0, "Touched by " + llKey2Name(llDetectedKey(i)));
    }
}
// If using a touch to change states be careful about the touch_ event order...

// On clicking a prim with touch events we trigger touch_start (as), touch (during) and touch_end (as released).

// The chain of events is established in the script as touch_start is triggered that remains intact until either

// touch_end is triggered or a new touch_start (discounting resets, deletions, taking to inventory etc.).

default
{
    touch_start(integer nd)
    {
        llSay(0, "You just started touching me so I'm going to the other state...");
        state other;
    }
// A very rapid click would (and does if your VERY quick) beat the state change so the script would/does not behave as expected.
}
state other
{
    touch_end(integer nd)
    {
// The average click will have you catapult through this state with nothing but a chatted message to remember it by.
        llSay(0, "The touch that brought you here just ended so I'm going back to default...");
        state default;
    }
}

参考情報

特記事項

議論

   Server drops first touch event when a script returns to a state with a touch_start handler
この翻訳は 原文 と比べて古いですか?間違いがありますか?読みにくいですか?みんなで 修正 していきましょう! (手順はこちら)
この項目はあなたにとって参考にならない項目ですか?もしかしたらLSL Wikiの関連した項目が参考になるかもしれません。