<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to System State</title><link>https://sourceforge.net/p/itsbhtree/wiki/System%2520State/</link><description>Recent changes to System State</description><atom:link href="https://sourceforge.net/p/itsbhtree/wiki/System%20State/feed" rel="self"/><language>en</language><lastBuildDate>Sun, 29 Dec 2013 00:11:24 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/itsbhtree/wiki/System%20State/feed" rel="self" type="application/rss+xml"/><item><title>System State modified by Si Dunford</title><link>https://sourceforge.net/p/itsbhtree/wiki/System%2520State/</link><description>&lt;div class="markdown_content"&gt;&lt;h2 id="using-the-systemstate"&gt;Using the SystemState&lt;/h2&gt;
&lt;p&gt;The SystemState allows you to enable or disable whole sections of your behavior tree based on a simple bitvector.&lt;/p&gt;
&lt;p&gt;As an example, maybe you want certain behaviors to be valid only when it is raining. For this situation we might set the Systemstate to hex 00000001.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="s1"&gt;'# Using the helper function&lt;/span&gt;
&lt;span class="s1"&gt;SetSystemState( $00000001 )&lt;/span&gt;

&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="err"&gt;#&lt;/span&gt; &lt;span class="nx"&gt;Using&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;BHTree&lt;/span&gt; &lt;span class="nx"&gt;global&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;
&lt;span class="nx"&gt;BHTree&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;SystemState&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;$00000001&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In order to use this you need to manipulate the &lt;em&gt;match&lt;/em&gt; property of your objects (Which by default are set to $ffffffff).&lt;/p&gt;
&lt;p&gt;When both bitvectors match (Binary AND) then a trait is disabled.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;match&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="n"&gt;FFFFFFFE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SystemState&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="mo"&gt;0000000&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ENABLE&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;match&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="n"&gt;FFFFFFFE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SystemState&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="mo"&gt;0000001&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;DISABLE&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Binary AND is used to disable a traitwith the SystemState AND Match property &lt;br /&gt;
A Trait is disabled when the systemSystem property ANDnd the &lt;/p&gt;
&lt;p&gt;A Match Criteria can be defined within a &lt;a class="" href="../Tree%20definition"&gt;BHTreeBuilder&lt;/a&gt; file by including the Hex value in the Parameters, for example:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;Selector&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;Skidding&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="n"&gt;FFFFFFFE&lt;/span&gt;&lt;span class="p"&gt;}()&lt;/span&gt;
    &lt;span class="n"&gt;Drive&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;Movement&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Si Dunford</dc:creator><pubDate>Sun, 29 Dec 2013 00:11:24 -0000</pubDate><guid>https://sourceforge.net9b48bebbf6cc46255493ae0b20f8f17c1e5f4c55</guid></item></channel></rss>