Jump to content

Altier Verwood

Resident
  • Posts

    90
  • Joined

  • Last visited

Posts posted by Altier Verwood

  1. Hello forum, I have a simple script I'm making here and it is kind of kicking my butt. 

    The script is meant to do one thing, move an attached object between two preset positions and rotations, at the bottom I have it commented, there is an aim and a hold, and when touched the object should move. 
    the problem I have run into. is that it moves relative to sim rotation, and I have been trying for hours to fix it. any help here would be appreciated. 

    rotation rot_xyzq;
    rotation rot_xyza;
    default
    {
    
        state_entry()
        {
            vector xyz_angles = <65.35001, 84.95001, 294.54999>; // This is to define a 1 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 total_number)
        {        
            llSetLocalRot(llGetLocalRot()*rot_xyzq); //Do the Rotation...
            llSetPos(<-0.04494, -0.62486, -0.03175>);
            state hold;
        }
    }
    
    
        state hold
    {
        state_entry()
        {
            vector xyz_angles2 = <270.00000, 4.60001, 90.79999>; // This is to define a 1 degree change
            vector angles_in_radians2 = xyz_angles2*DEG_TO_RAD; // Change to Radians
            rot_xyza = llEuler2Rot(angles_in_radians2); // Change to a Rotation
        }
        touch_start(integer total_number)
        {       
            llSetLocalRot(llGetLocalRot()*rot_xyza); //Do the Rotation...
            llSetPos(<0.63130, -0.06893, -0.01683>);
            state default;
        }
    }
    
    //aim
    //pos <-0.04494, -0.62486, -0.03175>
    //rot <65.35001, 84.95001, 294.54999>
    
    //Hold
    //pos <0.63130, -0.06893, -0.01683>
    //rot <270.00000, 4.60001, 90.79999>
  2. Hello forums, I feel like I come asking so many questions, I have one more.

    I have an object, with some child prims on it named "Hangar" and i have another script that uses to delete the docked ship, but I've run into a problem, that it only detects the name of the root prim and not the child it's colliding with. am i missing something?  this script is in the colliding prim it's just not detecting the name of the child prim. 

    default
    {
        collision_start(integer hit)
        {
            //from here

            llGetObjectDetails(id,([OBJECT_NAME]));
            if(id == "Hangar")
            {
            llDie();
            }
            // to here
        }
    }

  3. Hello forums, I have a simple collision detection script looking for.

        collision_start(integer hit)
        {
            //from here        
            string name = llDetectedName(0);
            if(llGetSubString(name, 0, 12) == "CG Col-Viper")
            {
            Strike_count = Strike_count+1;
            llWhisper(0,"Viper docked repairs underway");
            }
            // to here

     

    And I have an object that collides with it named. 

    CG Col-Viper (Mk V)

    I do not understand, nothing happens, unless it is named exactly

    CG Col-Viper

    and have the object name exactly the name in the brackets, not the length of my substring? I'm really lost here. 

  4. Hello again forum, I have another question I wasn't able to find an answer to, I'm writing a script that will in theory, slowly move a child link in a random direction then reset slowly back to the original position.

    but I have run into two problems, first is the movement is not slow it just snaps to the location and the second problem, is I can't get it to save the original position to move back to, instead it just keeps moving farther away. any help would be greatly appreciated. 

    integer k;
    vector pos;
    rotation rot;
    vector opos;
    float ds = 1; //debris size SMALLER
    float rs = 2; //debris random size BIGGER
    default
    {
        state_entry()
        {
                llSetTimerEvent(2.0);
                opos= llGetPos();
        }
        timer()
        {
            for(k=0;k<rs;++k)
            {
                llSleep(.1);      
                pos = llGetLocalPos();
                llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_POSITION, pos+<(llFrand(rs))-ds,(llFrand(rs))-ds,(llFrand(rs))-ds>*rot]);
    //llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_POSITION, opos*rot]);
            }
                    for(k=0;k<rs;++k)
            {
                llSleep(.1);      
                pos = llGetLocalPos();
                llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_POSITION, opos*rot]);
        }
            
        }
    }
     

  5. Hello forums, I have two scripts that talk back and forth at each other, but I can't get the second script to work. 

    Here is the message sent by the first script

    This script works, it just shouts a region say when touched

            nameTag = llGetSubString(llGetObjectName(), 0, 6);
            llRegionSay(-83951,nameTag); 
            llOwnerSay(nameTag);      

    in the second script, the get substring in the listen doesn't seem to work, if i remove that part the script works and it hears the region say. 

     state_entry()  
    {
        llListen(-83951, "", "", "");   
        nameTag = llGetSubString(llGetObjectName(), 0, 6);
    }
        listen(integer chn, string nam, key id, string msg)
        {
        if (chn == -83951 && llGetSubString(msg, 0, 6) == nameTag)

     

     

  6. 6 minutes ago, Jenna Huntsman said:

    That's because you've (presumably) disabled the script which handles control of the vehicle, but then didn't disable the vehicle's physics behaviour.

    Depending on the type of vehicle, you actually *may* want to keep physics enabled but just disable the engine script (for example, a small boat wherein crashing into it would still cause it to move), but without more details about what you're trying to do it's hard to advise the best approach.

    Hey there thank you for the reply, its hard to explain in greater detail, but I will try, my HP script sets the first physics engine, to FALSE turning it off, and turns on another identical engine with slightly slow turning and speed, script by setting it to TRUE. 

  7. Hello LSL scripters, I have a vehicle with two engine scripts in it, there is a meter inside the object in another script that controls the HP of the vehicle, when it reaches 50% I have it so it does this 

            llSetScriptState(engineD,TRUE);
            llSetScriptState(engine,FALSE);

    But when that happens, and you next sit on the vehicle to drive it, the ship just falls to the ground and is uncontrol able. 

    is this a problem with SL and it's not possible to do, or is it my vehicle script? 

     

  8. 47 minutes ago, Rolig Loon said:

    You don't need to check if( chn == -HIDDEN), because you've already filtered for the channel number in your llListen statement.   More than that, though, you don't want the semicolon at the end of that line. :) 

    Why is it always a semicolon XD Thank you Rolig, saving my butt once again.

  9. 31 minutes ago, Profaitchikenz Haiku said:
    // outside the states we declare global variablees and functions
    
    string nameTag;
    
    // inside state_entry we read the object nname annd xtrat five characters as the nae tag
    
    default
    {
        state_entry()
    	{
    		nameTag = llGetSubString(llGetObjectName(), 0, 5);	// we will only action messages from other objects with this prefix in their name
    	}
    
    // then in the listen event
    	listen(integer ch, string name, key id, string msg)
    	{
    		if( llGetSubString(namme, 0, 5) == nameTag)
    		{
    			// we hear and obey
    		}
    		// otherwise we do a van-gogh (turn a deaf ear) "I hear no sheeps"
    	}
    
    }

     

    I think I am still doing something wrong, it's still taking commands regardless of the sub string. here is the current code.

      state_entry()  
    {
        llListen(-HIDDEN, "", "", "");
        nameTag = llGetSubString(llGetObjectName(), 0, 5);
        //llWhisper(0,damage_type +" Remaining Rounds "+(string)ammo_count);
    }
           listen(integer chn, string nam, key id, string msg)
        {
        if (msg == resupply_command && chn == -HIDDEN&& llGetSubString(nam, 0, 5) == nameTag);
                {
            llSleep(1);
            //ammo_storeage = ammo_storeage_MAX;
            ammo_count = ammo_count_MAX ;
            llWhisper(0,damage_type +" Remaining Rounds "+(string)ammo_count);
                }
        }

     

  10. 2 minutes ago, Profaitchikenz Haiku said:

    Yes, you can read the object name of the listener prim and extract the first 5 characters into a global variable "nameTag" and use that as the comparison.

    Oh, could you elaborate a bit on that one? I've never done something like that.

  11. 2 minutes ago, Profaitchikenz Haiku said:

    Inside the listen event

    If llGetSubString(name, 0, 5) == "CG REP") // is the name of the sending object in m class of names?

    and then only process the heard text if the name of the sending object fits your naming pattern.

    Oh man this looks like what I need, is there a way to make it automatically get the name from the object ?

    If llGetSubString(llgetobjectname(), 0, 5) == "CG REP") kind of thing?

  12. Hello SL scripting  people me again! I have a question about a listen check, I'm trying  a  dozy of a thing and I want to know if it is even possible.

    first off is the script. I want to  take this script a step farther. and have it check the name of the  object.

    the  name is this 

    CG REP Z-95 3.6

    all my  objects match this naming convention with  a 3 letter tag just  after CG, I want to  make it so that  resupply checks that REP or IMP or SEP etc and only then will it accept the command.

    but I can't figure out how to do a listen script so complex like that. would it be a while loop? I need a lot of help on this one.

     

    string resupply_command="R1";

     listen(integer chn, string nam, key id, string msg)
        {
        if (msg == resupply_command && chn== -HIDDEN)
                {
            llSleep(1);
            //ammo_storeage = ammo_storeage_MAX;
            ammo_count = ammo_count_MAX ;
            llWhisper(0,damage_type +" Remaining Rounds "+(string)ammo_count);
                }
        }

×
×
  • Create New...