question

Josué Islas avatar image
0 Likes"
Josué Islas asked Josué Islas commented

Problem with Triggers On Exit Set Label and Color in Combiner

captura-de-pantalla-2024-03-11-155942.pngI am having a problem in Flexscript to give values to the item.Tipo within Combiner "Decoracion" on Exit of Triggers, I get the following error that I show in the image. Could you help me understand why it is wrong? How should I edit it?Ensamble monociclos y bicicletas.fsm

FlexSim 23.2.0
combinertriggersset label
5 |100000

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

1 Answer

Julio R avatar image
0 Likes"
Julio R answered Josué Islas commented

you need to declare the variable value outside the if and else statement:

1710198140274.png



1710198140274.png (42.9 KiB)
· 3
5 |100000

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

Josué Islas avatar image Josué Islas commented ·

but how can I assign item.Tipo the value of 3 if it has a value of 1 or assign item.Tipo the value of 4 if it has a value of 2?


0 Likes 0 ·
Julio R avatar image Julio R Josué Islas commented ·

This should do what you need, the problem is you are using the assert command in an already created label.


Object current = ownerobject(c);
Object item = param(1);
int port = param(2);
{ // ************* PickOption Start ************* //
/***popup:SetLabelAndColor*/
/**Set Label and Color*/
Object involved = /** \nObject: *//***tag:object*//**/item/**/;
string labelname = /** \nLabel: *//***tag:label*//**/"Tipo"/**/;
Variant value;
if(item.Tipo == 1){
                     
 value = /** \nValue: *//***tag:value*//**/3/**/;
}
else {
                     
 value = /** \nValue: *//***tag:value*//**/4/**/;
}
involved.color = Color.fromPalette(value);
involved.Tipo = value;
} // ******* PickOption End ******* //


0 Likes 0 ·
Josué Islas avatar image Josué Islas Julio R commented ·

thank you so much!

0 Likes 0 ·