Jump to content

Life Camino

Resident
  • Posts

    127
  • Joined

  • Last visited

Posts posted by Life Camino

  1. The only problem I see with that suggestion is that the script that will be rezzing the object does not know where it is supposed to go.  The positioning script in the object is supposed to know what it's offset should be from the avatar.  And, it gets that when the avatar positions the object and clicks it.  The avatar then takes the object back to inventory and then drags it into the object rezzer HUD.

    When the object is rezzed, it can get the avatar's position and rotation and it already has its own recorded offset position and rotation.  So, the problem I'm having is getting the object to always move to the correct position and rotation after being rezzed.  I can get the object to move to the relative position in region coordinates, but not while taking the avatar's rotation into account.  If I always want the object rezzed in front of the avatar, it is not acceptable to simply place it at the relative position in region coordinates.  The avatar may be facing in a different direction.  So, where the object moves after being rezzed is going to be dependent on both the avatar's rotation and the relative offset recorded when the positioning script was placed into the object.

    I hope I'm making myself clear.

  2. Yes, I think that would work, as long as my rezzing position is less than 10 meters away.   The reason I wanted to use a positioning script and have the object move into position on its own is to circumvent the 10M rez position limit.  If the object is small, 10M is probably sufficient.  But, if the object is large, 10M may not be sufficient.    And, different objects are going to have different positioning requirements. My goal is to be able to properly position any object regardless of its size or its distance from the avatar.  So, how might I get the rezzed object to move to the correct position and rotation?

  3. I'm trying to write a HUD object rezzer script that will always rez an object in the same position relative to the avatar, regardless of the avatar's rotation.  In other words, if the avatar is facing east and I want the object rezzed 5m in front of the avatar every time, then the HUD needs to rez the object at avatar_pos + <5.0,0.0,0.0>.  But, if the avatar is facing north, it would need to be rezzed at avatar_pos + <0.0,5.0,0.0>.  I also need the object to be rotated the same relative to the avatar each time.  For example, if the object is a little space ship, I always want the avatar to be facing the side of the ship, and not the front or the back when it's rezzed from the HUD.

    The approach I'm trying to use is to have a positioning script dropped into the object that remembers where it was in relation to the avatar when the script was dropped into the object.  So, the avatar need only position the object where they want it when the HUD rezzes it, drop the script into it, then take it back to inventory and then drag and drop it into the HUD's inventory.  Then, when the HUD rezzes the object, it will detect the avatar's position and move to the correct relative position and rotation.

    I can get the object to always move to the correct relative position in region coordinates, but, I can't get it to take into account which direction the avatar is facing.  This is what I have, so far and at this point I'm stuck:

     

    vector my_pos;
    vector owner_pos;
    vector offset;
    rotation my_rot;
    rotation owner_rot;
    
     
    default
    {
        state_entry()
        {
            
        }
        on_rez(integer start_param)
        {
            owner_pos = llList2Vector(llGetObjectDetails(llGetOwner(), [OBJECT_POS]), 0);
            owner_rot = llList2Rot(llGetObjectDetails(llGetOwner(), [OBJECT_ROT]), 0);
            llSetRot(my_rot);
            llSetRegionPos(owner_pos + offset);
        }
            
        touch_start(integer total_number)
        {
            my_pos = llGetPos();
            my_rot = llGetRot();
            owner_pos = llList2Vector(llGetObjectDetails(llGetOwner(), [OBJECT_POS]), 0);
            offset = my_pos - owner_pos;
            float distance = llVecDist(my_pos, owner_pos);
            llOwnerSay("Owner Pos = " + (string)owner_pos);
            llOwnerSay("My Pos = " + (string)my_pos);
            llOwnerSay("Offset Pos = " + (string)offset);
            llOwnerSay("Distance = " + (string)distance + "m");
        }
    }

     

  4. I'm using this inactivity timer in a remote scene rezzer script and it sometimes works and sometimes does not.  When it works, it works exactly as expected.  When it does not work, it seems to be determining that agents are within range when they really are not in range.

    For example, if there are eight agents in the region, five of them might be together in a group 250m, or so, away at a lower altitude and three could be at the top of the sim over 1000m away, and the script will think that there are four agents within 100m.  I can look at the avatar positions on the minimap.  I can do the math in my head and know that they are hundreds of meters out of range.  I can even be 500m out of range and my key still end up in the list of agents that are within 100m.  So, what have I done wrong, or what is happening, here?  The script sometimes realizes that there is no one within 100m, but other times it does not.  Why?

     

    timer()
        {
            llSetTimerEvent(0.0);
    
            if (inactive_flag && llGetUnixTime() - inactivity_timestamp > inactivity_timer && inactivity_timer != 0)
            {
                llOwnerSay("Inactivity timer expired.  Clearing scene, now...");
                llListenRemove(crate_listen_handle);
                llMessageLinked(LINK_THIS, 0, "AVRS_CLEAR", "");
                llRegionSay(crate_channel, "SCENE_CLEARED"); 
                llSleep(5.0);
                llDie();
            }            
            list agents = llGetAgentList(AGENT_LIST_REGION, []);
            integer n = llGetListLength(agents);
            integer i;
            for (; i< n; i++)
            {
                key current_agent = llList2Key(agents, i);
                list agent_details = llGetObjectDetails(current_agent, [OBJECT_POS]);
                vector agent_pos = llList2Vector(agent_details, 0);
                if (llVecDist(agent_pos, llGetPos()) > 100)
                {
                    agents = llDeleteSubList(agents, i, i);//We only want to keep the agents who are in range
                }
            }
            if (llGetListLength(agents) == 0 && !inactive_flag && inactivity_timer != 0)
            {
                llOwnerSay("The scene has just gone inactive...");
                inactive_flag = TRUE;
                inactivity_timestamp = llGetUnixTime();
            }
            else if (llGetListLength(agents) > 0)
            {
                inactive_flag = FALSE;
                inactivity_timestamp = llGetUnixTime();
            }
            llSetTimerEvent(1.0);
        }

     

  5. This script should work as a sim-wide switch for your script:

     

    integer toggle;

    default
    {
         state_entry()
         {

         }

         touch_start(integer total_number)
         {
             if (!toggle)
             {
                   toggle = TRUE;
                   llRegionSay(90, "show");
             }
            else if (toggle)
           {
                  toggle = FALSE;
                  llRegionSay(90, "hide");
            }
        }
    }

  6. I came up with this script to drop into a 2 meter diameter cylinder prim.  I can rez the prim with this script in it and the prim will move to stay beneath me until I send a message from the HUD to die, or until I leave the region or log off.

     

    vector pos;
    vector old_pos;
    vector agent_size;
    integer die_channel = -100;
    integer listen_handle;

    default
    {
    state_entry()
    {
         listen_handle = llListen(die_channel, "","","");
         agent_size = llGetAgentSize(llGetOwner());
         old_pos = llList2Vector(llGetObjectDetails(llGetOwner(), [OBJECT_POS]), 0);
         old_pos.z -= agent_size.z/1.735;
         llSetTimerEvent(0.1);
    }
    listen(integer channel, string name, key id, string message)
    {
         if (channel == die_channel && message == "WALKER_DIE")
         {
              llDie();
         }
    }
         timer()
         {
              pos = llList2Vector(llGetObjectDetails(llGetOwner(), [OBJECT_POS]), 0);
              if (pos == ZERO_VECTOR) llDie();
              pos.z -= agent_size.z/1.735;
              if (pos.x != old_pos.x || pos.y != old_pos.y || llFabs(pos.z-old_pos.z) > 0.25 )
              {
                   llSetPos(pos);
                   old_pos = pos;
              }
              else if (llGetAgentInfo(llGetOwner()) & AGENT_CROUCHING)
              {
                   pos.z -= 0.25;
                   llSetPos(pos);
                   old_pos = pos;
              }
         }
    }

     

    Whenever I try to use a prim that is smaller than my avatar's walking stride, I lose height with every step.  But, when I use a prim large enough to catch my next step, height remains stable.  Of course, I'm not detecting other surfaces or water to determine whether the prim should be rezzed.   I'm just rezzing it when I don't want to fall and clearing it when I no longer need it.

  7. I'm wanting to write an air/water walker script that would rez prims beneath my feet whenever I step off a prim or ground into air or start to walk into water.  But, I'm not quite sure how to determine when the prims should be rezzed.  

    Obviously, I want them to be rezzed whenever I'm walking off a prim into air or water, and I want them to stay rezzed for at least a few seconds and as long as I am still colliding with them.  But, I don't know how to determine whether I'm still walking on a solid prim or ground and when I'm starting to walk into air or water.

    If someone knows of a full perm air/water walker, I would appreciate a link to it or a copy of it.  Otherwise, any guidance would be greatly appreciated.

    Thanks.

  8. I have some rather large scripts that I would like to go through and streamline to make them more memory efficient.  And, I was wondering what general techniques I might employ to save script memory?

    For example, I know that global variables take up more memory than local variables.  So, I try to use local variables when I can.

    So, what other simple standard scripting techniques might I use to similar effect?

     

    Thanks, in advance for your suggestions!

  9. Perhaps, a little more information is in order: 

    I'm wearing a teleporter HUD.  It rezzes beams - but, only if it can.  I want the teleporter script to detect whether or not I can rez before trying.  Because, if I try to rez, and I can't, I get an error message.  And, instead of getting an error message because I can't rez my beam, I want to use llTeleportAgentGlobalCoords and not use a beam at all.

    So, I can't use your suggestion.  I need something else to tell me whether I can rez on a parcel of land.

  10. I need my script to be able to test whether or not I have rez rights in the parcel and if group building is allowed, I need to know if I have the correct group activated.  I can retrieve the group key for the parcel.  But, what do I  with it?  I looked up llSameGroup(id) and it didn't seem to fit the situation.  Do I pass the parcel UUID to llSameGroup(id) or do I pass the Group UUID to llSameGroup(id)?

    Any help would be appreciated.

  11. I'm receiving a list of keys in the http_response event and I need to pass that list of keys, one at a time, to the dataserver to populate a names list generated from the keys.  The problem I am having is that it passes one, maybe two keys to the dataserver, then the rest of the dataserver requests are dropped.

    Does anyone have any suggestions of how I should construct the loop to pass these keys to the dataserver so that the requests are not dropped?

    Thanks,

    Life

  12. I need to be able to pass lists of keys between prims from one sim to another.  And, I know that I can use llHTTPRequest to do that.  But, the examples given just don't provide enough information for my needs.

    I have reviewed Kira Komorov's Distributed Prim Database and experimented with it with limited success.  But, the scripts are a bit too complex for me, given my limited understanding of the command and the responses generated.  So, I would like a more simple example to study.

    Thanks.

  13. I'm creating a HUD to control a panorama viewer.  

    The HUD has nine display buttons for displaying thumbnails of the scenes to be displayed.  These buttons have been named "0" through "8".   There are also dedicated "Next" and "Prev." buttons.

    When the user selects a scene category, the viewer sends out the scene names and the corresponding thumbnail texture keys in two separate lists (thumb_names and thumb_keys) on the HUD channel.

    The script needs to paint the thumbnail texture on face 1 and change the Description field of each display button to the scene name.  And, when that display button is pressed, the HUD sends out the Description on the HUD channel, which is then captured by the viewer which then displays the scene.

    While there are only nine display buttons for displaying thumbnails, there could be any number of scenes in a category; so, I need to be able to divide the thumb_names and thumb_keys lists into "pages" to be displayed nine at a time on the display prims.

    Where I need assistance is in coming up with the proper flow of events for paging through the thumbnails after I have collected the thumb_names and thumb_keys.  So, I don't really need the actual syntax of the scripting - just what needs to happen in what order for it to be most efficient.  What kind of loop structures should I use to do this?

    Any guidance, or perhaps example scripts, would be of great help.  Thanks.

     

  14. I'm in the process of creating a panorama viewer script that reads notecards for texture keys and places the texture keys into different lists based on the category.  A typical notecard line looks like this:

    pano::<category_name>::<pano_name>::<front_key>::<back_key::<top_key>::<bottom_key>::left_key>::<right_key>

    The first entry simply designates that the data on this line is a panorama. All other lines are ignored.

    What I want to do is have the script dynamically create a category name, based on the entry in the notecard line, to be added to the main menu.  The script would then add the <pano_name> to the newly created category.

    All pano names are also stored in a master list called "Pano_Names"  and all texture keys are contained in the following lists:

    Front_Keys

    Back_Keys

    Top_Keys

    Bottom_Keys

    Left_Keys

    Right_Keys

    When the user makes a selection from any of the categories, it is tested for a match against the master list to retrieve the index position for the texture keys.

    I want the main menu to start out with only the "Settings" option and then for the script to add categories for textures as needed, so that only categories containing panoramas are displayed and so that new categories can be created without having to modify the script in the future.  How might I accomplish the adding of the new categories into which the panoramas will be placed?

    Thanks, for any help you can offer.

     

    EDIT: 

    I've decided to take a simpler approach.  I'm just defining all possible category lists in advance and will only have the category names displayed if there is actually a panorama contained in that list.   It's just a simple test to see if there is anything in a category before adding its name to the main menu.   It does not allow me to create new categories dynamically; but, it does allow me to get on with the project and not have this one technical issue stop me or slow me down significantly.  Thanks.

×
×
  • Create New...