Page 1 of 1

Rect condition and action: working with rectangles

Posted: 29 Aug 2018, 23:50
by CommanderABab
Show
Introduced in 473:
πŸ› Line action
πŸ› Rect condition and action
πŸ› Fix palm trees and cacti had auto build set to true
Within a function:
Show
condition

Code: Select all

{"type":"rect","w":10,"h":4,"min":1,"max":9999,"inner":[{...}]}
checks if the inner condition occurs β‰₯ min times and ≀ max times.
Show
action
similar, it executes the inner actions for each of the specified tiles:

Code: Select all

"actions":[{"type":"rect","w":4,"h":3,"inner":[{...},...]}]
Show
example action

Removing a 4x4 tile area and zoning it dense industrial:

Code: Select all

  "actions":
    [
      {"type":"rect","w":4,"h":4,"inner":
        [
          {"type":"remove"},
          {"type":"build","id":"$zoneindustrial_lvl2"}
        ]
      }
    ]
Does it work? Does it need more?
Try it and see.
Credits: Lobby

Re: Rect condition and action: working with rectangles

Posted: 30 Aug 2018, 00:11
by FranchuFranchu
That was really necessary for interchange generators

Re: Rect condition and action: working with rectangles

Posted: 30 Aug 2018, 06:17
by ElephantEthan
Thank you posting this here, I found a discussion about actions and conditions in a certain radiuses and I was about to ask for that to be moved here. :)

Re: Rect condition and action: working with rectangles

Posted: 30 Aug 2018, 06:46
by Mg3094066
Umm... This may be related with reaction...
Can I program a building to react with a disaster?
Idk a sound...?

Re: Rect condition and action: working with rectangles

Posted: 22 Dec 2018, 07:28
by KINGTUT10101
Shouldnt this be in the "fun attribute" section?

Re: Rect condition and action: working with rectangles

Posted: 05 Feb 2019, 19:11
by Lobby
True :)

Re: Rect condition and action: working with rectangles

Posted: 09 Feb 2019, 15:13
by Imran M
Wait, so it make 4x4 rectangle, inner means the space inside it, actions are what it will do inside it? Is this a correct way of putting it?

Re: Rect condition and action: working with rectangles

Posted: 09 Feb 2019, 16:47
by CommanderABab
Yes.

Re: Rect condition and action: working with rectangles

Posted: 04 Sep 2023, 08:17
by CERRERA
Lobby wrote: ↑
05 Feb 2019, 19:11
True :)

Hello
Reac
Can make Fun conditions can <..> separated fun attribute?

For example

Code: Select all Β Β  Reset

{Hi im fun template Action πŸ‘‰} {Hi im seperate fun 1 condition if πŸ‘‰βœ… my result 🌝} {Hi im seperate fun 2 condition if πŸ‘‰βœ… my result 🌚}
JSON checker
Check
Or

Code: Select all Β Β  Reset

{Hi im fun template i remove building if βœ…} {Hi im separate fun 1 if building was remove i build 🌝} {Hi im separate fun 2 if building was remove i build 🌚}
JSON checker
Check
If any of these 2 are possible how can i do that?