Jump to content

Too many Errors?


DarkEmperor13
 Share

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

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

Recommended Posts

Hiya I've made a go kart and trying to figure out this error; "Too many errors... dropping further messages until the flood stop". My script is as followed:

//Feel free to modify these basic parameters to suit your needs.
float forward_power = 20; //Power used to go forward (1 to 30)
float reverse_power = -15; //Power ued to go reverse (-1 to -30)
float turning_ratio = 4.0; //How sharply the vehicle turns. Less is more sharply. (.1 to 10)
string sit_message = "Jump In!"; //Sit message
string not_owner_message = "You are not the owner of this vehicle ..."; //Not owner message

//Anything past this point should only be modfied if you know what you are doing
string last_wheel_direction;
string cur_wheel_direction;

default
{
    state_entry()
    {
        llSitTarget(<0,0,.2>,llEuler2Rot(<0.0,0.0,0>*DEG_TO_RAD));
        llSetSitText(sit_message);
        
        llSetCameraEyeOffset(<-10.0, 0.0, 2.0> );
        llSetCameraAtOffset(<10.0, 0.0, 2.0> );
        
        //car
        llSetVehicleType(VEHICLE_TYPE_CAR);
         llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 0.2);
         llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 0.80);
         llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 0.10);
         llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 0.10);
         llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_TIMESCALE, 1.0);
         llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 0.2);
         llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_TIMESCALE, 0.1);
         llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 0.5);
         llSetVehicleVectorParam(VEHICLE_LINEAR_FRICTION_TIMESCALE, <1000.0, 2.0, 1000.0> );
         llSetVehicleVectorParam(VEHICLE_ANGULAR_FRICTION_TIMESCALE, <10.0, 10.0, 1000.0> );
         llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 0.50);
         llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 0.50);
    }
    
    changed(integer change)
    {
        if (change & CHANGED_LINK)
        {
            key agent = llAvatarOnSitTarget();
            if (agent)
            {
                if (agent != llGetOwner())
                {
                    llSay(0, not_owner_message);
                    llUnSit(agent);
                    llPushObject(agent, <0,0,50>, ZERO_VECTOR, FALSE);
                }
                else
                {
                    llTriggerSound("Kart Start",1);
                    
                    llSleep(.4);
                    llSetStatus(STATUS_PHYSICS, TRUE);
                    llSleep(.1);
                    llRequestPermissions(agent, PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS);

                    llSetTimerEvent(0.1);
                    llLoopSound("Kart Idle",1);
                }
            }
            else
            {
                llSetTimerEvent(0);
                llStopSound();
                
                llSetStatus(STATUS_PHYSICS, FALSE);
                llSleep(.1);
                llSleep(.4);
                llReleaseControls();
                
                llResetScript();
            }
        }
        
    }
    
    run_time_permissions(integer perm)
    {
        if (perm)
        {
            llStartAnimation("Go Kart Sit");
            llTakeControls(CONTROL_FWD | CONTROL_BACK | CONTROL_DOWN | CONTROL_UP | CONTROL_RIGHT | 
                            CONTROL_LEFT | CONTROL_ROT_RIGHT | CONTROL_ROT_LEFT, TRUE, FALSE);
        }
    }
    
    control(key id, integer level, integer edge)
    {
        integer reverse=1;
        vector angular_motor;
        
        //get current speed
        vector vel = llGetVel();
        float speed = llVecMag(vel);

        //car controls
        if(level & CONTROL_FWD)
        {
            llLoopSound("Kart Drive 03", 1);
            cur_wheel_direction = "WHEEL_FORWARD";
             llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <forward_power,0,0> );
            reverse=1;
        }
        if(edge & CONTROL_FWD)
        {
            llLoopSound("Kart Idle",1);
        }
        if(level & CONTROL_BACK)
        {
            cur_wheel_direction = "WHEEL_REVERSE";
             llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <reverse_power,0,0> );
            reverse = -1;
        }

        if(level & (CONTROL_RIGHT|CONTROL_ROT_RIGHT))
        {
            llStartAnimation("Go Kart Right");
            angular_motor.z -= speed / turning_ratio * reverse;
        }
        if(edge & (CONTROL_RIGHT|CONTROL_ROT_RIGHT))
        {
            llStopAnimation("Go Kart Right");
        }        
        if(level & (CONTROL_LEFT|CONTROL_ROT_LEFT))
        {
             llStartAnimation("Go Kart Left");
            angular_motor.z += speed / turning_ratio * reverse;
        }
        if(edge & (CONTROL_LEFT|CONTROL_ROT_LEFT))
        {
            llStopAnimation("Go Kart Left");
        }

         llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, angular_motor);

    } //end control   
    
    timer()
    {
        if (cur_wheel_direction != last_wheel_direction)
        {
        }
    }
    
} //end default

 

