<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to use custom code to set operator state? in FlexSim Forum</title>
    <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507691#M21412</link>
    <description>&lt;P&gt;In one of my models I used Custom Task =&amp;gt;TaskType Utilize and FreeOperator because I wasn't sure for how much time my operator is going to be busy. Maybe this could help.&lt;/P&gt;</description>
    <pubDate>Wed, 03 Aug 2016 08:18:12 GMT</pubDate>
    <dc:creator>dawid_dabal</dc:creator>
    <dc:date>2016-08-03T08:18:12Z</dc:date>
    <item>
      <title>How to use custom code to set operator state?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507687#M21408</link>
      <description>&lt;P&gt;&lt;I&gt;[ FlexSim 16.1.0 ]&lt;/I&gt;&lt;/P&gt;&lt;P&gt;In my model, I acquired an operator, and next I want to set his/her state to busy. I tried using a custom code block but when I run the program the operator's state stays busy. I have tried changing the object reference but no luck.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1637-operatorstate.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1493905i25544E5707A9AB10/image-size/large?v=v2&amp;amp;px=999" role="button" title="1637-operatorstate.png" alt="1637-operatorstate.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2016 20:17:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507687#M21408</guid>
      <dc:creator>kari_payton</dc:creator>
      <dc:date>2016-08-02T20:17:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to use custom code to set operator state?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507688#M21409</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://answers.flexsim.com/users/730/kari.p.html" nodeid="730"&gt;@Kari Payton&lt;/A&gt;, you may need to clarify what is going on.  It sounds like the code is doing what you want it to do - changing the state of the Operator to busy. Is the issue that the state stays as busy when you want it to change to something else?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2016 20:26:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507688#M21409</guid>
      <dc:creator>logan_gold</dc:creator>
      <dc:date>2016-08-02T20:26:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to use custom code to set operator state?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507689#M21410</link>
      <description>&lt;P&gt;I have struggled with this also and tried exactly the same solution. I think that Brenton pointed me to a solution with using he TSDelay activity where you can set the state. Maybe this could be a solution for you as well.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2016 20:48:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507689#M21410</guid>
      <dc:creator>SCHamoen</dc:creator>
      <dc:date>2016-08-02T20:48:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to use custom code to set operator state?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507690#M21411</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://answers.flexsim.com/users/86/logan.g.html" nodeid="86"&gt;@Logan Gold&lt;/A&gt; I want it to say busy, but when i click on the operator it says idle.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2016 21:19:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507690#M21411</guid>
      <dc:creator>kari_payton</dc:creator>
      <dc:date>2016-08-02T21:19:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to use custom code to set operator state?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507691#M21412</link>
      <description>&lt;P&gt;In one of my models I used Custom Task =&amp;gt;TaskType Utilize and FreeOperator because I wasn't sure for how much time my operator is going to be busy. Maybe this could help.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2016 08:18:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507691#M21412</guid>
      <dc:creator>dawid_dabal</dc:creator>
      <dc:date>2016-08-03T08:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to use custom code to set operator state?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507692#M21413</link>
      <description>&lt;P&gt;Thanks David. That works. As a reference to others having this problem, I attached a snapshot of the "custom task" box. Also it is important to un-check "wait until complete" or the token will not be released.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1651-operatorstate.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1493900iCCA98933C998DD3C/image-size/large?v=v2&amp;amp;px=999" role="button" title="1651-operatorstate.png" alt="1651-operatorstate.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;A list of state numbers can be found &lt;A rel="noopener noreferrer" href="https://answers.flexsim.com/articles/19702/state-list-21.html" target="_blank"&gt;here.&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2016 13:37:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507692#M21413</guid>
      <dc:creator>kari_payton</dc:creator>
      <dc:date>2016-08-03T13:37:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to use custom code to set operator state?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507693#M21414</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://answers.flexsim.com/users/778/dawid.d.html" nodeid="778"&gt;@Dawid Dabal&lt;/A&gt; How did you get your operator to do other things after you did the custom task to utilize? My token gets stuck when I tell it to travel after i set the custom task. Are all of your tasks custom? &lt;A rel="user" href="https://answers.flexsim.com/users/86/logan.g.html" nodeid="86"&gt;@Logan Gold&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2016 13:48:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507693#M21414</guid>
      <dc:creator>kari_payton</dc:creator>
      <dc:date>2016-08-03T13:48:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to use custom code to set operator state?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507694#M21415</link>
      <description>&lt;P&gt;If you have problem with Involved/Station fields you can free operator with Custom Code. You can manually destroy the Utilize task with a code:&lt;/P&gt;&lt;P&gt;destroyobject(first(node("{your operator adress}&amp;gt;variables/activetasksequence", model())));&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2016 17:13:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507694#M21415</guid>
      <dc:creator>dawid_dabal</dc:creator>
      <dc:date>2016-08-03T17:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to use custom code to set operator state?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507695#M21416</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://answers.flexsim.com/users/778/dawid.d.html" nodeid="778"&gt;@Dawid Dabal&lt;/A&gt; I'm new to FlexSim how do I find the operator address?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2016 16:46:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507695#M21416</guid>
      <dc:creator>kari_payton</dc:creator>
      <dc:date>2016-08-04T16:46:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to use custom code to set operator state?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507696#M21417</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://answers.flexsim.com/users/730/kari.p.html" nodeid="730"&gt;@Kari Payton&lt;/A&gt; A reference to the operator would look something like this, with the name in quotation marks:&lt;/P&gt;
