Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Crashing Cog
Crashing Cog
2004-10-02, 8:55 AM #1
Hi!
There is this COG where you can add a second layer of texture, and it doesn't seem to work.
Code:
# Environment
# 5 of the space is left, the other 5 are right.
#
# By Edward

symbols

message		activated

surface		leftwallon
surface		rightwallon
surface		flooron

surface		spaces0
surface		spaces1
surface		spaces2
surface		spaces3
surface		spaces4
surface		spaces5
surface		spaces6
surface		spaces7
surface		spaces8
surface		spaces9
surface		spaces10
surface		spaces11
surface		spaces12
surface		spaces13
surface		spaces14
surface		spaces15

surface		space0
surface		space1
surface		space2
surface		space3
surface		space4
surface		space5
surface		space6
surface		space7
surface		space8
surface		space9
surface		space10
surface		space11
surface		space12
surface		space13
surface		space14
surface		space15
surface		space16
surface		space17
surface		space18
surface		space19
surface		space20
surface		space21
surface		space22
surface		space23
surface		space24
surface		space25

material	spacem0
material	spacem1
material	spacem2
material	spacem3
material	spacem4
material	spacem5

int		i		local
int		j		local

end
#
code
activated:
	for(j=0; j<=5; j=j+1)
	{
		if(GetSenderRef()==spaces0[j])
		{
			for(i=0; i<=5; i=i+1) SetWallCel(spaces0[j],0);
			SetWallCel(spaces0,1);
			for(i=0; i<5; i=i+1)
				SetSurfaceMat(space0,spacem0[j]);
		}
	}
	for(j=6; j<=10; j=j+1)
	{
		if(GetSenderRef()==spaces0[j])
		{
			for(i=6; i<=10; i=i+1) SetWallCel(spaces0[j],0);
			SetWallCel(spaces0,1);
			for(i=5; i<10; i=i+1)
				SetSurfaceMat(space0,spacem0[j]);
		}
	}
	for(j=11; j<=15; j=j+1)
	{
		if(GetSenderRef()==spaces0[j])
		{
			for(i=11; i<=15; i=i+1) SetWallCel(spaces0[j],0);
			SetWallCel(spaces0,1);
			for(i=10; i<26; i=i+1)
				SetSurfaceMat(space0,spacem0[j]);
		}
	}
	if(GetSenderRef()==leftwallon)
	{
		if(GetFaceGeoMode(space0)==4)
		{
			SetWallCel(leftwallon,0);
			for(i=0; i<5; i=i+1)
				SetFaceGeoMode(space0, 0);
		}
		else
		{
			SetWallCel(leftwallon,1);
			for(i=0; i<5; i=i+1)
				SetFaceGeoMode(space0, 4);
		}
	}
	else if(GetSenderRef()==rightwallon)
	{
		if(GetFaceGeoMode(space5)==4)
		{
			SetWallCel(rightwallon,0);
			for(i=5; i<10; i=i+1)
				SetFaceGeoMode(space0, 0);
		}
		else
		{
			SetWallCel(rightwallon,1);
			for(i=5; i<10; i=i+1)
				SetFaceGeoMode(space0, 4);
		}		
	}
	else if(GetSenderRef()==flooron)
	{
		if(GetFaceGeoMode(space10)==4)
		{
			SetWallCel(flooron,0);
			for(i=10; i<26; i=i+1)
				SetFaceGeoMode(space0, 0);
		}
		else
		{
			SetWallCel(flooron,1);
			for(i=10; i<26; i=i+1)
				SetFaceGeoMode(space0, 4);
		}
	}
return;
end


When I press the 7-15th spaces, the game crashes. The others below that doesn't seem to work at all... I might have missed the answere, and for some strainge reason, I have gotten terribly tired. I require your assistance, please!

/Edward
Edward's Cognative Hazards
2004-10-02, 9:29 AM #2
Make sure all your addressed surfaces are defined. Using surface verbs on non-existant surfaces will crash the game.
And when the moment is right, I'm gonna fly a kite.
2004-10-02, 11:54 AM #3
Get rid of those semi colons after the for loops -- you're accessing an array value past the end of the array, which doesn't exist.

Also, in the loops like the following
Code:
for(j=0; j<=5; j=j+1)
	{
		if(GetSenderRef()==spaces0[j])
		{
			for(i=0; i<=5; i=i+1) SetWallCel(spaces0[
        j
    ],0);
			
        SetWallCel(spaces0,1);
    
			for(i=0; i<5; i=i+1)
				SetSurfaceMat(space0,spacem0[j]);
		}
	}

It looks like the green colored line is supposed to be in the inner loop. If it is, add some braces.
Also, is the red 'j' supposed to be an 'i'? It would seem so, because you're executing the same code 5 times in the loop...
May the mass times acceleration be with you.
2004-10-02, 1:05 PM #4
Thank you! Good night.
Edward's Cognative Hazards

↑ Up to the top!