Page 1 of 1

Generalis Scriptis

Posted: 27 Oct 2006, 14:49
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);
}

Posted: 27 Oct 2006, 21:55
by rattle
When StopMoving() sets bMoving to FALSE the if statements make sure the animation does not play.