Link to comment
Share on other sites

4 minutes ago, DarkEmperor13 said:

so ur saying that its caused by the control event constantly triggered?

The flooding is, yes, but all that's telling you is that there's something else wrong.  Otherwise there wouldn't be a pile of error messages accumulating.  So, what is the basic error message that you are getting (not the "flooding" message) ?

Link to comment
Share on other sites

the error messages are probably caused by the named animations and sounds not being found in the vehicles Contents

suggest that to begin with you comment out ( // ) all the llStartAnimation, llStopAnimation, llTriggerSound and llLoopSound in the script

to first get the vehicle moving

then obtain animation and sound files appropriate to the vehicle and put them into the Contents with the script. Editing the script so that the script-named animations and sounds match those in Contents  

Link to comment
Share on other sites

41 minutes ago, Wulfie Reanimator said:

Just looking at the code, looks like it's gonna be a math error because of division by speed in the control event.

When the vehicle is stationary, speed is 0.0 and you can't use that for division.

Hmmm.. I don't see anywhere in the code where a quantity is divided by speed.  I see only

23 hours ago, DarkEmperor13 said:

angular_motor.z -= speed / turning_ratio * reverse;

and 

23 hours ago, DarkEmperor13 said:

angular_motor.z += speed / turning_ratio * reverse;

 

Link to comment
Share on other sites

I put the script in a cube and commented out all the sound and animation calls (cuz I have no sounds or animations) and it seems to work. I ran over a couple people in a sandbox and I like the little nose dive when you come to a stop, like an old car with squishy springs and bad shocks.

With the sound/animation calls in, I get the expected trail of errors because the sound and animation files can't be found in the object's inventory, but those come along at an observable pace.

  • Like 1
Link to comment
Share on other sites

20 minutes ago, Rolig Loon said:

Hmmm.. I don't see anywhere in the code where a quantity is divided by speed. 

Those parts were exactly what I was referring to, but it turns out speed is almost never exactly 0 and there's no math error even when it is.

But I've just tried running the script in-world (only changes I made was commenting out trigger/loopsound and startanimation. No errors anywhere.

Edited by Wulfie Reanimator
Link to comment
Share on other sites

There is no division with speed as the divisor in the code so thats no problem. The only divisor is turning_ratio and that is a constant. And - scripts crash on division by zero  errors and don't generate more errors then.

The only terms that can generate errors are llLoopSound, llStartAnimation, llStopAnimation - this ones generate an error in the debug window for a missing animation (or a misspelled one)

Missing permissions can happen too in theory but then the error is shouted instead of the debug window so that would have been recognized.

Edit:

Wulfie - it doesn't matter if speed is zero - look at the division again.

Edited by Nova Convair
  • Like 1
  • Thanks 2
Link to comment
Share on other sites

a FYI

met up with Dark inworld and we had a look at it

all the named sound and animation files were present in Contents

the flooding error message that Dark was getting was caused by calling llLoopSound in the control key press event

if(level & CONTROL_FWD)
{
   llLoopSound("Kart Drive 03", 1);
}

the error went away for Dark when rewrote the code to better handle keydown, keypress and keyup. Playing llLoopSound in the keydown event. Example

if ((level & CONTROL_FWD) && (edge & CONTROL_FWD))
{   // key down
    llLoopSound("Kart Drive 03", 1);
            
}
else if (level & CONTROL_FWD)
{   // key press
    llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <forward_power,0,0> );	

}
else if (edge & CONTROL_FWD)
{   // key up
    llLoopSound("Kart Idle",1);
}

a tiny issue was that I couldn't actually replicate the error message that Dark was getting. Not sure why I couldn't replicate it as originally wrote. However Dark came away with a better understanding of control key event handling so all good

  • Like 2
  • Thanks 2
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1693 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...