Jump to content
ainst Composer

RCX Flight / LANDING LIGHT / Script

Recommended Posts

Hello! Question to experienced scripters.

Has anyone ever worked with RCX flight scripts? I have this Land Light script. Its for the prim cone of light. In the off state it is a small cone but when it is turned on it increases.

And I want to redo it into a simple light source (no cone prim). I need to remove all the excess that affects the size of my light source and leave only the turning on/off the parameters of light. What needs to be removed?

Can anyone help?

/**
 * @author(s): Reconx86
 * @created: 2016.04.12
 *
 * RCX Landing Lights:
 * A script too manage Landing Lights
 *
 * @license:
 * You are allowed to share this script full-perm with others and even use it in your own projects.
 * But do not sell the script seperately nor as part of a script package
 */

integer lLandLight;
integer rLandLight;

string objName = "landing light";
 
integer links;
integer objTotal;

list lstPrimNames;
rcxGetNames()
{
    lstPrimNames = [];
    integer link_nr;
    integer links = llGetNumberOfPrims();
    for (link_nr = 0; link_nr <= links; link_nr++) {
        lstPrimNames += [llGetLinkName(link_nr)];
    }
}

integer rcxName2Link (string prim_name)
{
    integer link_nr = llListFindList(lstPrimNames, [prim_name]);
    if (link_nr == -1) {
        link_nr = llGetListLength(lstPrimNames);
        llOwnerSay(llGetScriptName() + ": Prim \"" + prim_name + "\" not found");
    }
    return link_nr;
}

lightsOn(integer num, integer navSide)
{
    list params;
    params = [
        PRIM_GLOW, ALL_SIDES, num * 0.1,
        PRIM_POINT_LIGHT, num,
            <1.0, 1.0, 0.0>, //reflection/tint
            1.0,
            2,
            0.5,
        PRIM_COLOR,
            ALL_SIDES,
            <0.0, 0.5, 1.0>,
            num * 0.07//Light transparancy
        ];
    if (num) {//When lights are turned on this returns TRUE
        params += [
            PRIM_POS_LOCAL, <16.4, navSide * 3.5, -2.64>,
            PRIM_SIZE, <5.00000, 5.00000, 30.00000>
        ];
    } else {//Executes when lights are turned off
        params += [
            PRIM_POS_LOCAL, <3.9, navSide * 3.5, 0.0>,
            PRIM_SIZE, <1.00000, 1.00000, 1.00000>
        ];       
    }
    if (~navSide) {
        llSetLinkPrimitiveParamsFast(lLandLight, params);
        llSetLinkAlpha(lLandLight, 0.0, 0);
    } else {
        llSetLinkPrimitiveParamsFast(rLandLight, params);
        llSetLinkAlpha(rLandLight, 0.0, 0);
    }
}

default
{
    state_entry()
    {
        links = llGetObjectPrimCount(llGetKey());
        rcxGetNames();
        lLandLight = rcxName2Link("RCX Landing Light (Port)");
        rLandLight = rcxName2Link("RCX Landing Light (Starboard)");
        lstPrimNames = [];
    }
    
    link_message(integer sender, integer num, string msg, key id)
    {
        if (msg == "#landing_light") {
            lightsOn(num, 1);
            lightsOn(num, -1);
            llSetScriptState(llGetScriptName(), FALSE);
        }
    }
}

 

Edited by ainst Composer

Share this post


Link to post
Share on other sites

Skimming over this script, for what you want there's practically nothing to be saved here other than a bit of the link_message() handler with a stripped-down call to llSetLinkPrimitiveParamsFast(). But I very much doubt that all you really want is a point light source; shouldn't it at least toggle full-bright of some side of some prim somewhere? Also, I know nothing about RCX so I'm a little puzzled that this script sets itself to Not-Running state.

You may just want to ask this post be moved to a different forum where you could have the pleasure of paying a scripter to look at it for you.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
5 hours ago, Qie Niangao said:

Skimming over this script, for what you want there's practically nothing to be saved here other than a bit of the link_message() handler with a stripped-down call to llSetLinkPrimitiveParamsFast(). But I very much doubt that all you really want is a point light source; shouldn't it at least toggle full-bright of some side of some prim somewhere? Also, I know nothing about RCX so I'm a little puzzled that this script sets itself to Not-Running state.

You may just want to ask this post be moved to a different forum where you could have the pleasure of paying a scripter to look at it for you.

Yes i was puzzled too about not-running!

However, the problem is solved, minor changes were needed. 

Thank's

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×