I'm trying to color some land shapes according to their description (the attribute is called descriptiv), i'm really new to city engine and can't understand what it's wrong, but it keeps giving me an unespected token error. The code I'm using is
attr descriptiv = ""
@startrule
Colour-->
color(descriptiv)=
case descriptiv == "building" :color(#8c5111) #in this line I keep having "unespected token: case" and "unespected token: ="
case descriptiv == "general surface" :color(#2adbb2)
case descriptiv == "glasshouse" :color(#bae8e6)
case descriptiv == "Inland water" :color(#6ff1fc)
case descriptiv == "Inland water" :color(#6ff1fc)
case descriptiv == "landform" :color(#809c95)
case descriptiv == "natural environment" :color(#2c9171)
case descriptiv == "path" :color(#dec381)
case descriptiv == "rail" :color(#4a4948)
case descriptiv == "road or track" :color(#808080)
case descriptiv == "Roadside" :color(#adadad)
case descriptiv == "structure" :color(#ebebeb)
else :color(#ffffff)
First, remove line 11. You can't define functions inside a rule (e.g. Colour --> ...this is the inside part of the rule that I mean), and you don't need to have a function here. (Alternatively, though, you could specify a function that returns a hexadecimal string for the color, and then the rule would call the function inside color).
Second, the color operation takes in a string for a hexadecimal color, so you need to put the string inside quotation marks:
color("#ffffff")
Third, the start rule annotation should have some capital letters: @StartRule