How to attach a variable to the message that will increase each time the message is sent to count the message?
How to attach a variable to the message that will increase each time the message is sent to count the message?
Well, I've created and incremented a variable, now how do I output it?
Object current = ownerobject(c);
Object item = param(1);
int port = param(2);
{ // ************* PickOption Start ************* //
/***popup:SendMessage*/
/**Send Message*/
int NoDelay = -1;
double delaytime = /** \nDelay Time: *//***tag:delaytime*//**/0/**list:NoDelay~0~10~current.messageDelay*/;
treenode toobject = /** \nTo: *//***tag:to*//**/current/**/;
treenode fromobject = /** \nFrom: *//***tag:from*//**/current/**/;
double param1 = /** \nParam1: *//***tag:par1*//**/1/**/;
double param2 = /** \nParam2: *//***tag:par2*//**/0/**/;
double param3 = /** \nParam3: *//***tag:par3*//**/0/**/;
/**\n\nDelay Time:\nNoDelay: message sent immediately within trigger context\n0: delayed message sent in 0 time*/
if (/** \nCondition: *//***tag:condition*//**/content(current) == 1/**/) {
if (delaytime == NoDelay)
sendmessage(toobject,fromobject,param1,param2,param3);
else senddelayedmessage(toobject, max(0,delaytime), fromobject,param1,param2,param3);
}
} // ******* PickOption End ******* //
{ // ************* PickOption Start ************* //
/***popup:SetTrackedVariable*/
/***tag:title*//**Set Tracked Variable*/
string trackedvar = /** \nVariable: *//***tag:trackedvariable*//**/"TrackedVariable1"/**/;
double initial = /** \nInitial: *//***tag:initial*//**/TrackedVariable(trackedvar).value/**/;
double val = /** \nValue: *//***tag:value*//**/1/**/;
if (/** \nCondition: *//***tag:condition*//**/1/**/)
TrackedVariable(trackedvar).value = initial + val;
} // ******* PickOption End ******* //
13 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved