State parameters

Hi,

I was wondering if states can have parameters like statemachines?

I want to do something like this:

state moveTo{
param double time
param array position
entry{
component.moveTo(time,position)
}
}

state waitForEvent{
double time
array position
transition event(time,position) select moveTo(time,position)
transition otherevent(time,position) select otherState
etc.
}

Ruben

State parameters

On Friday 12 October 2007 10:03:19 Ruben Smits wrote:
> Hi,
>
> I was wondering if states can have parameters like statemachines?
>
> I want to do something like this:
>
> state moveTo{
> param double time
> param array position
> entry{
> component.moveTo(time,position)
> }
> }
>
> state waitForEvent{
> double time
> array position
> transition event(time,position) select moveTo(time,position)
> transition otherevent(time,position) select otherState
> etc.
> }

You can re-write this in two ways:

state waitForEvent {
double time
array position
transition event(time, position) { do component.moveTo(time.position); }
select waitForEvent
}

OR:

define position and time as global variables in your StateMachine and the
problem is solved as well.

Peter