question

Gabriel illescas Cavazos avatar image
0 Likes"
Gabriel illescas Cavazos asked Ben Wilson commented

How can I set a state in FlexSim?

Please share an example.

FlexSim 16.1.2
states
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Gabriel illescas Cavazos avatar image Gabriel illescas Cavazos commented ·

doesnt work, I use this command if(variable1==1)

{

setstate(current,4);

}

and doesnt work I dont know why

0 Likes 0 ·
Sebastian Hemmann avatar image Sebastian Hemmann Gabriel illescas Cavazos commented ·

Could you please give more Information about where and when and why you try to set the state? As Matt explained maybe the state is set but directly overwriten by a Standard setting of the object.

1 Like 1 ·

1 Answer

Sam Stubbs avatar image
2 Likes"
Sam Stubbs answered Matt Long commented

If you just wish to set the state of an object you can just call the setstate() command:

setstate(object,stateNum);

If you look in the setstate() entry in the Command Help, it also gives a list of all the state numbers and their corresponding macro name too.

· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Matt Long avatar image Matt Long commented ·

Be aware that objects set their own states, so depending on when you set the state, it may or may not stay that way.

If you're dealing with TaskExecuters you can use a Utilize or Delay task and assign a state to that task which will continue until the task is finished.

1 Like 1 ·