Gamestudio Links
Zorro Links
Newest Posts
Comment Out
by AndrewAMD. 11/18/19 17:55
Suppressing Messages
by MatPed. 11/18/19 14:19
Indicator and TimeFrame
by jcl. 11/18/19 12:44
Sierra Chart Plugin
by AndrewAMD. 11/17/19 19:27
Programming a megaproject in python and R
by anonymous87. 11/17/19 12:56
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
10 registered members (MatPed, SkyCaptain, Dooley, AndrewAMD, Uhrwerk, Jerome8911, kvm, Quad, 2 invisible), 655 guests, and 10 spiders.
Key: Admin, Global Mod, Mod
Newest Members
anonymous87, LaszloK, gra9, Dev_ill, Ryu
18330 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Need Help Finding Cause of Crash #478386
10/11/19 13:38
10/11/19 13:38
Joined: May 2005
Posts: 712
Chicago, IL
Dooley Online OP
User
Dooley  Online OP
User

Joined: May 2005
Posts: 712
Chicago, IL
Hey everyone, I am getting a random crash in my game. It seems to happen sporadically, and very rarely. Sometimes I can get through the whole game with no problem. But occasionally it just shuts down. It gives me this Sys_marker in the error message (CH3) so I know it is happening somewhere in this script. This is in my character's main loop, so it is called in every frame.

Does anything stand out here as a possible cause?
Code
		sys_marker("CH3");
		
		
		//TEST JUMPING
		if(var_level_number == 0)
		{
			jump_test = c_trace(my.x,vector(my.x,my.y,my.z-2048),IGNORE_ME|IGNORE_PASSABLE|USE_POLYGON|IGNORE_FLAG2|USE_BOX);
		}
		else
		{
			jump_test = c_trace(my.x,vector(my.x,my.y,my.z-2048),IGNORE_ME|IGNORE_PASSABLE|USE_POLYGON|IGNORE_FLAG2);
		}
		
		if(jump_test > 0)//stores last reliable surface position
		{
			
			surface_z = hit.z;
		}
		
		if(var_jump == 1 && ((jump_test <= my_height) || (hit.entity.skill1 == 62 && on_ground = 1)))
		{
			
			if(jump_wait <= 0 && on_ground != 1)
			{
				if(!snd_playing(land_handle))
				{
					land_handle = snd_play(snd_land,100 * (main_volume/100),0);
				}
			}
			
			on_ground = 0;
			jumping = var_jump_amount;//5.0
		}
		else if(jump_test > my_height)
		{
			if(hit.entity.skill1 == 62 && jumping == 0 && jump_test < 32)
			{
				on_ground = 1;
				my.z = surface_z + my_height;
			}
			else
			{
				on_ground = 0;
				jumping -= 1.2 * time_step;
			}
		}
		else
		{
			if(on_ground == 0 && jumping < -4)
			{
				if(!snd_playing(land_handle))
				{
					land_handle = snd_play(snd_land,100 * (main_volume/100),0);
				}
			}
			
			on_ground = 1;
			my.z = surface_z + my_height;
			jumping = 0;
		}
		
		
		sys_marker("CH4");
		

Last edited by Dooley; 10/11/19 18:52. Reason: Changed Quote to Code as advised
Re: Need Help Finding Cause of Crash [Re: Dooley] #478388
10/11/19 14:38
10/11/19 14:38
Joined: Jun 2007
Posts: 1,270
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,270
Hiporope and its pain
The only thing I see it can cause a crash is both acceses to 'hit.entity.skill1' when 'entity' is not a valid pointer.


pd: use the code tag, not the quote one, in order to post code.

Re: Need Help Finding Cause of Crash [Re: txesmi] #478392
10/11/19 18:51
10/11/19 18:51
Joined: May 2005
Posts: 712
Chicago, IL
Dooley Online OP
User
Dooley  Online OP
User

Joined: May 2005
Posts: 712
Chicago, IL
Oh, good idea. Yes, that pointer should totally have an if statement... Thanks fro the advice, I will do better next time laugh


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1