Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (Ayumi), 662 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
empty pointer in door left and door right #369686
05/06/11 03:57
05/06/11 03:57
Joined: Nov 2006
Posts: 497
Ohio
xbox Offline OP
Senior Member
xbox  Offline OP
Senior Member

Joined: Nov 2006
Posts: 497
Ohio
I don't understand the error at all, I'm not a complete noob to this but I don't see a reason for error. Can anyone please help?
Code:
#define init_xpos skill1

action door_left()
{
	while(!player)
	{
		wait (1);
	}
	my.init_xpos = my.x;
	while(1)
	{
		while(vec_dist(player.x, my.x > 30))
		{
			wait(1);
		}
		while(my.x > (my.init_xpos - 40))
		{
			my.x -= 3 * time_step;
			wait(1);
		}
		while (vec_dist(player.x, my.x) < 100)
		{
			wait(1);
		}
		while (my.x < my.init_xpos)
		{
			my.x += 3 * time_step;
			wait(1);
		}
		my.x = my.init_xpos;
		wait(1);
	}
}

action door_right()
{
	while(!player)
	{
		wait(1);
	}
	my.init_xpos = my.x;
	while(1)
	{
		while(vec_dist(player.x, my.x > 30))
		{
			wait (1);
		}
		while(my.x < (my.init_xpos + 40))
		{
			my.x += 3 * time_step;
			wait(1);
		}
		while (vec_dist(player.x, my.x) < 100)
		{
			wait(1);
		}
		while (my.x > my.init_xpos)
		{
			my.x -= 3 * time_step;
			wait(1);
		}
		my.x = my.init_xpos;
		wait(1);
	}
}



Re: empty pointer in door left and door right [Re: xbox] #369698
05/06/11 07:37
05/06/11 07:37
Joined: Nov 2010
Posts: 96
Vienna
S
Schubido Offline
Junior Member
Schubido  Offline
Junior Member
S

Joined: Nov 2010
Posts: 96
Vienna
IMHO code looks fine. The only thing I could imagine is that "player" becomes invalid at a certain time.
So a "if (!player) break;" after each "wait(1)" might help.

Beside that I would recommend to have only one while loop and track a state instead of having cascading whiles. But thats more a design philosophy and should not be the cause of the error.

Re: empty pointer in door left and door right [Re: Schubido] #369705
05/06/11 08:45
05/06/11 08:45
Joined: Feb 2011
Posts: 135
Myrkling Offline
Member
Myrkling  Offline
Member

Joined: Feb 2011
Posts: 135
vec_dist(player.x, my.x > 30)

should be

vec_dist(player.x, my.x) > 30

Re: empty pointer in door left and door right [Re: Myrkling] #369714
05/06/11 10:20
05/06/11 10:20
Joined: Nov 2010
Posts: 96
Vienna
S
Schubido Offline
Junior Member
Schubido  Offline
Junior Member
S

Joined: Nov 2010
Posts: 96
Vienna
Wow - great syntax parsing - didn't see that ;-)

Re: empty pointer in door left and door right [Re: Schubido] #369722
05/06/11 13:32
05/06/11 13:32
Joined: Nov 2006
Posts: 497
Ohio
xbox Offline OP
Senior Member
xbox  Offline OP
Senior Member

Joined: Nov 2006
Posts: 497
Ohio
Wow, something so easily overlooked. Thanks a bunch man. grin


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