Condition Index

Any information about the fun attribute is given here.

Moderator: Plugin Moderators

User avatar
Lobby
Developer
Reactions:
Posts: 3150
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Condition Index

Post by Lobby » Thu Oct 05, 2017 10:52

A generic condition looks like:
Show
condition name
Description
To check for such a condition you would use the code

Code: Select all

"condition":{"type":"condition name",...},
Possible additional attribute for conditions are:
id, x, y, z, min, max, frame, level, inner, invert, code


Show
building
Checks for a building. If id and/or frame is provided they will checked on that building. The result is true iff there's a building that meets the given id/frame.
Show
buildable
Checks if the building given by ID is buildable by user at given x/y.
Show
building nearby
A description will follow.
Show
wire
Is true if a wire with given ID is built at given x/y. If the ID is not defined, game will check for any building with wire type.
Show
road
A description will follow.
Show
pipe
Checks whether there's a pipe (if provided: of the given id) at x, y.
Show
tree
Checks whether there's a tree (if provided: of the given id) at x, y.
Show
and
Is only true if all inner conditions are true (or if there are no inner conditions).
Show
or
Is true if at least one inner condition is true.
Show
true
Is always true. If you don't provide any condition this one will be the default one
Show
false
Is always false.
Show
count
Counts the number of true inner conditions. The number x is hen checked against min + z <= x <= max + z.
Show
nearby
Applies the inner condition (only one) on all 8 neighboring tiles. The number of fulfilled ones x is then checked against min + z <= x <= max + z.
Show
frame
Checks whether the frame of the building at x, y fulfilled min + z <= frame <= max + z.
Show
land
Checks whether the tile at x, y is land (if specified: of the given id).
Show
water
Checks whether the tile at x, y is water (if specified: of the given id).
Show
road usage
Evaluates the road usage at the current position and checks whether it's in the provided range. Values range from 0 to 100.
Show
zone
Checks whether the zone - given by id - is set at the current position.
Show
building count
Counts how often the building - given by id - is built in the current city.
Show
value
Checks whether the value of an evaluated code is in a certain range. The string provided in "code" is evaluated to a value. The condition is true iff

Code: Select all

min + z <= code <= max + z
is fullfilled. Default values for min, max and z are 0. So you usually only provide min and max or z. If you only provide z the condition basically is

Code: Select all

z = code
Example:

Code: Select all

"condition":{"type":"value","code":"day/360"}
This condition is only fullfilled if date is within first year.

See viewtopic.php?f=81&t=5736 and viewtopic.php?f=81&t=5959 for more information.
Show
burning
Returns true if the building at the current position is buring.
Show
upgrade
Checks whether the upgrade - given by id - is applied to the building at the current position.
Show
date
Is true if the current game day is the given number. Possible values are "z":0-359. min and max can be used to specify a range. See here for more information.
Show
sandbox
Is true if the current city is in sandbox mode.
Show
ground
Checks whether there's ground of the given id at the current position.
Show
map size
A description will follow.
Show
animation running
True if animation of the building's animation slot specified by attribute level is running, false otherwhise.
Show
performance
Evaluates the performance of the building at position x, y and check it against =z or >=min and <=max. Values range from 0 to 100.
Show
rnd
Can be used to make random numbers

Code: Select all

"condition":{
  // A number in [0,9] is generated and checked to be >= min and <= max
  "type":"rnd","min":0,"max":3,"frame":10
}
Last edited by FranchuFranchu on Mon Aug 06, 2018 22:36, edited 1 time in total.
...Have a nice stay

User avatar
JustAnyone
Feature manager
Reactions:
Posts: 2407
Joined: Sun Jul 23, 2017 12:45
Location: Pickle command center
Plugins: Show
Version: Beta
Phone model: Picklephone S5

Re: Fun condition and action index

Post by JustAnyone » Sun Dec 03, 2017 9:58

Like always my ideas are too complicated for TheoTown to implement it, but if condition "buiilding" is true, could it unhide categories/buildings set by default hidden?

User avatar
CommanderABab
Inhabitant of a Multiverse
Reactions:
Posts: 6669
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: Fun condition and action index

Post by CommanderABab » Sun Dec 03, 2017 10:14

I really don't think so, as that would be self-modifying code, a very dangerous practice.
547547Currently using alpha 547. 547 What's new? :)
settings.json!
:)

Telegram - t.me/
๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธCommander๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ

User avatar
CommanderABab
Inhabitant of a Multiverse
Reactions:
Posts: 6669
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: Fun condition and action index

Post by CommanderABab » Sun Jan 07, 2018 17:02

Yes. On built fun, on event fun, on click fun, random fun, fun: all can be there.
547547Currently using alpha 547. 547 What's new? :)
settings.json!
:)

Telegram - t.me/
๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธCommander๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ

User avatar
CommanderABab
Inhabitant of a Multiverse
Reactions:
Posts: 6669
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: Fun condition and action index

Post by CommanderABab » Sun Jan 07, 2018 17:11

547547Currently using alpha 547. 547 What's new? :)
settings.json!
:)

Telegram - t.me/
๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธCommander๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ

User avatar
CommanderABab
Inhabitant of a Multiverse
Reactions:
Posts: 6669
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: Fun condition and action index

Post by CommanderABab » Sun Jan 07, 2018 17:19

547547Currently using alpha 547. 547 What's new? :)
settings.json!
:)

Telegram - t.me/
๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธCommander๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ

User avatar
JustAnyone
Feature manager
Reactions:
Posts: 2407
Joined: Sun Jul 23, 2017 12:45
Location: Pickle command center
Plugins: Show
Version: Beta
Phone model: Picklephone S5

