ラベル Script example の投稿を表示しています。 すべての投稿を表示
ラベル Script example の投稿を表示しています。 すべての投稿を表示

2009年10月6日火曜日

compassのスクリプト

compass方位磁石のスクリプトを調べてみました。
最近コンバット系のことを考えてるので、その過程として・・・。
ミニマップがあるので、今は不要ですよね?!
(気分的にあったほうがいいとかあるかもしれませんけど)

フリーで販売されてますし、必要な方はそちらで・・・
MILESTONES FREE CAMERA & INSTRUMENT HUDS

float zOffset;      //  This is the number of radians that the texture
// will have to be rotated in the opposite direction
// to make it point north.
 
vector primRot; // This is the rotation of the object.
 
float zPos; // Since textures can only be rotated on one axis at
// at a time (think about it), I only need to play
// with the z axis. This is where I'll store it.
 
float startRot; // I have to admit that radian geometry confounds me.
// This is where I convert the number of degrees of
// rotation of the object into radians.
 
default
{
state_entry()
{
llSetTimerEvent(0.1);
}
timer()
{
primRot=llRot2Euler( llGetRot() ) * RAD_TO_DEG;
zPos = primRot.z;
startRot=zPos * 0.017450;
zOffset=0.0-startRot;
llRotateTexture(zOffset,0);
}
}
 

2009年9月5日土曜日

llMessageLinked

Script to Send a Message

 
default
{
    touch_start(integer touched)
    { //When someone touches this, send the message "touched",

      //the number 0 and the avatar's key who touched this prim

      //to all scripts in this linkset.

 
        llMessageLinked(LINK_SET, 0, "touched", llDetectedKey(0));    
    }
}


Script to Receive the Message

 
default
{
    link_message(integer Sender, integer Number, string Text, key ID)
    {  //When this prim receives a message, say to the owner what it received.

 
        llOwnerSay("Message received from prim number " + (string)Sender
            + " within this linkset. The Message is the number "
            + (string)Number + ", the message " + Text + ", and the key of the avatar "
            + llKey2Name(ID) + ".");
    }
}