Action Index

Any information about the fun attribute is given here.

Moderator: FranchuFranchu

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

Action Index

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

A generic action looks like:
Show
action name
Description
To do some actions (iff the corresponding condition is true) you can use the code:

Code: Select all

"actions":[{"type":"action name",...},...],
Possible additional attribute for actions are:
id, x, y, z, x2, y2, frame, invert, ignore success


Show
build
Builds whatever is given as id. If provided, the given frame will be used. For roads z can be used to provide the level to build at (0 or 1).
Show
remove
Removes anything from the given position. Convenient to ensure that a building can be built.
Show
frame
Sets the frame of the building at x, y to the specified frame. The frame can also be specified using code.
Show
burn
Initiates a fire on the building at x, y. Be aware that not all buildings can burn.
Show
extinguish
Extinguishes the fire of the building at x, y.
Show
play
Plays the sound from the given id.
Show
notify
See here for more information.
Show
disaster
Issues a disaster at the given position. The disaster is specified using the "id" tag. Possible values are:
  • "fire"
  • "meteor"
  • "earthquake"
  • "nuke"
  • "tornado"
  • "nuclear plant"
  • "illness"
  • "flooding"
  • "riot"
  • "crime"
  • "ufo"
  • "generic building"
Set "frame":0 to let the disaster spawn at a random position. If the disaster wasn't issued successfully, further actions won't be executed. Set "ignore":true to change this behavior.
Show
toast
Shows an Android toast overlay with id as content.
Show
firework
Emits the firework specified by id at x, y.
Show
toast
Shows an Android toast overlay with id as content.
Show
set
Sets the value of the variable id to the value given in code. See here for more information about variables.
Show
performance
Applies the performance provided in code to of the building at x, y (values 0 - 100).
...Have a nice stay

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

Re: Fun condition and action index

Post by Lobby » Fri Nov 17, 2017 17:29

New with the next version: disaster action :teach
...Have a nice stay

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

Re: Fun condition and action index

Post by KINGTUT10101 » Fri Nov 17, 2017 17:30

Is illness going to be functional?

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

Re: Fun condition and action index

Post by Lobby » Fri Nov 17, 2017 17:34

No, it shouldn't do anything, yet.
...Have a nice stay

User avatar
JustAnyone
Feature manager
Reactions:
Posts: 1963
Joined: Sun Jul 23, 2017 12:45
Location: TheoTown command centre
Plugins: Show
Version: Beta
Phone: Xiaomi Redmi 3s

Re: Fun condition and action index

Post by JustAnyone » Fri Nov 17, 2017 17:45

Lobby wrote:
Fri Nov 17, 2017 17:34
...yet.
:bb
Founder and owner of DSA
TheoTown discord manager
Developer of Plugin Creator Application.

User avatar
JustAnyone
Feature manager
Reactions:
Posts: 1963
Joined: Sun Jul 23, 2017 12:45
Location: TheoTown command centre
Plugins: Show
Version: Beta
Phone: Xiaomi Redmi 3s

Re: Fun condition and action index

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

KoalaGuy wrote:
Sun Jan 07, 2018 11:51
@Lobby
It looks like the nuke disaster doesn't work with fun. Could you please have a look at it :bq
It does. At least for my disasterous presents.
Founder and owner of DSA
TheoTown discord manager
Developer of Plugin Creator Application.

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

Re: Fun condition and action index

Post by Lobby » Sun Jan 07, 2018 12:38

This code works for me :json

Code: Select all

"on click fun":[
  {
    "actions":[{"type":"disaster","id":"nuke"}]
  }
]
So how does your code look like?
Attachments
Screenshot_20180107-113737.png
...Have a nice stay

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

Re: Fun condition and action index

Post by CommanderABab » Sun Jan 07, 2018 12:46

It works for me. Set speed to max. Build a 6x6 road enclosure(max!), totally enclosed. Build the wandering blue animals inside! (They're nuclear enabled). Don't let any out! Set some on fire. Wait til the animation freezes. Wait a bit longer!
486486Currently using 486. 486 What's new? :)
Urban rails, search!
:)

Telegram - t.me/
🆎️🆎️🆎️🆎️Commander🆎️🆎️

Nexus24680
Inhabitant of a Megalopolis
Reactions:
Posts: 666
Joined: Sat May 06, 2017 19:12
Plugins: Show
Version: Beta

