<?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: destroymessageevents command in FlexSim Forum</title>
    <link>https://forums.autodesk.com/t5/flexsim-forum/destroymessageevents-command/m-p/13529251#M38376</link>
    <description>&lt;P&gt;Yes, but it looks like it's supposed to be filtering out which events it destroys based off the message parameters.&lt;/P&gt;</description>
    <pubDate>Thu, 06 Feb 2020 20:54:40 GMT</pubDate>
    <dc:creator>Matthew_Gillespie</dc:creator>
    <dc:date>2020-02-06T20:54:40Z</dc:date>
    <item>
      <title>destroymessageevents command</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/destroymessageevents-command/m-p/13529247#M38372</link>
      <description>&lt;P&gt;&lt;I&gt;[ FlexSim 20.0.2 ]&lt;/I&gt;&lt;/P&gt;&lt;P&gt;Hi community,&lt;/P&gt;&lt;P&gt;today I run into an issue with destroymessageevents command.&lt;/P&gt;&lt;P&gt;The sequence to reproduce it is simple.&lt;/P&gt;&lt;P&gt;1. I created a delayed message with the code&lt;/P&gt;&lt;PRE&gt;Object s = Model.find("Source1);

s.message(10,s,100);&lt;/PRE&gt;&lt;P&gt;2. I executed the code to remove the message from the event list&lt;/P&gt;&lt;PRE&gt;Object s = Model.find("Source1");
destroymessageevents(s,0,s);
&lt;/PRE&gt;&lt;P&gt;After executing the script, nothing happens!&lt;/P&gt;&lt;P&gt;Can someone help me? I attached the model.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 16:26:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/destroymessageevents-command/m-p/13529247#M38372</guid>
      <dc:creator>amerloQ2XZU</dc:creator>
      <dc:date>2020-02-03T16:26:46Z</dc:date>
    </item>
    <item>
      <title>Re: destroymessageevents command</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/destroymessageevents-command/m-p/13529248#M38373</link>
      <description>&lt;P&gt;This is a bug. The message() method isn't setting the event code of the event it creates. Thanks for pointing it out. We'll have this fixed for the next bug fix release.&lt;/P&gt;&lt;P&gt;The senddelayedmessage() command works fine if you need a workaround.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2020 20:41:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/destroymessageevents-command/m-p/13529248#M38373</guid>
      <dc:creator>Matthew_Gillespie</dc:creator>
      <dc:date>2020-02-05T20:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: destroymessageevents command</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/destroymessageevents-command/m-p/13529249#M38374</link>
      <description>&lt;P&gt;I tried your solution, but it works partially.&lt;/P&gt;&lt;P&gt;If I don't use the any filter it works, but when I add some message parameter doesn't destroy the message. Could you check my attached model? Thanks!&lt;/P&gt;&lt;P&gt;&lt;A id="25485" href="https://answers.flexsim.com/storage/temp/25485-destroymessageevents-workaround.fsm"&gt;destroymessageevents-workaround.fsm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 09:15:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/destroymessageevents-command/m-p/13529249#M38374</guid>
      <dc:creator>amerloQ2XZU</dc:creator>
      <dc:date>2020-02-06T09:15:48Z</dc:date>
    </item>
    <item>
      <title>Re: destroymessageevents command</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/destroymessageevents-command/m-p/13529250#M38375</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://answers.flexsim.com/users/840/alessio.m.html" nodeid="840"&gt;@Alessio Merlo&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;Just leave out the message parameter and it destroys all of the messages:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="25507-destroy-message-help.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1501213i58D1CA181BEA4CF2/image-size/large?v=v2&amp;amp;px=999" role="button" title="25507-destroy-message-help.png" alt="25507-destroy-message-help.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;A id="25508" href="https://answers.flexsim.com/storage/temp/25508-25485-destroymessageevents-workaround-1.fsm"&gt;25485-destroymessageevents-workaround-1.fsm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 18:37:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/destroymessageevents-command/m-p/13529250#M38375</guid>
      <dc:creator>tanner_p</dc:creator>
      <dc:date>2020-02-06T18:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: destroymessageevents command</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/destroymessageevents-command/m-p/13529251#M38376</link>
      <description>&lt;P&gt;Yes, but it looks like it's supposed to be filtering out which events it destroys based off the message parameters.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 20:54:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/destroymessageevents-command/m-p/13529251#M38376</guid>
      <dc:creator>Matthew_Gillespie</dc:creator>
      <dc:date>2020-02-06T20:54:40Z</dc:date>
    </item>
    <item>
      <title>Re: destroymessageevents command</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/destroymessageevents-command/m-p/13529252#M38377</link>
      <description>&lt;P&gt;I'm not sure why that's not working, I'll look into it some more.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 20:55:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/destroymessageevents-command/m-p/13529252#M38377</guid>
      <dc:creator>Matthew_Gillespie</dc:creator>
      <dc:date>2020-02-06T20:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: destroymessageevents command</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/destroymessageevents-command/m-p/13529253#M38378</link>
      <description>&lt;P&gt;I need to filter on message parameter, then if you fix the issue in the next release is perfect! Thanks for your support!&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 08:15:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/destroymessageevents-command/m-p/13529253#M38378</guid>
      <dc:creator>amerloQ2XZU</dc:creator>
      <dc:date>2020-02-07T08:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: destroymessageevents command</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/destroymessageevents-command/m-p/13529254#M38379</link>
      <description>&lt;P&gt;I looked into this and it looks like the way we create message events has changed a lot since the destroymessageevents() command was added. I'll add a case to the dev list, but this won't be an easy fix like the previous fix.&lt;/P&gt;&lt;P&gt;However, you can use some of the other event commands to loop over the events in the event list and destroy the ones you're looking for. For example:&lt;/P&gt;&lt;PRE&gt;Object s = Model.find("Source1");
Variant p1 = 100;

int numEvents = maintree().find("project/exec/events").subnodes.length;
for (int i = numEvents; i &amp;gt;= 1; i--) {
	if (eventget(i, 3) == EVENT_SENDMESSAGE &amp;amp;&amp;amp; eventget(i, 1) == s &amp;amp;&amp;amp; eventget(i, 5) == s) {		
		treenode eventNode = eventget(i,6);
		if (getsdtvalue(eventNode, "p1") == p1)
			destroyevent(eventNode);
	}
}&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Feb 2020 20:02:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/destroymessageevents-command/m-p/13529254#M38379</guid>
      <dc:creator>Matthew_Gillespie</dc:creator>
      <dc:date>2020-02-07T20:02:37Z</dc:date>
    </item>
  </channel>
</rss>

