Jump to content
DarkEmperor13

Too many Errors?

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

 

Share this post


Link to post
Share on other sites

It might help to know what error messages are leading up to this one.  Are you listening on DEBUG_CHANNEL or watching in the script popup window?

Share this post


Link to post
Share on other sites

Are you aware that the control event is constantly triggered when you hold down a key?

Every bug here will flood you in no time. The error message tells you what the problem is.

Share this post


Link to post
Share on other sites
19 minutes ago, Nova Convair said:

Are you aware that the control event is constantly triggered when you hold down a key?

Every bug here will flood you in no time. The error message tells you what the problem is.

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

Share this post


Link to post
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) ?

Share this post


Link to post
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  

Share this post


Link to post
Share on other sites

can you give more info on when the error message starts

how many times does the error message appear ? does the error message start when its rezzed ?  when you sit on it ? when you press a key ? if key then what key ?  etc

Share this post


Link to post
Share on other sites

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.

Edited by Wulfie Reanimator
  • Like 1

Share this post


Link to post
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;

 

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...