Crash in sys

Posted By: Liamissimo

Crash in sys - 07/11/10 18:33

This one gives me a Crash in sys (system)
Code:
ENTITY* rock;
var base_perc;
var scan_base = 1;
var b = 0;
function rocket_weg()
{
	ent_remove(rock);
	vec_set(camera.x,nullvector);
	scan_base = 1;
	b = 0;
}
function rocket_launch()
{
	rock = ent_create("sphere.mdl",camera.x,NULL);
	set(rock, INVISIBLE);
	rock.emask |= (ENABLE_BLOCK | ENABLE_ENTITY);
	rock.event = rocket_weg;
	while(rock)
	{
		vec_set(camera.x,rock.x);
		c_move(rock,nullvector,vector(10*time_step,(key_a - key_d),(key_w - key_a)), GLIDE);
		wait(1);
	}
}
action rocket_base()
{
	while(me && scan_base == 1)
	{
		c_scan(my.x,my.pan, vector(360,180,15), IGNORE_ME);
		if(you == ball)
		{
			if(key_e)
			{
				scan_base = 0;
				ent_animate(me,"zu",base_perc,0);
				base_perc += 5*time_step;
			}
			if(mouse_right && b == 0)
			{
				b = 1;
				rocket_launch();
			}
			control = 0;
			phent_enable(ball,0);
			ent_animate(me,"zu",base_perc,0);
			base_perc += 5*time_step;
			c_setminmax(me);
		}
		else
		{
			phent_enable(ball,1);
		}
		wait(1);
	}
}



Why? Because after I am clicking okay in the error box everything works fine wink

And can you say me btw waht causes these crashes in sys?

Thanks
Posted By: MasterQ32

Re: Crash in sys - 07/11/10 18:47

maybe you use a NULL - Pointer!
"Crash is SYS" is in the most of cases a crash because a NULL pointer, try to debug it
Posted By: Liamissimo

Re: Crash in sys - 07/11/10 19:00

I never worked with Debug before o.o No, I am not using a NULL Pointer, code is above.
Posted By: MasterQ32

Re: Crash in sys - 07/11/10 19:05

try this:
Code:
function rocket_weg()
{
	wait(1);
	ent_remove(rock);
	vec_set(camera.x,nullvector);
	scan_base = 1;
	b = 0;
}


Posted By: Liamissimo

Re: Crash in sys - 07/11/10 19:11

Now I have Invalid Arguments in rocket_launch. I think that it is because I am deleting the Entity rock. But why is it causing an error?
Posted By: MrGuest

Re: Crash in sys - 07/11/10 19:48

at a glance, looks like your ball pointer = NULL,
at the start of action rocket_base() put
Code:
while(!ball){wait(1);}


hope this helps
Posted By: Liamissimo

Re: Crash in sys - 07/11/10 19:59

No, sorry, here is the changed code. Same error as before
Code:
function rocket_weg()
{
	wait(1);
	ent_remove(rock);
	vec_set(camera.x,nullvector);
	scan_base = 1;
	b = 0;
}
function rocket_launch()
{
	rock = ent_create("sphere.mdl",camera.x,NULL);
	set(rock, INVISIBLE);
	rock.emask |= (ENABLE_BLOCK | ENABLE_ENTITY);
	rock.event = rocket_weg;
	while(rock)
	{
		vec_set(camera.x,rock.x);
		c_move(rock,nullvector,vector(30*time_step,(key_a - key_d),(key_w - key_s)), GLIDE);
		wait(1);
	}
}
action rocket_base()
{
	while(!ball){wait(1);}
	while(me && scan_base == 1)
	{
		c_scan(my.x,my.pan, vector(360,180,15), IGNORE_ME);
		if(you == ball)
		{
			if(key_e)
			{
				scan_base = 0;
				ent_animate(me,"zu",base_perc,0);
				base_perc += 5*time_step;
			}
			if(mouse_right && b == 0)
			{
				b = 1;
				rocket_launch();
			}
			control = 0;
			phent_enable(ball,0);
			ent_animate(me,"zu",base_perc,0);
			base_perc += 5*time_step;
			c_setminmax(me);
		}
		else
		{
			phent_enable(ball,1);
		}
		wait(1);
	}
}


Posted By: txesmi

Re: Crash in sys - 07/11/10 21:26

I think the problem is you pointer. I got same error in a couple of times trying to compare the result of a collision instruction.

try this:

Code:
if ( result )
{
   if ( you == ball )
   {
      ...
   }
}
else
{
   ...
}


Posted By: Liamissimo

Re: Crash in sys - 07/11/10 21:36

No, now it just playes the animation...finish grin

Code:
var base_perc;
var scan_base = 1;
var b = 0;
var ball_enabl = 0;
function rocket_weg()
{
	wait(1);
	ent_remove(rock);
	vec_set(camera.x,nullvector);
	scan_base = 1;
	b = 0;
}
function rocket_launch()
{
	rock = ent_create("sphere.mdl",camera.x,NULL);
	set(rock, INVISIBLE);
	rock.emask |= (ENABLE_BLOCK | ENABLE_ENTITY);
	rock.event = rocket_weg;
	while(rock)
	{
		vec_set(camera.x,rock.x);
		c_move(rock,nullvector,vector(30*time_step,(key_a - key_d),(key_w - key_s)), GLIDE);
		wait(1);
	}
}
action rocket_base()
{
	while(!ball){wait(1);}
	while(me && scan_base == 1)
	{
		c_scan(my.x,my.pan, vector(360,180,15), IGNORE_ME);
		if(result)
		{
			if(key_e)
			{
				scan_base = 0;
				ent_animate(me,"auf",base_perc,0);
				base_perc += 5*time_step;
			}
			if(mouse_right && b == 0)
			{
				b = 1;
				rocket_launch();
			}
			control = 0;
			ball_enabl = 1;
			phent_enable(ball,0);
			ent_animate(me,"zu",base_perc,0);
			base_perc += 5*time_step;
			c_setminmax(me);
		}
		if(ball_enabl == 1)
		{
			ball_enabl = 0;
			phent_enable(ball,1);
		}
		wait(1);
	}
}


