Back to the Vavoom Forum Archives


Forum

Z_CT at w_wad.c:521

Thu, 04 Jan 2007 02:16:00

The 4th Class

While executing a script I got this bug. What does it mean?
Thu, 04 Jan 2007 22:50:37

Janis Legzdinsh

What script?
Fri, 05 Jan 2007 21:53:30

The 4th Class

Just one of my map's ACS scripts. I'll copy it when I'm on the com that has it next, but basically it had lots of "if-else if" statements in a while loop. One variable always being incremented, another decremented, I remember it also executed a few other scripts. O yes, and it features floor_raiseinstant and floor_lowerinstant simultaneously going on. You see, I'm building a train. <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->
Sun, 07 Jan 2007 02:55:35

The 4th Class

Well, here it is.
script 8 (void) // Testing the eastbound movement of the train
{
	int a; // The starting tag (this may also be the/an argument)
	int b; // The starting line
	int c; // Times how long the cart takes
	int thrust;
	a = 248; // The "starting tag" is the front of the cart, the one facing the direction
             // it's heading.  Also called the "front tag."  The "back tag" always equals a + 8.
	b = 0;
	c = 0;
	thrust = 1;
	setlineblocking(3,ON);
	setlinetexture(3,SIDE_FRONT,TEXTURE_MIDDLE,"GATE04");
	setlinetexture(3,SIDE_BACK,TEXTURE_MIDDLE,"GATE04");
	while (a > 46) // Here the train starts moving. A represents the TID of a sector, b counts how many sectors have passed, and c counts how long the damn thing stays in motion.
	{
		a--;
		b++;
		floor_raiseinstant(a,19,19);
		changefloor(a,"F_067");
		floor_lowerinstant(a+8,19,19);
		changefloor(a+8,"X_001");
		if (ontrain == 1) // Ontrain is a map var
		{
			thrustthing(0,thrust);
			if (thrust == 1) { thrust++; }
			else {thrust--;}
		}
		if (b < 8) { delay(7); c+=7; }
		else if ((b >= 8) && (b < 16)) { delay(6); c+=6; }
		else if ((b >=16) && (b < 24)) { delay(5); c+=5; }
		else if ((b >=24) && (b < 32)) { delay(4); c+=4; }
		else if ((b >=32) && (b < 40)) { delay(3); c+=3; }
		else if ((b >=40) && (b < 48)) { delay(2); c+=2; }
		else { delay(1); c++; }
	}
	// By now the train has "left the map"
	if (ontrain == 1) { acs_execute(2,6,0,0,0); teleport_newmap(6,0); } // Thus there will be another train in the next level
}
Crashes about halfway through while loop.
Mon, 08 Jan 2007 19:23:41

Janis Legzdinsh

I don't see anything wrong. Does it work fine in Vavoom?
Wed, 17 Jan 2007 02:22:13

The 4th Class

Yes. Well, once I removed a few of the else if statements it began working fine again in DOS, so I'm gonna play the mystery game and leave this one as it. <!-- s:? --><img src="{SMILIES_PATH}/icon_confused.gif" alt=":?" title="Confused" /><!-- s:? -->
Thu, 18 Jan 2007 17:55:57

Firebrand

It could be related to the ACS compiler, but I'm sure it would send an error if something went wrong <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->.
Thu, 18 Jan 2007 22:31:39

The 4th Class

I'm willing to bet the math involved in running the script was just too complicated for it to handle? I mean, first it has to change floor textures, then raise_instant the front floor, lower_instant the back one, then set the new front floor as the main TID, then figure out whether or not the player actually IS on the train, and thrust him accordingly, then finally figure out how long to delay it until it must repeat the while loop (meaning it also must count how long it's been in momentum to simulate acceleration). Hell even I'm confused now. <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
Fri, 19 Jan 2007 08:09:34

Crimson Wizard

An extremely strange decision. Program can not get complicated with such things, since it preforms those actions one by one and does not try to "remember" what it was doing on its previous step as you do. I suggest either ACS compiler made a mistake while coding those nested "else if"s, or (but that's less possible imho) DOS Hexen engine has a small limit of allowed nested blocks.
Fri, 19 Jan 2007 20:12:14

Firebrand

Or the original Hexen's ACS compiler doesn't know how to handle "else if" statements.
Sat, 20 Jan 2007 14:40:50

Crimson Wizard

[quote="Firebrand":1nag6irb]Or the original Hexen's ACS compiler doesn't know how to handle "else if" statements. No it does.

Back to the Vavoom Forum Archives