Jump to content

no idea what i am doing, but (mesh(prims) and scripts)..


Machen Savira
 Share

You are about to reply to a thread that has been inactive for 511 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

greetings all..
so i really dont do scripting.. ive tried it a few times only to not log into SL for a week after the experience.. 😳
that being said, i need to try to get this project done.. what i have is this.. a row of letters, each letter has a script in it.. that when you click that letter, it lights up, makes a sound, throws candy,  whatever.. 
what i want to do is..  link all of this together.. so that where ever you click.. the event is produced.. instead of having to click each letter separate..
i have tried dumping JUST the script into a(n) invisible root prim.. but that did nothing but make the root prim clickable (only)..
thank you in advance, and be warned.. my built experience is pre-mesh dated.. 😓

Link to comment
Share on other sites

So, if you have a script that does something there's not much you can do unless you can edit the script (you probably already know this, ).

A single script in the root 'make the touched link glow' might look something like this:

default
{
    touch_start(integer n)
    {   integer link = llDetectedLinkNumber(0); // which link was touched?
        if(link==1) return; // do nothing if the root was touched.
        
        float glow = llList2Float(llGetLinkPrimitiveParams(link,[PRIM_GLOW,0]),0); // was it glowing?
        glow = 0.05 * (glow==0.0); // if it wasn't glowing, we want it to glow, if it was, we want it to not.
        llSetLinkPrimitiveParamsFast(link,[PRIM_GLOW,ALL_SIDES,glow]);
    }
}

for this sort of thing, I usually differentiate the action based on the name or description of the touched link:

default
{
    touch_start(integer n)
    {   integer link = llDetectedLinkNumber(0); // which link was touched?
        if(link==1) return; // do nothing if the root was touched.
        string name = llGetLinkName(link);
        if("glow"==name)
        {   float glow = llList2Float(llGetLinkPrimitiveParams(link,[PRIM_GLOW,0]),0); // was it glowing?
            glow = 0.05 * (glow==0.0); // if it wasn't glowing, we want it to glow, if it was, we want it to not.
            llSetLinkPrimitiveParamsFast(link,[PRIM_GLOW,ALL_SIDES,glow]);
        }else if("turn"==name)
        {   rotation orientation = llList2Rot(llGetLinkPrimitiveParams(link,[PRIM_ROT_LOCAL]),0);
            orientation = <0,0,0.71,0.71>*orientation; // turn 90 degrees on its local z axis.
            llSetLinkPrimitiveParamsFast(link,[PRIM_ROT_LOCAL,orientation]);
        }
    }
}

//

if you can't make it all one script and need all of the scripts in every link of the object to be notified, you need to use a link_message:

// script in root:
default
{   touch_start(integer total_number)
    {   llMessageLinked(LINK_SET,0,"Touched","");
    }
}
// script in child prim
default
{   link_message(integer SendersLink, integer Value, string Text, key ID)
    {   llSay(0, "Touched "+(string)llGetLinkName(LINK_THIS));
    }
}

or, if you just want everything to glow:

llSetLinkPrimitiveParamsFast(LINK_SET,[PRIM_GLOW,ALL_SIDES,glow]);

 

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 511 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...