Posted By: MMike

Re: Crash in sys - 07/11/10 22:54

LOOK on the end function action rocket_base


in the ..if mouse_right.. i thnk you should do the all thing
if mouse_right!=NULL ..&&...

after the ent_create give it a wait(1) for security..

And in lite C is it nullvector, i know i have to use NULL and not null.. because its case sensitive..

also this instruction seems to me be dangerouse:
function rocket_weg()
{
>>>> ent_remove(rock);
vec_set(camera.x,nullvector);
scan_base = 1;
b = 0;
}
function rocket_launch()
{
rock = ent_create("sphere.mdl",camera.x,NULL);
set(rock, INVISIBLE);
rock.emask |= (ENABLE_BLOCK | ENABLE_ENTITY);
rock.event = rocket_weg;
>>>> You create and then you delete.. perhaps there is some.. thing here causing error.
then you ask for the rock, but there is no while valid rock ! you removed..
while(rock)


Posted By: Liamissimo

Re: Crash in sys - 07/11/10 23:42

Yeah, but in the while: It want a rock. So, when there is no rock it just dont run. I dont understand why it causes an error if an while condition isn't true. Now, if I right_klick nothing happens. Can't be so difficult wink
Code:
function rocket_weg()
{
	wait(1);
	ent_remove(rock);
	vec_set(camera.x,nullvector);
	scan_base = 1;
	b = 0;
}
function rocket_launch()
{
	rock = ent_create("sphere.mdl",camera.x,NULL);
	wait(1);
	set(rock, INVISIBLE);
	rock.emask |= (ENABLE_BLOCK | ENABLE_ENTITY);
	rock.event = rocket_weg;
	while(rock)
	{
		wait(1);
		vec_set(camera.x,rock.x);
		c_move(rock,nullvector,vector(30*time_step,(key_a - key_d),(key_w - key_s)), GLIDE);
	}
}
action rocket_base()
{
	while(!ball){wait(1);}
	while(me && scan_base == 1)
	{
		c_scan(my.x,my.pan, vector(360,180,15), IGNORE_ME);
		if(you == ball)
		{
			if(key_e)
			{
				scan_base = 0;
				ent_animate(me,"auf",base_perc,0);
				base_perc += 5*time_step;
			}
			if(mouse_right != NULL && b == 0)
			{
				b = 1;
				rocket_launch();
			}
			control = 0;
			ball_enabl = 1;
			phent_enable(ball,0);
			ent_animate(me,"zu",base_perc,0);
			base_perc += 5*time_step;
			c_setminmax(me);
		}
		wait(1);
	}
}


Posted By: Superku

Re: Crash in sys - 07/11/10 23:47

I did not read the whole topic but you should change
while(rock)
{
wait(1);
vec_set(camera.x,rock.x);
c_move(rock,nullvector,vector(30*time_step,(key_a - key_d),(key_w - key_s)), GLIDE);
}

to

while(rock)
{
vec_set(camera.x,rock.x);
c_move(rock,nullvector,vector(30*time_step,(key_a - key_d),(key_w - key_s)), GLIDE);
wait(1);
}

I hope you see why the second version is the only one that's correct.
Posted By: CoburnDomain

Re: Crash in sys - 07/12/10 04:46

I remember getting this crash in sys error. I remember that I missed a while(1) loop, so after I added that, everything worked fine.
Posted By: Liamissimo

Re: Crash in sys - 07/12/10 16:01

Thanks Superku, of course wait to the end.

So, do you say I have to create a while(1) loop INSTEAD of the while(rock)?
Posted By: Superku

Re: Crash in sys - 07/12/10 16:07

I think the while(rock) loop is just fine.
Posted By: Liamissimo

Re: Crash in sys - 07/12/10 16:16

Me too. I am sure it is still saying Invalid Argument. VCant test it right now because problems with A8
Posted By: 3run

Re: Crash in sys - 07/12/10 18:46

I have SYS error with A8, it never use to appear in A7. Here is the code:
Code:
function gravity_()
{
    my_height = c_trace(my.x,vector(my.x,my.y,my.z - 1000),IGNORE_MODELS|IGNORE_FLAG2|IGNORE_PASSABLE|USE_BOX);
    if(my_height > 10)
    {
	accelerate(absdist.z,-10 * time_step,-1);
    }
    else 
    {
	absdist.z =-(my_height/1.2)+4;
	absdist.z = clamp(absdist.z,-4,4);
    }
}

action hero_()
{ 
   while(my.health > 0)
   {
     gravity_();
     /// c_move here and wait(1);
   }
}

It appears some times, when I shoot enemies.
Posted By: MasterQ32

Re: Crash in sys - 07/15/10 19:38

Originally Posted By: 3run
I have SYS error with A8, it never use to appear in A7.

you know that this is only a public beta and not a released version, don't you?
Posted By: Spirit

Re: Crash in sys - 07/15/10 20:20

3run, please dont hijack threads, this was a discussion of a different problem and you are kindly asked to open a new thread and not just blurt out your problem in other peoples discussions.

And public beta or not, the error happens in your script, so you can check which line it is that crashes. You can use the new sys_marker function for finding the place. There are differences between A8 and A7, for instance A8 does not support collision with A6 levels anymore, so if you have compiled maps in A6 mode it will behave different.
© 2024 lite-C Forums