<?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: Conditional Rule File - Unexpected Token in ArcGIS CityEngine Questions</title>
    <link>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rule-file-unexpected-token/m-p/124092#M1663</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For conditional rules, you don't actually need to make sure that the else statement is reachable. &amp;nbsp;The Colour rule with two case statements checking if Special is "N" or "Y" and an else statement is valid code and will run correctly. &amp;nbsp;Since the range of the attribute Special is limited to either "Y" or "N", then the else statement will not be reached, but it is still grammatically correct code, and it will run as expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are compile errors because of errors in the format of the conditional and stochastic (percentage) statements. &amp;nbsp;In a conditional construction, there can be any number of case statements followed by an else statement, but the else statement must be there (with operations specified). &amp;nbsp;Similarly, a stochastic construction must also end with an else statement. &amp;nbsp;Also, the percentages in a stochastic construction must be &amp;lt;=100, and the else statement will get the remainder percentage to make the whole thing sum to 100. &amp;nbsp;Here are the help pages:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://cehelp.esri.com/help/topic/com.procedural.cityengine.help/html/manual/cga/writing_rules/cga_wr_conditional_rule.html?resultof=%22%63%6f%6e%64%69%74%69%6f%6e%61%6c%22%20%22%63%6f%6e%64%69%74%22%20" title="http://cehelp.esri.com/help/topic/com.procedural.cityengine.help/html/manual/cga/writing_rules/cga_wr_conditional_rule.html?resultof=%22%63%6f%6e%64%69%74%69%6f%6e%61%6c%22%20%22%63%6f%6e%64%69%74%22%20"&gt;Conditional Rule&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://cehelp.esri.com/help/topic/com.procedural.cityengine.help/html/manual/cga/writing_rules/cga_wr_stochastic_rule.html?resultof=%22%70%65%72%63%65%6e%74%61%67%65%22%20%22%70%65%72%63%65%6e%74%61%67%22%20" title="http://cehelp.esri.com/help/topic/com.procedural.cityengine.help/html/manual/cga/writing_rules/cga_wr_stochastic_rule.html?resultof=%22%70%65%72%63%65%6e%74%61%67%65%22%20%22%70%65%72%63%65%6e%74%61%67%22%20"&gt;Stochastic Rule&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your code on line 23, there is an else statement, which is probably intended to go with the case statements on lines 18 and 19, but the compiler thinks it belongs to the percentage statements on lines 20-22. &amp;nbsp;Whatever follows this else statement is interpreted as the code that should be executed if this else statement were to be reached. &amp;nbsp;Basically,&amp;nbsp;to make the code work, an else statement for the stochastic construction on lines 20-22 is missing, and the else statement on line 23 is missing some operations after it (and similar for line 28). &amp;nbsp;In general, if no operations are desired, you could write "NIL". &amp;nbsp;Or, as Felix points out, you can structure your statements so that one case statement is for when area &amp;lt; 50, and the else statement takes care of the situations when area &amp;gt;= 50. &amp;nbsp;I wrote this so that you could hopefully understand what's going on with the conditional and stochastic constructions, but you can certainly use Felix's code to solve your problem. &amp;nbsp;However, note that you'll also want to make sure you account for the case where Height==12 by using the &amp;lt;= or &amp;gt;= signs in your conditions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 03 Apr 2017 09:50:34 GMT</pubDate>
    <dc:creator>CherylLau</dc:creator>
    <dc:date>2017-04-03T09:50:34Z</dc:date>
    <item>
      <title>Conditional Rule File - Unexpected Token</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rule-file-unexpected-token/m-p/124090#M1661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Still very much a learner at using CityEngine (and this forum), so I'm hoping this is a dead easy rookie mistake you guys can help with...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have building layouts I've imported from ArcMap, I have worked my way up to the point of trying to create a conditional rule to apply a roof type based on the height and area of the building (which is already included within the attributes), and a colour based on whether the building is "Special" (for want of a better term) or not, which i will change myself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My current rule file is as follows:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;## Attributes ##

attr Height = 0
attr Area = 0

@Range("Y", "N")
attr Special = "N"

## Rules ## 

@StartRule
Building --&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;extrude(Height)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;comp(f){side :&amp;nbsp; Colour | top : RoofType }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
RoofType--&amp;gt; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case Height &amp;lt; 12 :
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case Area &amp;lt; 50 : roofGable(22.5) Colour
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case Area &amp;gt; 50 :
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;50% : roofHip(20) Colour
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;25% : roofShed(10) Colour
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;25% : roofShed(0) Colour
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case Height &amp;gt; 12 &amp;amp;&amp;amp; Height &amp;lt; 25 : 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;50% : roofHip(20) Colour
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;25% : roofGable(22.5) Colour
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;25% : roofShed(0) Colour
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case Height &amp;gt; 25 : roofshed(0) Colour
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else: Colour