Re: Fun condition and action index

Post by JustAnyone » Sun Jan 07, 2018 22:20

I won't even bother with :json . Probably dusko will make it in few seconds with his amazing keyboard.

User avatar
KINGTUT10101
1,000,000 inhabitants
Reactions:
Posts: 1801
Joined: Thu Jul 07, 2016 22:50
Location: 'Merica
Plugins: Show
Version: Beta
Phone model: Moto Z Force Droid

Re: Fun condition and action index

Post by KINGTUT10101 » Sat Jan 13, 2018 0:33

How does building nearby work?

User avatar
Lobby
Developer
Reactions:
Posts: 3150
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Re: Fun condition and action index

Post by Lobby » Sat Jan 13, 2018 16:02

@KoalaGuy they should be supported, have you tried it?

@KINGTUT10101 it counts how many buildings of the specified id are on one of the 8 neighboring tiles. It then checks whether this number is >=min and <=max. I added this functionality for the Game of Life example, but you can do the same with the nearby condition (which is more general).
...Have a nice stay

User avatar
Lobby
Developer
Reactions:
Posts: 3150
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Re: Fun condition and action index

Post by Lobby » Fri Jan 26, 2018 23:20

It should work as expected: If there's road, it returns true. If you provide an id, it checks whether the road there also have this specific id. If you provide "lvl", it will check whether there's road at that specific level (0=ground, 1=air).

"x" and "y" move the context and aren't specifically connected to the check itself. So, if you set "x":1 and there's road at (1,0), it should return true.
...Have a nice stay

User avatar
Lobby
Developer
Reactions:
Posts: 3150
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Re: Fun condition and action index

Post by Lobby » Fri Jan 26, 2018 23:51

I just tested it and you're right, road detection doesn't work. Reason was this line:
fun_road_bug.png
:fire
...Have a nice stay

User avatar
Lobby
Developer
Reactions:
Posts: 3150
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Re: Fun condition and action index

Post by Lobby » Sat Jan 27, 2018 10:54

@former member You might use "road usage" for that purpose. It returns average usage of a road in percent. It will go >0 if there's a car.
...Have a nice stay

User avatar
CommanderABab
Inhabitant of a Multiverse
Reactions:
Posts: 6669
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: Fun condition and action index

Post by CommanderABab » Sat Jan 27, 2018 19:08

You could check the frame of a rotation aware id.
547547Currently using alpha 547. 547 What's new? :)
settings.json!
:)

Telegram - t.me/
๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธCommander๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ

User avatar
Lobby
Developer
Reactions:
Posts: 3150
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Re: Fun condition and action index

Post by Lobby » Sat Jan 27, 2018 19:33

No, but in the next update the virtual variable "cityRotation" will be capable of doing that.
...Have a nice stay

User avatar
Lobby
Developer
Reactions:
Posts: 3150
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Re: Fun condition and action index

Post by Lobby » Sun Jan 28, 2018 22:30

The variable is called "roadAutoJoin" and is ready to use 8-)
...Have a nice stay

User avatar
Lobby
Developer
Reactions:
Posts: 3150
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Re: Fun condition and action index

Post by Lobby » Wed Jan 31, 2018 18:53

Code: Select all

{"type":"value","code":"cityRotation","z":0} // Will only be true in default rotation
Values of cityRotation are 0, 1, 2, 3. 0 is default rotation, 1 is rotated by 90 degrees clockwise etc.
...Have a nice stay

User avatar
Lobby
Developer
Reactions:
Posts: 3150
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Re: Fun condition and action index

Post by Lobby » Wed Jan 31, 2018 18:56

Fixed.
...Have a nice stay

User avatar
KINGTUT10101
1,000,000 inhabitants
Reactions:
Posts: 1801
Joined: Thu Jul 07, 2016 22:50
Location: 'Merica
Plugins: Show
Version: Beta
Phone model: Moto Z Force Droid

Re: Condition Index

Post by KINGTUT10101 » Wed Aug 29, 2018 2:50

Is it possible to detect what wheather is going on in a city?

User avatar
ElephantEthan
Inhabitant of a Megacity
Reactions:
Posts: 299
Joined: Sun Aug 26, 2018 14:07
Plugins: Show

Re: Condition Index

Post by ElephantEthan » Wed Aug 29, 2018 9:01

KINGTUT10101 wrote: โ†‘
Wed Aug 29, 2018 2:50
Is it possible to detect what wheather is going on in a city?
You can use the "value" condition to check virtual variables for weather.

Variables


Virtual Variables


Weather manipulation
Last edited by CommanderABab on Wed Aug 29, 2018 11:11, edited 1 time in total.
Reason: Added buttons with some info about link topics

User avatar
CommanderABab
Inhabitant of a Multiverse
Reactions:
Posts: 6669
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: Condition Index

Post by CommanderABab » Wed Aug 29, 2018 11:11

ElephantEthan wrote: โ†‘
Wed Aug 29, 2018 9:01
KINGTUT10101 wrote: โ†‘
Wed Aug 29, 2018 2:50
Is it possible to detect what wheather is going on in a city?
You can use the "value" condition to check virtual variables for weather.

Variables


Virtual Variables


Weather manipulation
Thanks for the research! :)
547547Currently using alpha 547. 547 What's new? :)
settings.json!
:)

Telegram - t.me/
๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธCommander๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ

Post Reply Previous topicNext topic

Return to โ€œFun attributeโ€

Who is online

Users browsing this forum: No registered users and 1 guest

๏ปฟ