<?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: OnStateChange node under behaviour/eventfunctions as flexscript in FlexSim Forum</title>
    <link>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559372#M62207</link>
    <description>&lt;P&gt;Hi &lt;A rel="user" href="https://answers.flexsim.com/users/206/phil.b.html" nodeid="206"&gt;@phil.bobo&lt;/A&gt; &lt;/P&gt;&lt;P&gt;The object is a custom crane, which has a custom state profile. I however do want to use the states set by FlexSim. I had therefore added the OnStateChange event to the eventfunctions. This did not work completely in combination with the wait for event in processFlow.&lt;/P&gt;&lt;P&gt;After I added the bindEventByName in the cppfunction I got an OnStateChange node under the variables in the custom crane when I drag it in the model. This looks to be working fine and I therefore removed the OnStateChange node from under the eventfunctions node in the library and added that node under variables in the library object. I thought that otherwise I would have a OnStateChange node under eventfunctions and under variables, and that does not look efficient. &lt;/P&gt;</description>
    <pubDate>Tue, 10 Oct 2017 13:55:18 GMT</pubDate>
    <dc:creator>patrick_zweekhorst</dc:creator>
    <dc:date>2017-10-10T13:55:18Z</dc:date>
    <item>
      <title>OnStateChange node under behaviour/eventfunctions as flexscript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559368#M62203</link>
      <description>&lt;P&gt;&lt;I&gt;[ Flexsim 17.1.6 ]&lt;/I&gt;&lt;/P&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I have a module where I have added an OnStateChange dll function to an object in the library. This function worked good and did what I wanted, until I used a wait for event in processFlow where I am waiting for the OnStateChange on the same object. It looks like the wait for event in the processFlow creates a flexscript node in the behaviour node of the object in the model:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="9009-onstatechange.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1496128i58BF00361220E756/image-size/large?v=v2&amp;amp;px=999" role="button" title="9009-onstatechange.png" alt="9009-onstatechange.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;P&gt;I think this causes that the dll function in the library is no longer called ( below the dll function in the library )&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="9010-onstatechange2.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1496129i8C69E2E490D63F8B/image-size/large?v=v2&amp;amp;px=999" role="button" title="9010-onstatechange2.png" alt="9010-onstatechange2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;How can I fix this? Manually copying the dll node from the library over the flexscript node in the model works, but that then needs to be done for each object in the model.&lt;/P&gt;&lt;P&gt;Thank you for any help,&lt;/P&gt;&lt;P&gt;Patrick&lt;/P&gt;</description>
      <pubDate>Mon, 09 Oct 2017 15:06:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559368#M62203</guid>
      <dc:creator>patrick_zweekhorst</dc:creator>
      <dc:date>2017-10-09T15:06:21Z</dc:date>
    </item>
    <item>
      <title>Re: OnStateChange node under behaviour/eventfunctions as flexscript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559369#M62204</link>
      <description>&lt;P&gt;Try binding your OnStateChange node within your object's bindEvents() cppfunction:&lt;/P&gt;&lt;PRE&gt;bindEventByName("OnStateChange", node_b_OnStateChange, "OnStateChange");&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Oct 2017 16:40:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559369#M62204</guid>
      <dc:creator>philboboADSK</dc:creator>
      <dc:date>2017-10-09T16:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: OnStateChange node under behaviour/eventfunctions as flexscript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559370#M62205</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://answers.flexsim.com/users/206/phil.b.html" nodeid="206"&gt;@phil.bobo&lt;/A&gt; ,&lt;/P&gt;&lt;P&gt;Thanks for your solution. Is it correct that I no longer need to have the OnStateChange dll node under behaviour/eventfunctions? This node should now be under variables as I understand correctly? It does work if I do that.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 07:27:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559370#M62205</guid>
      <dc:creator>patrick_zweekhorst</dc:creator>
      <dc:date>2017-10-10T07:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: OnStateChange node under behaviour/eventfunctions as flexscript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559371#M62206</link>
      <description>&lt;P&gt;"Is it correct that I no longer need to have the OnStateChange dll node under behaviour/eventfunctions?"&lt;/P&gt;&lt;P&gt;I don't know what your object is or what you were using the OnStateChange attribute for. So I can't definitively answer this question.&lt;/P&gt;&lt;P&gt;"This node should now be under variables as I understand correctly?"&lt;/P&gt;&lt;P&gt;The location of attribute nodes is irrelevant. You can put them anywhere in the object's attribute tree and the object can find them.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 13:08:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559371#M62206</guid>
      <dc:creator>philboboADSK</dc:creator>
      <dc:date>2017-10-10T13:08:26Z</dc:date>
    </item>
    <item>
      <title>Re: OnStateChange node under behaviour/eventfunctions as flexscript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559372#M62207</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://answers.flexsim.com/users/206/phil.b.html" nodeid="206"&gt;@phil.bobo&lt;/A&gt; &lt;/P&gt;&lt;P&gt;The object is a custom crane, which has a custom state profile. I however do want to use the states set by FlexSim. I had therefore added the OnStateChange event to the eventfunctions. This did not work completely in combination with the wait for event in processFlow.&lt;/P&gt;&lt;P&gt;After I added the bindEventByName in the cppfunction I got an OnStateChange node under the variables in the custom crane when I drag it in the model. This looks to be working fine and I therefore removed the OnStateChange node from under the eventfunctions node in the library and added that node under variables in the library object. I thought that otherwise I would have a OnStateChange node under eventfunctions and under variables, and that does not look efficient. &lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 13:55:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559372#M62207</guid>
      <dc:creator>patrick_zweekhorst</dc:creator>
      <dc:date>2017-10-10T13:55:18Z</dc:date>
    </item>
    <item>
      <title>Re: OnStateChange node under behaviour/eventfunctions as flexscript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559373#M62208</link>
      <description>&lt;P&gt;
	That's behaving differently than I thought it was.&lt;/P&gt;&lt;P&gt;
	It may be working correctly now, but you may run into issues if something changes in a future version.&lt;/P&gt;&lt;P&gt;
	In your case, I would copy the BasicFR's implementation:&lt;/P&gt;&lt;P&gt;
	1. A statechange variable that is connected to your DLL with your custom state profile code.&lt;/P&gt;&lt;P&gt;
	2. An OnStateChange attribute under behavior/eventfunctions.&lt;/P&gt;&lt;P&gt;
	3. An _OnStateChange under behavior/eventfunctions/eventInfo to specify parameters&lt;/P&gt;&lt;P&gt;
	4. An onStateChange() cppfunction called from the OnStateChange attribute that calls the statechange variable.&lt;/P&gt;&lt;P&gt;
	5. A bindEvents() cpp function that calls&lt;/P&gt;