Colour--&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case Special == "N" : color("#c7d3de") 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case Special == "Y" : color("#00338d") 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else: color("#c7d3de") ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Long story short,&amp;nbsp;its not working. My last line of code " &lt;EM&gt;else: color("#c7d3de")&lt;/EM&gt; " claims there is an unexpected token, and I think this is where it&amp;nbsp;is going wrong... I have tried fixing it with a terminator e.g. "End.", amongst other things, but I think I'm missing something...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help anyone can offer would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gavin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:06:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rule-file-unexpected-token/m-p/124090#M1661</guid>
      <dc:creator>GThomson</dc:creator>
      <dc:date>2021-12-11T07:06:49Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Rule File - Unexpected Token</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rule-file-unexpected-token/m-p/124091#M1662</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It should go something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;attr Height = 0&lt;BR /&gt;attr Area = 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@Range("Y", "N")&lt;BR /&gt;attr Special = "N"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;## Rules ##&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@StartRule&lt;BR /&gt;Building --&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; extrude(Height)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; comp(f){side :&amp;nbsp; Colour | top : RoofType }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;RoofType--&amp;gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case Height &amp;lt; 12 :&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case Area &amp;lt; 50 : &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;roofGable(22.5) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Colour&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else :&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 50% : &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;roofHip(20) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Colour&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 25% : &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;roofShed(10) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Colour&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else : &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;roofShed(0) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Colour&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case Height &amp;gt; 12 &amp;amp;&amp;amp; Height &amp;lt; 25 : &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 50% : &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;roofHip(20) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Colour&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 25% : &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;roofGable(22.5) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Colour&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else :&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;roofShed(0) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Colour&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else : &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;roofShed(0) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Colour&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Colour--&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case Special == "N" : &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;color("#c7d3de") &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else : &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;color("#00338d")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The mistake is when applying a conditional rule, you must leave the "else" statement for one of the values in the range; in the case of your Colour rule, you have a range of "yes" and "no" but you include an "else" for which there's no parameter, same with your % in the roof rule, 50% + 25% + 25% = 100%, so there's no room for another option&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 Apr 2017 18:28:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rule-file-unexpected-token/m-p/124091#M1662</guid>
      <dc:creator>F_RContreras</dc:creator>
      <dc:date>2017-04-01T18:28:54Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Rule File - Unexpected Token</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rule-file-unexpected-token/m-p/124092#M1663</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For conditional rules, you don't actually need to make sure that the else statement is reachable. &amp;nbsp;The Colour rule with two case statements checking if Special is "N" or "Y" and an else statement is valid code and will run correctly. &amp;nbsp;Since the range of the attribute Special is limited to either "Y" or "N", then the else statement will not be reached, but it is still grammatically correct code, and it will run as expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are compile errors because of errors in the format of the conditional and stochastic (percentage) statements. &amp;nbsp;In a conditional construction, there can be any number of case statements followed by an else statement, but the else statement must be there (with operations specified). &amp;nbsp;Similarly, a stochastic construction must also end with an else statement. &amp;nbsp;Also, the percentages in a stochastic construction must be &amp;lt;=100, and the else statement will get the remainder percentage to make the whole thing sum to 100. &amp;nbsp;Here are the help pages:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://cehelp.esri.com/help/topic/com.procedural.cityengine.help/html/manual/cga/writing_rules/cga_wr_conditional_rule.html?resultof=%22%63%6f%6e%64%69%74%69%6f%6e%61%6c%22%20%22%63%6f%6e%64%69%74%22%20" title="http://cehelp.esri.com/help/topic/com.procedural.cityengine.help/html/manual/cga/writing_rules/cga_wr_conditional_rule.html?resultof=%22%63%6f%6e%64%69%74%69%6f%6e%61%6c%22%20%22%63%6f%6e%64%69%74%22%20"&gt;Conditional Rule&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://cehelp.esri.com/help/topic/com.procedural.cityengine.help/html/manual/cga/writing_rules/cga_wr_stochastic_rule.html?resultof=%22%70%65%72%63%65%6e%74%61%67%65%22%20%22%70%65%72%63%65%6e%74%61%67%22%20" title="http://cehelp.esri.com/help/topic/com.procedural.cityengine.help/html/manual/cga/writing_rules/cga_wr_stochastic_rule.html?resultof=%22%70%65%72%63%65%6e%74%61%67%65%22%20%22%70%65%72%63%65%6e%74%61%67%22%20"&gt;Stochastic Rule&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your code on line 23, there is an else statement, which is probably intended to go with the case statements on lines 18 and 19, but the compiler thinks it belongs to the percentage statements on lines 20-22. &amp;nbsp;Whatever follows this else statement is interpreted as the code that should be executed if this else statement were to be reached. &amp;nbsp;Basically,&amp;nbsp;to make the code work, an else statement for the stochastic construction on lines 20-22 is missing, and the else statement on line 23 is missing some operations after it (and similar for line 28). &amp;nbsp;In general, if no operations are desired, you could write "NIL". &amp;nbsp;Or, as Felix points out, you can structure your statements so that one case statement is for when area &amp;lt; 50, and the else statement takes care of the situations when area &amp;gt;= 50. &amp;nbsp;I wrote this so that you could hopefully understand what's going on with the conditional and stochastic constructions, but you can certainly use Felix's code to solve your problem. &amp;nbsp;However, note that you'll also want to make sure you account for the case where Height==12 by using the &amp;lt;= or &amp;gt;= signs in your conditions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Apr 2017 09:50:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rule-file-unexpected-token/m-p/124092#M1663</guid>
      <dc:creator>CherylLau</dc:creator>
      <dc:date>2017-04-03T09:50:34Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Rule File - Unexpected Token</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rule-file-unexpected-token/m-p/124093#M1664</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah excellent! Thank you, such a simple fix for something that had me completely confused for hours...&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Many thanks for the help and explanation.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Apr 2017 10:34:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rule-file-unexpected-token/m-p/124093#M1664</guid>
      <dc:creator>GThomson</dc:creator>
      <dc:date>2017-04-03T10:34:21Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Rule File - Unexpected Token</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rule-file-unexpected-token/m-p/124094#M1665</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's been a great help in giving me a bit of a stronger understanding! Still trying to get my head round it, but this clears up a lot of the issues I had when I was trying to construct these types of rule.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Apr 2017 10:40:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rule-file-unexpected-token/m-p/124094#M1665</guid>
      <dc:creator>GThomson</dc:creator>
      <dc:date>2017-04-03T10:40:16Z</dc:date>
    </item>
  </channel>
</rss>

