I tried to come up with a meaningful example to demonstrate it's capabilities. The result is a Game of Life implementation whose functionality is fully expressed via it's plugin code. The cells switch it's state if you click on them.
Here's how it looks like: And here's also a YouTube Video🎞 showing it in action.
The confuse you here's the code

Code: Select all
// This is a plugin for TheoTown
// Visit www.theotown.com to learn more about TheoTown plugins
//
// Written by Lobby Divinus to demonstrate new fun functionality
[
{
"id":"$cat_gol",
"type":"category",
"title":"Game of Life",
"frames":[{"bmp":"icon.png"}]
},
{
"id":"$gol_dead",
"type":"decoration",
"category":"$cat_gol",
"title":"Dead cell",
"text":".",
"width":1,
"height":1,
"frames":[{"bmp":"gol.png","w":32,"h":16}],
"frame alignment area":true,
"fun":[
{
"condition":{"type":"nearby","z":3,"inner":[{"type":"building","id":"$gol_alive"}]},
"actions":[
{"type":"remove"},
{"type":"build","id":"$gol_alive"}
]
}
],
"on click fun":[
{
"actions":[
{"type":"remove"},
{"type":"build","id":"$gol_alive"}
]
}
]
},
{
"id":"$gol_alive",
"type":"decoration",
"category":"$cat_gol",
"title":"Alive cell",
"text":".",
"width":1,
"height":1,
"frames":[{"bmp":"gol.png","x":32,"w":32,"h":16}],
"frame alignment area":true,
"fun":[
{
"condition":{"type":"nearby","min":2,"max":3,"invert":true,"inner":[
{"type":"building","id":"$gol_alive"}
]},
"actions":[
{"type":"remove"},
{"type":"build","id":"$gol_dead"}
]
}
],
"on click fun":[
{
"actions":[
{"type":"remove"},
{"type":"build","id":"$gol_dead"}
]
}
]
}
]