Jump to content

Can Anyone fix this broken Pathfinder Script?


Loki Eliot
 Share

You are about to reply to a thread that has been inactive for 4275 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I got this script from the Modular Pathfinder Kit but it doesn't work, can anyone out there fix it for me. I'm trying to make a multistate character but i need an example to work from, but since this is broke i have no idea what to do. 

 

animateGrassEating()
{
	//insert a cunning grass eating animation here
}
 
animateTailWiggle()
{
	//insert very cute tail wiggle animation here
}
 
startup() //called as necessary from events such as script reset or rezzing
{
	llCreateCharacter([CHARACTER_MAX_SPEED, 2, CHARACTER_DESIRED_SPEED, 1.0]); //create the character
	state wander;
}
 
default
{	
	state_entry() //standard event, called when the script resets
	{
		startup();
	}
 
	on_rez(integer start_param) //good to include so it scuttles off when rezzed from inventory or a rezzer
	{
		startup();
	}
}
 
state wander
{
	state_entry()
	{
		llWanderWithin(llGetPos(), <10.0, 10.0, 5.0>, []);
	}
 
	path_update(integer type, list reserved)
	{
		if (type == PU_SLOWDOWN_DISTANCE_REACHED)
		{
			//we're near the goal, we need to switch behaviour
			llExecCharacterCmd([CHARACTER_CMD_SMOOTH_STOP]);
			state graze;
		}
	}
}
 
state graze
{
	state_entry()
	{
		animateGrassEating();
		llSetTimerEvent(15.0); //replace this with random timer, see next section
	}
 
	timer()
	{
		llSetTimerEvent(0);
		animateTailWiggle();
		state wander;
	}
}

 Thank you.

Link to comment
Share on other sites

OK thanks that got me pasts that error. Now it seems 'llExecCharacterCmd(CHARACTER_CMD_SMOOTH_STOP, []);' does nothing. It says in the Wiki that it means 'Character is near current goal.' at which point is will change state, but im not sure wether it actually has a goal being that it wanderswithin. 

Link to comment
Share on other sites

Here's your problem:

startup() //called as necessary from events such as script reset or rezzing{	llCreateCharacter([CHARACTER_MAX_SPEED, 2, CHARACTER_DESIRED_SPEED, 1.0]); //create the character	state wander;}

 

A state can be switched only directly from inside an event code not from inside a user function code. The startup() is a user function.

Strangely enough from time to time the compiler lets it thru and a script works as expected but most of the times it returns the compile error you noted.

 

 

 

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4275 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...