&lt;PRE&gt;bindEventByName("statechange", node_v_statechange, "OnStateChange", EVENT_TYPE_DEFAULT);
&lt;/PRE&gt;&lt;P&gt;
	If you follow the BasicFR's example, your object is more likely to continue to function correctly in future releases.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 14:15:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559373#M62208</guid>
      <dc:creator>philboboADSK</dc:creator>
      <dc:date>2017-10-10T14:15:13Z</dc:date>
    </item>
    <item>
      <title>Re: OnStateChange node under behaviour/eventfunctions as flexscript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559374#M62209</link>
      <description>&lt;P&gt;Also, if you are just using the OnStateChange to handle a custom state profile, then you don't actually need an OnStateChange attribute. Follow the MultiProcessor's example and use two state profiles: the default state profile that uses the states set by FlexSim, and an extra state_profiles state profile where you keep track of your own states, passing 1 as the profile number when you want to change the states in your custom state profile.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 14:17:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559374#M62209</guid>
      <dc:creator>philboboADSK</dc:creator>
      <dc:date>2017-10-10T14:17:36Z</dc:date>
    </item>
    <item>
      <title>Re: OnStateChange node under behaviour/eventfunctions as flexscript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559375#M62210</link>
      <description>&lt;P&gt;Thanks &lt;A rel="user" href="https://answers.flexsim.com/users/206/phil.b.html" nodeid="206"&gt;@phil.bobo&lt;/A&gt; ,&lt;/P&gt;&lt;P&gt;I will try this and come back to you if I have any other questions or remarks&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 14:20:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559375#M62210</guid>
      <dc:creator>patrick_zweekhorst</dc:creator>
      <dc:date>2017-10-10T14:20:06Z</dc:date>
    </item>
    <item>
      <title>Re: OnStateChange node under behaviour/eventfunctions as flexscript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559376#M62211</link>
      <description>&lt;P&gt;Hi @phil.bobo&lt;/P&gt;&lt;P&gt;It is not completely working jet. I have tried to follow your steps and looked at the BasicFR. This is how the tree looks now: &lt;STRONG&gt;&lt;/STRONG&gt;&lt;U&gt;&lt;/U&gt;&lt;SUB&gt;&lt;/SUB&gt;&lt;SUP&gt;&lt;/SUP&gt;&lt;DEL&gt;&lt;/DEL&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="9029-onstatechangetree.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1496127iC5143AC66C4763A9/image-size/large?v=v2&amp;amp;px=999" role="button" title="9029-onstatechangetree.png" alt="9029-onstatechangetree.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Where the StateChange node is under variables. In the bindEvents function I have added the code you said:&lt;/P&gt;&lt;PRE&gt;bindEventByName("StateChange", node_v_statechange, "OnStateChange", EVENT_TYPE_DEFAULT );&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;U&gt;&lt;/U&gt;&lt;SUB&gt;&lt;/SUB&gt;&lt;SUP&gt;&lt;/SUP&gt;&lt;DEL&gt;&lt;/DEL&gt;The problem now is that the OnStateChange function does not fire. What am I missing?&lt;/P&gt;&lt;P&gt;Thank you for the help.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 15:06:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559376#M62211</guid>
      <dc:creator>patrick_zweekhorst</dc:creator>
      <dc:date>2017-10-10T15:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: OnStateChange node under behaviour/eventfunctions as flexscript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559377#M62212</link>
      <description>&lt;P&gt;Try renaming the eventInfo node to _OnStateChange like the BasicFR is.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 15:10:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559377#M62212</guid>
      <dc:creator>philboboADSK</dc:creator>
      <dc:date>2017-10-10T15:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: OnStateChange node under behaviour/eventfunctions as flexscript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559378#M62213</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://answers.flexsim.com/users/206/phil.b.html" nodeid="206"&gt;@phil.bobo,&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I changed the name of the eventinfo node to _OnStateChange. This is how it is in 17.2 for the BasicFR, but not for the BasicFR in 17.1 ( where I am in with this module) . This however did not make ant difference. The StateChange dll node is still not called. &lt;/P&gt;&lt;P&gt;Do you have any other ideas on what could be going wrong? I am not completely sure if it is relevent, but the dll node still has the color red.&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Patrick&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 07:59:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559378#M62213</guid>
      <dc:creator>patrick_zweekhorst</dc:creator>
      <dc:date>2017-10-12T07:59:36Z</dc:date>
    </item>
    <item>
      <title>Re: OnStateChange node under behaviour/eventfunctions as flexscript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559379#M62214</link>
      <description>&lt;P&gt;The DLL node remains red until something calls it, then it connects and turns black.&lt;/P&gt;&lt;P&gt;Try defining your onStateChange() cppfunction in your module dll instead of in the tree.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 13:49:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559379#M62214</guid>
      <dc:creator>philboboADSK</dc:creator>
      <dc:date>2017-10-12T13:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: OnStateChange node under behaviour/eventfunctions as flexscript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559380#M62215</link>
      <description>&lt;P&gt;Hi &lt;A href="https://answers.flexsim.com/questions/44202/onstatechange-node-under-behavioureventfunctions-a.html?childToView=44304#"&gt;@phil.bobo&lt;/A&gt; &lt;/P&gt;&lt;P&gt;How would I define the onStateChange in the module dll? The onStateChange function of the BasicTE is not virtual, so I can not override that function in cpp.&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;U&gt;&lt;/U&gt;&lt;SUB&gt;&lt;/SUB&gt;&lt;SUP&gt;&lt;/SUP&gt;&lt;DEL&gt;&lt;/DEL&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2017 07:04:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559380#M62215</guid>
      <dc:creator>patrick_zweekhorst</dc:creator>
      <dc:date>2017-10-16T07:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: OnStateChange node under behaviour/eventfunctions as flexscript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559381#M62216</link>
      <description>&lt;P&gt;o(TALUMIS_CRANES::TalumisCrane,c) is getting a TalumisCrane* reference.&lt;/P&gt;&lt;P&gt;Can you not just add a method to your TalumisCrane class and call it?&lt;/P&gt;&lt;P&gt;If you get a syntax error trying to call it from a C++ node in the tree, toggle your OnStateChange attribute as DLL and put that code into your DLL. Then call it from the DLL.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2017 14:18:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559381#M62216</guid>
      <dc:creator>philboboADSK</dc:creator>
      <dc:date>2017-10-16T14:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: OnStateChange node under behaviour/eventfunctions as flexscript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559382#M62217</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://answers.flexsim.com/users/206/phil.b.html" nodeid="206"&gt;@phil.bobo&lt;/A&gt; &lt;/P&gt;&lt;P&gt;Do you mean that I would need to change the name of my function? Instead of OnStateChange choose another name? &lt;/P&gt;&lt;P&gt;Or do you mean that I would need to make a free function in cpp?&lt;/P&gt;&lt;P&gt;I can toggle the OnStateChange attribute as dll and call a function in the dll. That is more or less what I started with. That would mean that there is nothing under cppfunctions for the TalumisCrane&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2017 14:37:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559382#M62217</guid>
      <dc:creator>patrick_zweekhorst</dc:creator>
      <dc:date>2017-10-16T14:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: OnStateChange node under behaviour/eventfunctions as flexscript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559383#M62218</link>
      <description>&lt;P&gt;cppfunctions is how you add methods to a class defined in the library tree. If you are using a module, your class is defined in your module. Just add a method to it. Yes, that means there is nothing under cppfunctions for the TalumisCrane.&lt;/P&gt;&lt;P&gt;You don't need to rename the OnStateChange attribute. Just change it from being toggled as C++ to being toggled as DLL, and call the method on your class from that function in your DLL.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2017 14:43:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/onstatechange-node-under-behaviour-eventfunctions-as-flexscript/m-p/13559383#M62218</guid>
      <dc:creator>philboboADSK</dc:creator>
      <dc:date>2017-10-16T14:43:49Z</dc:date>
    </item>
  </channel>
</rss>