Re: Fun condition and action index

Post by Nexus24680 » Sun Jan 07, 2018 16:33

I have a question.
What code should I use if I (when using my Riot Plugin) want to start fires around the riot?
Maybe as a radius of x squares around?
Is it possible?
I've tried everything already, that's why I'm asking.

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

Re: Fun condition and action index

Post by CommanderABab » Sun Jan 07, 2018 16:56

Code: Select all

"on event fun":[
        {"actions":[{"type":"burn","x":0,"y":1}],"always":true,"ignore success":true},
        {"actions":[{"type":"burn","x":0,"y":-1}],"always":true,"ignore success":true},
        {"actions":[{"type":"burn","x":1,"y":0}],"always":true,"ignore success":true},
        {"actions":[{"type":"burn","x":-1,"y":0}],"always":true,"ignore success":true}                
      ],   
If you are spawning rioters on the roads from a 1x1 building..

Copy the actions and change the 1s to 2s etc for greater radius. You have to remember it might hit a big building. If the spawning building is bigger than 1x1, you have to add its width to the positive x and y values to avoid setting itself on fire.
486486Currently using 486. 486 What's new? :)
Urban rails, search!
:)

Telegram - t.me/
🆎️🆎️🆎️🆎️Commander🆎️🆎️

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

Re: Fun condition and action index

Post by Lobby » Mon Jan 08, 2018 18:12

Yes, that's the issue:
issue.png
issue.png (12.85 KiB) Viewed 761 times
Will be fixed :bf
...Have a nice stay

User avatar
Mg3094066
Inhabitant of a Galaxy
Reactions:
Posts: 2283
Joined: Sun May 28, 2017 1:50
Location: United Mexican States
Plugins: Show
Version: Beta
Phone: Element 6.0 WOO

Re: Fun condition and action index

Post by Mg3094066 » Sat Jan 27, 2018 8:05

Lobby wrote:
Fri Nov 17, 2017 17:34
No, it shouldn't do anything, yet.
I have a question
How the meteor explosion works?

User avatar
JustAnyone
Feature manager
Reactions:
Posts: 1963
Joined: Sun Jul 23, 2017 12:45
Location: TheoTown command centre
Plugins: Show
Version: Beta
Phone: Xiaomi Redmi 3s

Re: Fun condition and action index

Post by JustAnyone » Sat Jan 27, 2018 8:15

Creates white screen, shakes it, builds scrap and crater.
Founder and owner of DSA
TheoTown discord manager
Developer of Plugin Creator Application.

User avatar
Mg3094066
Inhabitant of a Galaxy
Reactions:
Posts: 2283
Joined: Sun May 28, 2017 1:50
Location: United Mexican States
Plugins: Show
Version: Beta
Phone: Element 6.0 WOO

Re: Fun condition and action index

Post by Mg3094066 » Sat Jan 27, 2018 8:18

JustAnyone wrote:
Sat Jan 27, 2018 8:15
Creates white screen, shakes it, builds scrap and crater.
In a json code, may be used for napalms because we can produce big fires

User avatar
Matison55557
Inhabitant of a Universe
Reactions:
Posts: 4705
Joined: Mon Jul 04, 2016 18:49
Location: Poland
Plugins: Show
Version: Beta
Phone: Huawei P9 lite mini

Re: Fun condition and action index

Post by Matison55557 » Mon Jan 29, 2018 21:50

Is it possible to make a building with fun that, when placed, changes all buildings of given id in the city to another building? I tried different things but with no success. Fun experts, help me.
Ghoughpteighbteau tchoghs.

Developing a text-based city builder for pc. :mine

Help. Ants all over me. 🐜

Nexus24680
Inhabitant of a Megalopolis
Reactions:
Posts: 666
Joined: Sat May 06, 2017 19:12
Plugins: Show
Version: Beta

Re: Fun condition and action index

Post by Nexus24680 » Tue Jan 30, 2018 21:46

Lobby
Can you add a "happiness" condition to fun?

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

Re: Fun condition and action index

Post by Lobby » Wed Jan 31, 2018 1:58

@Matison55557 I think you would have to do it the other way: The buildings that should change should do it in their own fun code.

@Nexus24680 I'm not sure why or how to add it. After all, the system isn't meant to be used that way.
...Have a nice stay

Post Reply

Return to “Fun attribute”

Who is online

Users browsing this forum: No registered users and 1 guest