Jump to content

ChaosRaine

Resident
  • Posts

    70
  • Joined

  • Last visited

Posts posted by ChaosRaine

  1. I have a script listening to a chat channel. When it hears a word it checks the list for the word. If it's not already on the list, it adds it. I'm having trouble checking the list for the word. Here's what I am doing.

    Quote


            integer MC = 0;
            integer Done = llGetListLength(Liked);
            for (; MC<Done; ++MC)
            { 
            if (llList2String(Liked, MC) != (string)Match)
    {
        
                llListenRemove(listener);
        
            Matches += Match;
            Matches += ",";
            
            
                ++mm; 
                
        llSetText((string)xx + " Likes \n" + (string)mm + " Matches", ZERO_VECTOR, 1);
            listener = llListen(MatchChannel,"",NULL_KEY,"");
            
    }
    else
    {
        
         
        
        
            }
            }

     

  2. I'm not trying to rotate the root prim. I'm trying to rotate a child prim when the child prim is clicked. Eventually I want a couple of the child prims to rotate individually when each is clicked. I can obtain the results I want by using separate scripts in each child prim, but I would prefer to use one script in the root.

  3. I have this script which I put into the child prim. It rotates it fine. When I try to use llSetLinkPrimitiveParamsFast in the root prim though, rotates weird. It's like reorienting itself to the axis before it starts the rotations.

    rotation rot_xyzq;
     
    default
    {
        state_entry()
        {
            vector xyz_angles = <0,0.90,0>; // This is to define a 90 degree change
            vector angles_in_radians = xyz_angles*DEG_TO_RAD; // Change to Radians
            rot_xyzq = llEuler2Rot(angles_in_radians); // Change to a Rotation
        }
     
        touch_start(integer s)
        {
            llSetRot(llGetRot()*rot_xyzq/llGetRootRotation()/llGetRootRotation()); //Do the Rotation...
        }
    }

     

  4. I'm have a cylinder that is cut into five pieces I want to rotate those pieces as if there was a stick going the center. I'm using this 

    float y = 90;
    float yh = 90;
    integer yt = 90;
    integer yth = 90;
    integer  One = FALSE;
    integer  Two = FALSE;
    integer  Three = FALSE;
    integer x;
    integer t;
    integer th;
    float   gap = 30.0;
    rotation rot_xyzs;
    
    default
    {
        state_entry()
        {
           // llSetLinkPrimitiveParamsFast( 5, [PRIM_ROT_LOCAL, llEuler2Rot(<0.0, 0.0 , 0.0>*DEG_TO_RAD)] );
           // llSetLinkPrimitiveParamsFast(2, [ 
      //  PRIM_ROT_LOCAL, llEuler2Rot(<0, 0, 0>*DEG_TO_RAD)]);
         //   llSetLinkPrimitiveParamsFast(4, [ 
    //    PRIM_ROT_LOCAL, llEuler2Rot(<0, 0, 0>*DEG_TO_RAD)]);
         //   llSetLinkPrimitiveParamsFast(5, [ 
     //   PRIM_ROT_LOCAL, llEuler2Rot(<0, 0, 0>*DEG_TO_RAD)])
         //   llSetLinkPrimitiveParamsFast(3, [ 
     //   PRIM_ROT_LOCAL, llEuler2Rot(<0, 0, 0>*DEG_TO_RAD)]);
        }
    
        touch_start(integer total_number)
        {
            if (llDetectedLinkNumber(0)==5)
            {
                
                //First
    
    
            vector xyz_angles = <y,1.0,1.0>; // This defines a 1 degree change on the Y axis
            vector angles_in_radians = xyz_angles*DEG_TO_RAD; // Change to radians
            rot_xyzs = llEuler2Rot(angles_in_radians);
          
    
    
    llSetLinkPrimitiveParamsFast( 5, [PRIM_ROT_LOCAL, llEuler2Rot(<0.0, 0.0, y>*DEG_TO_RAD)] );
      //        llSetLinkPrimitiveParamsFast(6, [ 
      //  PRIM_ROT_LOCAL, llEuler2Rot(<y, 0.0, 0.0>*DEG_TO_RAD)]);
         
       y+=90; 
        // x++; 
          
            }   
        }
    }

    but it seems that the first click it is setting itself to a start point before rotating. Any ideas?

  5.   if (message = "R000")  will make the message R000 making that statement true everytime. It needs to be   if (message == "R000") also you are recalling the listen event. It's not part of the Weapons portion so you should have that closed off. Kinda like R000 was a button option to begin with. Sorry if that sounds confusing, but it will be more like this.

    list buttons = ["Weapons", "Music", "Return"];
    string dialogInfo = "\nHow can I help you?.";
     
    key ToucherID;
    integer dialogChannel;
    integer listenHandle;
     
    default
    {
        state_entry()
        {
            dialogChannel = -1 - (integer)("0x" + llGetSubString( (string)llGetKey(), -7, -1) );
        }
     
        touch_start(integer num_detected)
        {
            ToucherID = llDetectedKey(0);
            listenHandle = llListen(dialogChannel, "", ToucherID, "");
            llDialog(ToucherID, dialogInfo, buttons, dialogChannel);
            llSetTimerEvent(60.0); // Here we set a time limit for responses
        }
     
        listen(integer channel, string name, key id, string message)
        {
            //stop the timer
            llSetTimerEvent(0.0);
            //remove listen
            llListenRemove(listenHandle);
    
            //first level menu responses
            if (message == "Weapons")
            {       
                string dialogInfo = "\nWhich function should I perform?";
                list buttons = ["R000", "R030", "R050"];
    
                //call second level menu
                listenHandle = llListen(dialogChannel, "", ToucherID, "");
                llDialog(ToucherID, dialogInfo, buttons, dialogChannel);
                llSetTimerEvent(60.0); // Here we re set a time limit for responses 
                  }
                    if (message == "R000")
                    {
                        //stop the timer
                        llSetTimerEvent(0.0);
                        //remove listen
                        llListenRemove(listenHandle); 
                         
                        llSay(0,"!shoot");
                    }
                     else if (message == "R030")
                    {
                        llSay(0,"This function is not operable yet.");
                    }
                    else if (message == "R050")
                    {
                        llSay(0,"This function is not operable yet.");
                    } 
            
            else if (message == "Music")
            {
                llSay(0,"This function is not Operable yet.");
            }
            else if (message == "Return")
            {
                llSay(0,"Until next time.");
            }
    
           
        }
    
     
        timer()
        {
        //  stop timer
            llSetTimerEvent(0);
     
            llListenRemove(listenHandle);
            llWhisper(0, "Sorry. You snooze; you lose.");
        }
    } 

     

    • Like 2
  6. I am trying to make an object usable by anybody, but only one person at a time. I've seen sales boards that will go to a busy more while one person makes a purchase. How do I set up this busy mode?

  7. I want to make a HUD that allows people to chat with other people also wearing the same HUD. I'm gonna want the HUD to randomly assign small groups and allow them to talk to each other. Is this possable? I haven't done much work with HUD's yet. For my purposesI think I will need a central item like a table. So that I can assign three people to one group or something.

  8. I'm not having trouble with the vehicles motion. I want animations to play I'm moving and a different when I'm stopped. I tried to put in timers that checked for control buttons being pressed but all I could get was a check if the button was pressed we've the last timed event, so if I hold the button down threw two timed events it would pay the idle animation again instead of the survival one.

  9. I am writing a vehicle script and I can get most of it to work. It takes control steers nicely and all that good stuff. I can get it to play an animation when I press forward, back, left and right, however after moving I can't get it to play an idle animation when no control buttons are being pressed. Does anybody know his to add that? I can post my script here tomorrow if you need to see it.
  10. I'm trying to find somebody who can work with me on one and possibly multiple future projects. I need somebody who can make me some decent 1 prim furniture sets. I need these to be 1 prim after being scripted. The type of sets I am looking for will include a livingroom set of at least a sofa, chair and table, all at 1 prim. Another would be bedroom sets including at least a bed and end tables also a 1 prim for the set. If you feel you are up to the task, please contact ChaosRaine inworld.

  11. Thanks a lot that is helping I put it in like this though

    string  HelperName  = "Sit Target Helper 3b";list    Anims;              // names of anims in object's inventoryinteger AnimNum;            // index of current animstring  LastAnim;           // anim last sitter usedkey     LastAv;             // av who sat, just a guardrotation OrigRotation;      // rotation to return seat to, when av standsinteger Rotating;           // whether rotating seatinteger MenuChan;list Buttons = [      "SET"    , "DONE"    ];// Return a channel number that's based on the prim's key -- unique per objectinteger channel() {    return (integer)("0x"+llGetSubString((string)llGetKey(),-4,-1));}do_menu(key id) {    llDialog(id,          "Choose SET to set the sit target.  Then test."        + "\nChoose DONE when you're happy."        + "\nTo change the target later, reset the script."        + "\n(e.g., select, and Tools -> Reset scripts in selection)",        Buttons,        MenuChan);}          do_sensor() {     // Find the helper     llSensor(HelperName, NULL_KEY, ACTIVE|PASSIVE, 20, PI);     llSay(0, "Searching for '" + HelperName + "'");}// Collect the set of anims in this primget_anims(){    integer ix;    string  anim;    llUnSit(llAvatarOnSitTarget());     Anims = [];    for (ix = 0; TRUE; ix++) {        anim = llGetInventoryName(INVENTORY_ANIMATION, ix);        if (anim == "") {            llWhisper(0, (string)llGetListLength(Anims) + " animations");            return;        }        Anims += [anim];    }}// Start the animation given by ordinal numberinteger start_anim(integer ix) {    integer numAnims = llGetListLength(Anims);    key     id = llAvatarOnSitTarget();    list anims = llGetAnimationList(id);    integer jx;    for (; jx < llGetListLength(anims); ++jx) {        llStopAnimation(llList2String(anims, jx));    }    if (numAnims > 0) {        string anim = llList2String(Anims, ix);        llStartAnimation(anim);                // If this is the first we've seen of this av, stop default sits        if (LastAv == NULL_KEY) {            llStopAnimation("sit");            llStopAnimation("sit_generic");            llStopAnimation("sit_female");        }        LastAnim = anim;        LastAv = id;    }    return (numAnims > 1);}// Start the next anim in inventorynext_anim(){    AnimNum++;    if (AnimNum >= llGetListLength(Anims)) {        AnimNum = 0;    }    start_anim(AnimNum);}// Start the previous anim in inventoryprev_anim(){    AnimNum--;    if (AnimNum < 0) {        AnimNum = llGetListLength(Anims) - 1;    }    start_anim(AnimNum);}// Rotate the stool by the given anglerotate(float amt){  rotation rot = llGetRot();  rotation r = llEuler2Rot(<0,0,amt * DEG_TO_RAD>);  llSetRot(rot * r);}// React to an arrow or shift-arrow keyhandle_control(integer level, integer change) {    key     id = llAvatarOnSitTarget();    if (level & CONTROL_RIGHT) {        next_anim();        llInstantMessage(id, LastAnim);    } else if (level & CONTROL_LEFT) {        prev_anim();        llInstantMessage(id, LastAnim);    } else if (level & CONTROL_ROT_LEFT) {        rotate(-15.0);    } else if (level & CONTROL_ROT_RIGHT) {        rotate(15.0);    }        }// Calculate the sit target, compensating for the known bug// Big thanks to Lex Neva for this!calc_sit_target(){    vector   helper_pos = llDetectedPos(0);    rotation helper_rot = llDetectedRot(0);        vector   my_pos = llGetPos();    rotation my_rot = llGetRot();        // calculate where the avatar actually is    vector avatar_pos = helper_pos + <0.,0.,.01> * helper_rot; // due to helper's sit target    avatar_pos = avatar_pos - <0,0,0.186> + <0,0,0.4> * helper_rot; // correct for a bug in llSitTarget(), for helper sit target        vector target_pos = (avatar_pos - my_pos) / my_rot;    target_pos = target_pos + <0,0,0.186>/my_rot - <0,0,0.4>; // correct for the bug again, this time in my sit target    rotation target_rot = helper_rot / my_rot;        llSitTarget(target_pos, target_rot);    llSay(0, "llSitTarget(" + (string)target_pos + ", " + (string)target_rot + ");");}upgrade() {    string me   = llGetScriptName();    string name = "Sit Target Setter";    integer n = llGetInventoryNumber(INVENTORY_SCRIPT);    while (n-- > 0) {                string item = llGetInventoryName(INVENTORY_SCRIPT, n);        if (item != me && 0 == llSubStringIndex(item, name)) {            llOwnerSay("removing old script: " + item);            llRemoveInventory(item);        }    }}default{    state_entry() {        upgrade();        state s_setting;    }}// Sit-target setting mode// On click, show menu.  On "SHOW", set the sit target.  On "DONE", go to furniture mode.// Might be a good idea to disallow to simplify and avoid user mistakes.state s_setting{    state_entry() {            llSay(0, "Put desired sit animations in this prim "            + "and in the Sit Target Helper.");        llSay(0, "Sit on Sit Target Helper, move the helper to desired position, "            + "and then click this prim to get menu");        get_anims();        MenuChan = channel();        llListen(MenuChan, "", NULL_KEY, "");    }        on_rez(integer arg) {        state default;      // do this to reset chan, to avoid object crosstalk    }    touch_end(integer total_number) {        do_menu(llDetectedKey(0));    }        listen(integer chan, string name, key id, string msg) {        if (msg == "SET") {            do_sensor();            return;        }                if (msg == "DONE") {            state s_normal;        }    }    // no helper around, do nothing    no_sensor() {        llSay(0, "Can't find " + HelperName + ".");    }    // Found the helper: set sit target and go to furniture mode    sensor(integer num) {        if (num > 1) {            llSay(0, "Multiple Sit Target Helpers found.  Using closest one.");        } else {            llSay(0, "Setting sit target.");        }                calc_sit_target();    }    changed(integer change) {        if (change & CHANGED_INVENTORY) {            get_anims();            return;        }        if (llAvatarOnSitTarget() == NULL_KEY) {                    string lay = llGetInventoryName(INVENTORY_TEXTURE, 0);            LastAv = NULL_KEY;    // nobody's sitting now                                     llSetLinkAlpha(2, 0.0, ALL_SIDES);;           llSetLinkAlpha(1, 1.0, ALL_SIDES);           llSetLinkAlpha(3, 1.0, ALL_SIDES);           llSetLinkTexture(1,lay,ALL_SIDES);        } else {            string stand = llGetInventoryName(INVENTORY_TEXTURE, 1);          //  llRequestPermissions(llAvatarOnSitTarget(),          //      PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION);                         llSetLinkAlpha(2, 1.0, ALL_SIDES);;           llSetLinkAlpha(1, 1.0, ALL_SIDES);           llSetLinkAlpha(3, 0.0, ALL_SIDES);           llSetLinkTexture(1,stand,ALL_SIDES);           if ( (llGetPermissions() & (PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION)) !=    (PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION) ){  llRequestPermissions (llAvatarOnSitTarget(),  PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION );}          }    }    run_time_permissions(integer perm) {        // allow shift-arrow for selecting pose, but not rotation in this state.        llTakeControls(CONTROL_RIGHT | CONTROL_LEFT, TRUE, FALSE);        if (start_anim(AnimNum)) {            llInstantMessage(llAvatarOnSitTarget(),                "shift-left/right to change animation");        }    }    // Handle arrow keys    control(key id, integer level, integer change) {        handle_control(level, change);    }    state_exit() {        llSetTimerEvent(0.0);        llSay(0, "Converting to normal furniture mode");        integer linknum = llGetLinkNumber();        string text = "To put me back in sit-target programming mode, reset the '"            + llGetScriptName() + "' script in ";                    if (linknum > 1) {            text += "prim " + (string) linknum + " (" + llGetObjectName() + ")";        } else {            text += "this object";        }        llSay(0, text);    }}state s_renormal {    state_entry() {        state s_normal;    }}// Normal 'sit' mode: now we're just furniture.state s_normal{    state_entry() {        OrigRotation = llGetRot();    }    changed(integer change) {        if (change & CHANGED_INVENTORY) {            get_anims();            return;        }        if (llAvatarOnSitTarget() == NULL_KEY) {            LastAv = NULL_KEY;          // nobody's sitting now                    llSetLinkAlpha(2, 1.0, ALL_SIDES);;           llSetLinkAlpha(1, 1.0, ALL_SIDES);           llSetLinkAlpha(3, 1.0, ALL_SIDES);            if (Rotating) {                llSetRot(OrigRotation);     // restore original rotation            }        } else {            OrigRotation = llGetRot();  // save current seat rotation                      if ( (llGetPermissions() & (PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION)) !=    (PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION) ){  llRequestPermissions (llAvatarOnSitTarget(),  PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION );}          }    }    run_time_permissions(integer perm) {        integer controls;        // Grab shift-arrow keys for changing anims.        // If "rotat" is anywhere in the description,        // support rotation (i.e., also grab arrow keys).        if (llSubStringIndex(llToUpper(llGetObjectDesc()), "ROTAT") == -1) {            Rotating = FALSE;            // anim changing only            controls =  CONTROL_RIGHT | CONTROL_LEFT;        } else {            Rotating = TRUE;            // rotation support too            controls =  CONTROL_RIGHT | CONTROL_LEFT | CONTROL_ROT_LEFT | CONTROL_ROT_RIGHT;        }        llTakeControls(controls, TRUE, FALSE);        if (start_anim(AnimNum)) {            llInstantMessage(llAvatarOnSitTarget(),                "shift-left/right to change animation");        }    }    control(key id, integer level, integer change) {        handle_control(level, change);    }    state_exit() {        if (Rotating) {            llSetRot(OrigRotation);        }    }}

     and now I'm getting a "Unable to find specified agent to request permissions" when I stand

  12. I'm trying to add

    string lay = llGetInventoryName(INVENTORY_TEXTURE, 0);
    llSetLinkAlpha(2, 0.0, ALL_SIDES);
    llSetLinkAlpha(1, 1.0, ALL_SIDES);
    llSetLinkAlpha(3, 1.0, ALL_SIDES);
    llSetLinkTexture(1,lay,ALL_SIDES);

    when a avatar is not seated on a prim and

    string stand = llGetInventoryName(INVENTORY_TEXTURE, 1);
    llSetLinkAlpha(2, 1.0, ALL_SIDES);
    llSetLinkAlpha(1, 1.0, ALL_SIDES);
    llSetLinkAlpha(3, 0.0, ALL_SIDES);
    llSetLinkTexture(1,stand,ALL_SIDES);

    When they are. I ended up with this script

    string  HelperName  = "Sit Target Helper 3b";
    
    list    Anims;              // names of anims in object's inventory
    integer AnimNum;            // index of current anim
    string  LastAnim;           // anim last sitter used
    key     LastAv;             // av who sat, just a guard
    rotation OrigRotation;      // rotation to return seat to, when av stands
    integer Rotating;           // whether rotating seat
    
    integer MenuChan;
    
    list Buttons = [
          "SET"
        , "DONE"
        ];
    
    // Return a channel number that's based on the prim's key -- unique per object
    integer channel() {
        return (integer)("0x"+llGetSubString((string)llGetKey(),-4,-1));
    }
    
    do_menu(key id) {
        llDialog(id,
              "Choose SET to set the sit target.  Then test."
            + "\nChoose DONE when you're happy."
            + "\nTo change the target later, reset the script."
            + "\n(e.g., select, and Tools -> Reset scripts in selection)",
            Buttons,
            MenuChan);
    }
              
    do_sensor() {
         // Find the helper
         llSensor(HelperName, NULL_KEY, ACTIVE|PASSIVE, 20, PI);
         llSay(0, "Searching for '" + HelperName + "'");
    }
    
    // Collect the set of anims in this prim
    
    get_anims()
    {
        integer ix;
        string  anim;
    
        llUnSit(llAvatarOnSitTarget());    
        Anims = [];
    
        for (ix = 0; TRUE; ix++) {
    
            anim = llGetInventoryName(INVENTORY_ANIMATION, ix);
            if (anim == "") {
                llWhisper(0, (string)llGetListLength(Anims) + " animations");
                return;
            }
            Anims += [anim];
        }
    }
    
    
    // Start the animation given by ordinal number
    
    integer start_anim(integer ix) {
        integer numAnims = llGetListLength(Anims);
        key     id = llAvatarOnSitTarget();
    
        list anims = llGetAnimationList(id);
        integer jx;
        for (; jx < llGetListLength(anims); ++jx) {
            llStopAnimation(llList2String(anims, jx));
        }
    
    
        if (numAnims > 0) {
            string anim = llList2String(Anims, ix);
    
            llStartAnimation(anim);
    
            // If this is the first we've seen of this av, stop default sits
            if (LastAv == NULL_KEY) {
                llStopAnimation("sit");
                llStopAnimation("sit_generic");
                llStopAnimation("sit_female");
            }
            LastAnim = anim;
            LastAv = id;
        }
    
        return (numAnims > 1);
    }
    
    
    // Start the next anim in inventory
    
    next_anim()
    {
        AnimNum++;
        if (AnimNum >= llGetListLength(Anims)) {
            AnimNum = 0;
        }
        start_anim(AnimNum);
    }
    
    
    // Start the previous anim in inventory
    
    prev_anim()
    {
        AnimNum--;
        if (AnimNum < 0) {
            AnimNum = llGetListLength(Anims) - 1;
        }
        start_anim(AnimNum);
    }
    
    
    // Rotate the stool by the given angle
    
    rotate(float amt)
    {
      rotation rot = llGetRot();
      rotation r = llEuler2Rot(<0,0,amt * DEG_TO_RAD>);
      llSetRot(rot * r);
    }
    
    
    // React to an arrow or shift-arrow key
    
    handle_control(integer level, integer change) {
    
        key     id = llAvatarOnSitTarget();
    
        if (level & CONTROL_RIGHT) {
            next_anim();
            llInstantMessage(id, LastAnim);
        } else if (level & CONTROL_LEFT) {
            prev_anim();
            llInstantMessage(id, LastAnim);
        } else if (level & CONTROL_ROT_LEFT) {
            rotate(-15.0);
        } else if (level & CONTROL_ROT_RIGHT) {
            rotate(15.0);
        }        
    }
    
    
    // Calculate the sit target, compensating for the known bug
    // Big thanks to Lex Neva for this!
    
    calc_sit_target()
    {
    
        vector   helper_pos = llDetectedPos(0);
        rotation helper_rot = llDetectedRot(0);
        
        vector   my_pos = llGetPos();
        rotation my_rot = llGetRot();
        
        // calculate where the avatar actually is
        vector avatar_pos = helper_pos + <0.,0.,.01> * helper_rot; // due to helper's sit target
        avatar_pos = avatar_pos - <0,0,0.186> + <0,0,0.4> * helper_rot; // correct for a bug in llSitTarget(), for helper sit target
        
        vector target_pos = (avatar_pos - my_pos) / my_rot;
        target_pos = target_pos + <0,0,0.186>/my_rot - <0,0,0.4>; // correct for the bug again, this time in my sit target
        rotation target_rot = helper_rot / my_rot;
        
        llSitTarget(target_pos, target_rot);
        llSay(0, "llSitTarget(" + (string)target_pos + ", " + (string)target_rot + ");");
    }
    
    
    upgrade() {
        string me   = llGetScriptName();
        string name = "Sit Target Setter";
        integer n = llGetInventoryNumber(INVENTORY_SCRIPT);
        while (n-- > 0) {        
            string item = llGetInventoryName(INVENTORY_SCRIPT, n);
            if (item != me && 0 == llSubStringIndex(item, name)) {
                llOwnerSay("removing old script: " + item);
                llRemoveInventory(item);
            }
        }
    }
    
    default
    {
        state_entry() {
            
            upgrade();
            state s_setting;
        }
    }
    
    // Sit-target setting mode
    // On click, show menu.  On "SHOW", set the sit target.  On "DONE", go to furniture mode.
    // Might be a good idea to disallow to simplify and avoid user mistakes.
    
    state s_setting
    {
        state_entry() {    
            llSay(0, "Put desired sit animations in this prim "
                + "and in the Sit Target Helper.");
            llSay(0, "Sit on Sit Target Helper, move the helper to desired position, "
                + "and then click this prim to get menu");
            get_anims();
            MenuChan = channel();
            llListen(MenuChan, "", NULL_KEY, "");
        }
        
        on_rez(integer arg) {
            state default;      // do this to reset chan, to avoid object crosstalk
        }
    
    
        touch_end(integer total_number) {
            do_menu(llDetectedKey(0));
        }
        
        listen(integer chan, string name, key id, string msg) {
            if (msg == "SET") {
                do_sensor();
                return;
            }
            
            if (msg == "DONE") {
                state s_normal;
            }
        }
    
        // no helper around, do nothing
        no_sensor() {
            llSay(0, "Can't find " + HelperName + ".");
        }
    
        // Found the helper: set sit target and go to furniture mode
        sensor(integer num) {
            if (num > 1) {
                llSay(0, "Multiple Sit Target Helpers found.  Using closest one.");
            } else {
                llSay(0, "Setting sit target.");
            }
            
            calc_sit_target();
        }
    
        changed(integer change) {
            if (change & CHANGED_INVENTORY) {
                get_anims();
                return;
            }
    
            if (llAvatarOnSitTarget() == NULL_KEY) {
                LastAv = NULL_KEY;    // nobody's sitting now
    
               
               string lay = llGetInventoryName(INVENTORY_TEXTURE, 0);
    llSetLinkAlpha(2, 0.0, ALL_SIDES);
    llSetLinkAlpha(1, 1.0, ALL_SIDES);
    llSetLinkAlpha(3, 1.0, ALL_SIDES);
    llSetLinkTexture(1,lay,ALL_SIDES);
                
            } else {
                
    
    
                
                llRequestPermissions(llAvatarOnSitTarget(),
                    PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION);
                                                         string stand = llGetInventoryName(INVENTORY_TEXTURE, 1);
               llSetLinkAlpha(2, 1.0, ALL_SIDES);
               llSetLinkAlpha(1, 1.0, ALL_SIDES);
               llSetLinkAlpha(3, 0.0, ALL_SIDES);
               llSetLinkTexture(1,stand,ALL_SIDES);
            }
        }
    
    
        run_time_permissions(integer perm) {
            // allow shift-arrow for selecting pose, but not rotation in this state.
            llTakeControls(CONTROL_RIGHT | CONTROL_LEFT, TRUE, FALSE);
    
            if (start_anim(AnimNum)) {
               llInstantMessage(llAvatarOnSitTarget(),
                    "shift-left/right to change animation");
            }
        }
    
        // Handle arrow keys
        control(key id, integer level, integer change) {
            handle_control(level, change);
        }
    
        state_exit() {
          //  llSetTimerEvent(0.0);
            llSay(0, "Converting to normal furniture mode");
            integer linknum = llGetLinkNumber();
            string text = "To put me back in sit-target programming mode, reset the '"
                + llGetScriptName() + "' script in ";
                
            if (linknum > 1) {
                text += "prim " + (string) linknum + " (" + llGetObjectName() + ")";
            } else {
                text += "this object";
            }
            llSay(0, text);
        }
    }
    
    
    state s_renormal {
        state_entry() {
            state s_normal;
        }
    }
    
    // Normal 'sit' mode: now we're just furniture.
    
    state s_normal
    {
        state_entry() {
            OrigRotation = llGetRot();
        }
    
        changed(integer change) {
            if (change & CHANGED_INVENTORY) {
                get_anims();
                return;
            }
    
            if (llAvatarOnSitTarget() == NULL_KEY) {
                LastAv = NULL_KEY;          // nobody's sitting now
    
                if (Rotating) {
                    llSetRot(OrigRotation);     // restore original rotation
                }
            } else {
                
    
                OrigRotation = llGetRot();  // save current seat rotation
                llRequestPermissions(llAvatarOnSitTarget(),
                    PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION);
            }
        }
    
        run_time_permissions(integer perm) {
            integer controls;
            
            // Grab shift-arrow keys for changing anims.
            // If "rotat" is anywhere in the description,
            // support rotation (i.e., also grab arrow keys).
    
            if (llSubStringIndex(llToUpper(llGetObjectDesc()), "ROTAT") == -1) {
                Rotating = FALSE;
                // anim changing only
                controls =  CONTROL_RIGHT | CONTROL_LEFT;
            } else {
                Rotating = TRUE;
                // rotation support too
                controls =  CONTROL_RIGHT | CONTROL_LEFT | CONTROL_ROT_LEFT | CONTROL_ROT_RIGHT;
            }
    
            llTakeControls(controls, TRUE, FALSE);
            if (start_anim(AnimNum)) {
                llInstantMessage(llAvatarOnSitTarget(),
                    "shift-left/right to change animation");;
            }
        }
    
        control(key id, integer level, integer change) {
            handle_control(level, change);
        }
    
        state_exit() {
            if (Rotating) {
                llSetRot(OrigRotation);
            }
        }
    }

     and it edits the linkset the way I want it to, but for some reson it spams me with shift-left/right to change animation

    I can't seem to figure out what I am doing wrong. Can somebody please help me?

     

     

  13. I only have one child prim in this instance, but yes I think llLinkParticleSystem is what I need, but I've been haveing a lot of trouble figuring out how to work it.

  14. The problem I am having is I want the child prim to be the root prim and vice versa, but I want the one that is currently the root prim to be the one that emits the partical when the current child prim is touched. 

    So basically when its done, the root prim will be touched and the child prim will emit particals.

  15. I'm composing a script and when the parent prim is touched I want both my child prim to react to the touch. I have gotten this to work with the child prim being touched and the parent reacting, but I can't seem to switch it around. Any ideas?

    Parent Prim

    string animation;
    string  CONTROLLER_ID = "A"; // See comments at end regarding CONTROLLERS.
    integer AUTO_START = TRUE;   // Optionally FALSE only if using CONTROLLERS.
    
    list particle_parameters=[]; // stores your custom particle effect, defined below.
    list target_parameters=[]; // remembers targets found using TARGET TEMPLATE scripts.
    integer told;
    integer once_is_too_often;
     
    default
    {
        state_entry()
        {
            told = FALSE;
        }
        touch_start(integer total_number)
        {
            if(!(llDetectedLinkNumber(0) == llGetLinkNumber()))// We can use a condition like this to filter from which prims touches are triggered.
            {       particle_parameters = [  // start of particle settings
               // Texture Parameters:
               PSYS_SRC_TEXTURE, llGetInventoryName(INVENTORY_TEXTURE, 0), 
               PSYS_PART_START_SCALE, <0.04, .3, FALSE>, PSYS_PART_END_SCALE, <.12, 0.05, FALSE>, 
               PSYS_PART_START_COLOR, <.6,.6,.6>,    PSYS_PART_END_COLOR, <0.3,0.4,.6>, 
               PSYS_PART_START_ALPHA,  (float)0.75,            PSYS_PART_END_ALPHA, (float)0.50,   
             
               // Production Parameters:
               PSYS_SRC_BURST_PART_COUNT, (integer)5, 
               PSYS_SRC_BURST_RATE, (float) 0.01,  
               PSYS_PART_MAX_AGE, (float)1.0, 
               PSYS_SRC_MAX_AGE,(float) 0.0,  
            
               // Placement Parameters:
               PSYS_SRC_PATTERN, (integer)8, // 1=DROP, 2=EXPLODE, 4=ANGLE, 8=ANGLE_CONE,
               
               // Placement Parameters (for any non-DROP pattern):
               PSYS_SRC_BURST_SPEED_MIN, (float)0.3,   PSYS_SRC_BURST_SPEED_MAX, (float)0.9, 
               PSYS_SRC_BURST_RADIUS, 0.1,
            
               // Placement Parameters (only for ANGLE & CONE patterns):
               PSYS_SRC_ANGLE_BEGIN, (float) 0.08*PI,    PSYS_SRC_ANGLE_END, (float)0.002*PI,  
            // PSYS_SRC_OMEGA, <0,0,0>, 
            
               // After-Effect & Influence Parameters:
               PSYS_SRC_ACCEL, <0.0,0.0, - 2.0 >,  
            // PSYS_SRC_TARGET_KEY,      llGetLinkKey(llGetLinkNumber() + 1),       
                  
               PSYS_PART_FLAGS, (integer)( 0         // Texture Options:     
                                    | PSYS_PART_INTERP_COLOR_MASK   
                                    | PSYS_PART_INTERP_SCALE_MASK   
                                    | PSYS_PART_EMISSIVE_MASK   
                                    | PSYS_PART_FOLLOW_VELOCITY_MASK
                                                      // After-effect & Influence Options:
                                 // | PSYS_PART_WIND_MASK            
                                 // | PSYS_PART_BOUNCE_MASK          
                                 // | PSYS_PART_FOLLOW_SRC_MASK     
                                 // | PSYS_PART_TARGET_POS_MASK     
                                 // | PSYS_PART_TARGET_LINEAR_MASK   
                                ) 
                //end of particle settings                     
            ];
            
            if ( AUTO_START ) llParticleSystem( particle_parameters );
               if(!once_is_too_often)
               {
            llRequestPermissions(llDetectedKey(0), PERMISSION_TRIGGER_ANIMATION);
        }
    }
    }
        run_time_permissions(integer perm)
        {
            if (perm & PERMISSION_TRIGGER_ANIMATION)
            {
            animation = llGetInventoryName(INVENTORY_ANIMATION,0);
                llStartAnimation(animation);
                llOwnerSay("animation will end in 5 seconds");
                llSetTimerEvent(5.0);told = TRUE;
            }
            else
            {
                }
        }
        
        
                       timer()
        {
              llParticleSystem([]);
              llStopAnimation(animation);
              llSetTimerEvent(0.0);
        }
    }

     Child Prim

     

    integer once_is_too_often;
     
    default
    {
    
    
       state_entry()
       {
           llPassTouches(FALSE);// Innocent child doesn't know to say something the first time.
           once_is_too_often = FALSE;
       }
       touch_start(integer total_number)
       {
           if(llDetectedLinkNumber(0) == llGetLinkNumber())// Again we check who is being touched.
           {
               if(!once_is_too_often)
               {
                   llPassTouches(TRUE); // But if a second time, it will tell.
                   once_is_too_often = TRUE;// And then fall silent.
               }
           }
    }
    }

     

×
×
  • Create New...