Date dependent fun condition

Any information about the fun attribute is given here.

Moderator: Plugin Moderators

User avatar
Lobby
Developer
Posts: 3713
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Date dependent fun condition

#1

Post by Lobby »

Since 369 there's a condition for fun to check for a specific date/range.

To do so, use condition type:"date" and define a range using min and max (or z if you want a specific day instead of a range of days). For example, z:0 would mean the 1st day of each year (0 <-> 1 because of how we count in computer science). Here's a sample code that triggers a notification:

Code: Select all

[
  {
    "id":"$notify_test01","type":"notification","text":"I AM SO <..>","frames":[{"steal":"$anim_people_source01","frame":0}]
  },
  
  {
    "id":"$invisible building","type":"decoration","hidden":true,"width":1,"height":1,"frames":[null],
    "random fun":[
      {
        "condition": {
          "type": "date",
          "z": 7  // 8th day of the year
        },
        "actions": [
          {
            "type": "notify",
            "id": "$notify_test01"
          }
        ]
      }
    ]
  }
]
In case you want the condition to be true each week for example just use frame:7. By default frame has a value of 12*30=a year.

User avatar
CommanderABab
AB
Posts: 11185
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Date dependent fun condition (369)

#2

Post by CommanderABab »

Blue animals be gone! :)

May

Code: Select all

"p":1
still be used in the actions?

User avatar
Lobby
Developer
Posts: 3713
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: Date dependent fun condition (369)

#3

Post by Lobby »

Yes, they work independently :bc

User avatar
Josh
Graphic designer
Posts: 2214
Joined: 11 Mar 2017, 19:20
Location: The Netherlands
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Date dependent fun condition (369)

#4

Post by Josh »

Great!

User avatar
Josh
Graphic designer
Posts: 2214
Joined: 11 Mar 2017, 19:20
Location: The Netherlands
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Date dependent fun condition (369)

#5

Post by Josh »

Is it possible to have a code, when your map surpasses a certain amount of inhabitants a notification is given?

User avatar
CommanderABab
AB
Posts: 11185
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Date dependent fun condition (369)

#6

Post by CommanderABab »

Use

Code: Select all

"once":true
where you define the notification.

User avatar
CommanderABab
AB
Posts: 11185
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Date dependent fun condition (369)

#7

Post by CommanderABab »

To use a random notification from those you have defined:
Lobby wrote:
22 Oct 2017, 20:54
...

Code: Select all

[
  {
    "id":"$notify_test01","type":"notification","text":"I AM SO <..>","frames":[{"steal":"$anim_people_source01","frame":0}],
    "id":"$notify_test02",...""   ""
    ...
  },
  
  {
    "id":"$invisible building","type":"decoration","hidden":true,"width":1,"height":1,"frames":[null],
    "(random )fun":[
       {"actions": [
          {
            "type": "notify",
            "id": "$notify_test01"
          },
          "p":x
        },
      {"actions": [
          {
            "type": "notify",
            "id": "$notify_test02"
          },
          "p":x
        },
        ...
          
        ]
      }
    ]
  }
]
...
Where x = 1 ÷ (number of different notifications).

User avatar
CommanderABab
AB
Posts: 11185
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Date dependent fun condition (369)

#8

Post by CommanderABab »

Then add one more action that doesn't have a notification! :)

User avatar
Lobby
Developer
Posts: 3713
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: Date dependent fun condition (369)

#9

Post by Lobby »

How about this?

Code: Select all

[
  ...
  {
    "id":"$invisible building","type":"decoration","hidden":true,"width":1,"height":1,"frames":[null],
    "random fun":[
       {"actions": [
          {
            "type": "notify",
            "id": "$notify_test01"
          }
        ],  // Actions array is ending here
        "p":x  // Probability
      },
      {"actions": [  // Here begins a new transition
          {
            "type": "notify",
            "id": "$notify_test01"
          }
        ],
        "p":x
      },
      ...
    ]
  }
]
Note that "p" belongs into the transition object and not into the actions array.

User avatar
Lobby
Developer
Posts: 3713
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: Date dependent fun condition (369)

#10

Post by Lobby »

:bc

User avatar
22Alpha
Inhabitant of a Conurbation
Posts: 448
Joined: 23 Sep 2017, 14:29

Platform

Re: Date dependent fun condition

#11

Post by 22Alpha »

I think I've asked this before but maybe there is an update about it. Does this fun activation have duration coding now? I mean action would trigger within a duration of time like 3 days, 5 days.

User avatar
Lobby
Developer
Posts: 3713
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: Date dependent fun condition

#12

Post by Lobby »

Have you tried this? :json

Code: Select all

"condition": {
  "type": "date",
  "min": 0,
  "max": 2,   // Trigger at days 0, 1, 2
  "frame": 8  // Overall time frame of 3 + 5 = 8 days
},

User avatar
22Alpha
Inhabitant of a Conurbation
Posts: 448
Joined: 23 Sep 2017, 14:29

Platform

Re: Date dependent fun condition

#13

Post by 22Alpha »

Lobby wrote:
31 Jan 2018, 16:40
Have you tried this? :json

Code: Select all

"condition": {
  "type": "date",
  "min": 0,
  "max": 2,   // Trigger at days 0, 1, 2
  "frame": 8  // Overall time frame of 3 + 5 = 8 days
},
Not yet, but will try! That's something new :bc Thanks!

User avatar
22Alpha
Inhabitant of a Conurbation
Posts: 448
Joined: 23 Sep 2017, 14:29

Platform

Re: Date dependent fun condition

#14

Post by 22Alpha »

@Lobby , I think I phrased it wrong. It was supposed to be 3 or 5 days. Does the code would remain the same?

A specific example would be:

If I build building A, after 5 days building B will automatically be replaced.

User avatar
CommanderABab
AB
Posts: 11185
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Date dependent fun condition

#15

Post by CommanderABab »

Use

Code: Select all

"min":5,"max":7,
then.

User avatar
22Alpha
Inhabitant of a Conurbation
Posts: 448
Joined: 23 Sep 2017, 14:29

Platform

Re: Date dependent fun condition

#16

Post by 22Alpha »

Without the "frames": line anymore?

User avatar
CommanderABab
AB
Posts: 11185
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Date dependent fun condition

#17

Post by CommanderABab »

Yes with the frames line, I just showed what you want to change.

User avatar
22Alpha
Inhabitant of a Conurbation
Posts: 448
Joined: 23 Sep 2017, 14:29

Platform

Re: Date dependent fun condition

#18

Post by 22Alpha »

Looks like I'm one very confused guy. Maybe trying it into plugin would help me understand more. Thank you for all your help guys!

User avatar
Lobby
Developer
Posts: 3713
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: Date dependent fun condition

#19

Post by Lobby »

I'm not sure what you mean by 3 or 5 days. Can you make an explicit example?

User avatar
22Alpha
Inhabitant of a Conurbation
Posts: 448
Joined: 23 Sep 2017, 14:29

Platform

Re: Date dependent fun condition

#20

Post by 22Alpha »

Here:

If I build building A,

after 5 days,

building A will be removed, then building B will replace it.

Post Reply Previous topicNext topic

Return to “Fun attribute”