Generalis Scriptis

Generalis Scriptis

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
User avatar
PauloMorfeo
Posts: 2004
Joined: 15 Dec 2004, 20:53

Generalis Scriptis

Post by PauloMorfeo »

After de-scriptorizing the script of the ArmCom from XTA, i got this:

Code: Select all

walk()
{
	if( bMoving )
	{
		move ...;
		...
		turn ...;
		sleep 40;
	}
	if( bMoving )
	{
		turn ...;
		...
		turn ...;
		sleep 40;
	}
	...
}


StartMoving()
{
	bMoving = TRUE;
}

StopMoving()
{
	bMoving = FALSE;
}
Is that variable, bMoving, needed? I mean, suposedly the function "walk()" is only called if it is moving.

Or are they to make the script stop running the function "walk()" as soon as one of those cycles

Code: Select all

	if( bMoving )
	{
		move ...;
		...
		turn ...;
		sleep 40;
	}
Is finished and, if it was not like this, it would try to execute the whole script and all those "if( bMoving )"s» even after it actually stoped moving?

The MynnCom doesn't uses that, it uses:

Code: Select all

Walk()
{
	if( TRUE )
	{
		move ...;
		...
		turn ...;
		sleep 50;
		if( TRUE )
		{
			move ...;
			...
			turn ...;
			return (0);
		}
	}
}
Wouldn't it be the same (and best) to just be:

Code: Select all

Walk()
{
	move ...;
	...
	turn ...;
	sleep 50;
	if( TRUE )

	move ...;
	...
	turn ...;
	return (0);
}
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

When StopMoving() sets bMoving to FALSE the if statements make sure the animation does not play.
Post Reply

Return to “Game Development”