&lt;PRE&gt;node("Operator3", model())&lt;/PRE&gt;
&lt;P&gt;If you aren't sure how to reference an object you can use the sampler &lt;span class="lia-inline-image-display-wrapper" image-alt="1689-sampler.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1493902i6F49F35EE0C19E70/image-size/large?v=v2&amp;amp;px=999" role="button" title="1689-sampler.png" alt="1689-sampler.png" /&gt;&lt;/span&gt; to find it, which is found in many places throughout FlexSim. You can always find it in the Script window (accessed from the toolbar), Code Editor, etc.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2016 16:54:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507696#M21417</guid>
      <dc:creator>adrian_haws</dc:creator>
      <dc:date>2016-08-04T16:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to use custom code to set operator state?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507697#M21418</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://answers.flexsim.com/users/388/adrian.h.html" nodeid="388"&gt;@Adrian Haws&lt;/A&gt; I tried to insert this code snippet &lt;/P&gt;&lt;PRE&gt;destroyobject(first(node("{"DW_1Operators", model()}&amp;gt;variables/activetasksequence", model()))); 
&lt;/PRE&gt;&lt;P&gt;but i get the error: syntax error, unexpected identifier, expecting ')' or ','&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2016 18:13:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507697#M21418</guid>
      <dc:creator>kari_payton</dc:creator>
      <dc:date>2016-08-04T18:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to use custom code to set operator state?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507698#M21419</link>
      <description>&lt;P&gt;Assuming your reference to the operator is correct, operator's state is being set to busy, but then he's being set back to idle most likely by his own internal mechanics. Objects do a lot of state changing on their own and setting an object's state only overrides their current state until the object changes it again. For instance, giving an operator any task will change its state. &lt;/P&gt;&lt;P&gt;This means you can either do what was suggested in the answer by &lt;A rel="user" href="https://answers.flexsim.com/users/778/dawid.d.html" nodeid="778"&gt;@Dawid Dabal&lt;/A&gt; or you'll need to place Set Object State activities everywhere that the state gets changed in order to keep it in a busy state.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2016 19:21:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507698#M21419</guid>
      <dc:creator>matt_long</dc:creator>
      <dc:date>2016-08-04T19:21:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to use custom code to set operator state?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507699#M21420</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://answers.flexsim.com/users/730/kari.p.html" nodeid="730"&gt;@Kari Payton&lt;/A&gt; you will want to use this command instead of destroyobject:&lt;/P&gt;
&lt;PRE&gt;freeoperators(getlabel(token, "DW_1Operators"), NULL);&lt;/PRE&gt;
&lt;P&gt;The second parameter (NULL) references any object that may be involved, such as a flowitem or processor. If you don't have any object involved in the task you will use NULL, but if there is then you need to find a reference to that object.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2016 19:55:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507699#M21420</guid>
      <dc:creator>adrian_haws</dc:creator>
      <dc:date>2016-08-04T19:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to use custom code to set operator state?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507700#M21421</link>
      <description>&lt;P&gt;It should be:&lt;/P&gt;&lt;PRE&gt;&lt;/PRE&gt;&lt;P&gt;destroyobject(first(node("DW_1Operators&amp;gt;variables/activetasksequence", model()))); &lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2016 08:52:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-custom-code-to-set-operator-state/m-p/13507700#M21421</guid>
      <dc:creator>dawid_dabal</dc:creator>
      <dc:date>2016-08-05T08:52:30Z</dc:date>
    </item>
  </channel>
</rss>

