Action Index

Any information about the fun attribute is given here.

Moderator: Plugin Moderators

User avatar
Lobby
Developer
Reactions:
Posts: 3127
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: 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, level,inner


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).
Show
animation pause
Pauses the animation slot "level" (0 by default). Additionally sets the frame to "frame" if specified.
Show
animation resume
Resumes the animation slot "level" (0 by default). Additionally sets the frame to "frame" if specified.
Last edited by FranchuFranchu on Thu Aug 30, 2018 0:15, edited 1 time in total.
Reason: Added rect
...Have a nice stay

User avatar
Lobby
Developer
Reactions:
Posts: 3127
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 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: 1764
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 » Fri Nov 17, 2017 17:30

Is illness going to be functional?

User avatar
Lobby
Developer
Reactions:
Posts: 3127
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 Nov 17, 2017 17:34

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

User avatar
JustAnyone
Feature manager
Reactions:
Posts: 2296
Joined: Sun Jul 23, 2017 12:45
Location: Pickle Jar
Plugins: Show
Version: Beta
Phone model: Picklephone XP 5

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

User avatar
JustAnyone
Feature manager
Reactions:
Posts: 2296
Joined: Sun Jul 23, 2017 12:45
Location: Pickle Jar
Plugins: Show
Version: Beta
Phone model: Picklephone XP 5

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.

User avatar
Lobby
Developer
Reactions:
Posts: 3127
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 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: 6372
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!
517517Currently using beta 517. 517 What's new? :)
Lua!
:)

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

User avatar
CommanderABab
Inhabitant of a Multiverse
Reactions:
Posts: 6372
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.
517517Currently using beta 517. 517 What's new? :)
Lua!
:)

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

User avatar
Lobby
Developer
Reactions:
Posts: 3127
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: 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 1509 times
Will be fixed :bf
...Have a nice stay

User avatar
Mg3094066
Inhabitant of a Galaxy Cluster
Reactions:
Posts: 2775
Joined: Sun May 28, 2017 1:50
Location: United Mexican States
Plugins: Show
Version: Beta
Phone model: LG H320mb 5.0.1

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?
Trop. storm ~~Rosa~~Sergio it's touching ground... Please gimme update 927 D:"
:fire :space :fire

User avatar
JustAnyone
Feature manager
Reactions:
Posts: 2296
Joined: Sun Jul 23, 2017 12:45
Location: Pickle Jar
Plugins: Show
Version: Beta
Phone model: Picklephone XP 5

Re: Fun condition and action index

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

Creates white screen, shakes it, builds scrap and crater.

User avatar
Mg3094066
Inhabitant of a Galaxy Cluster
Reactions:
Posts: 2775
Joined: Sun May 28, 2017 1:50
Location: United Mexican States
Plugins: Show
Version: Beta
Phone model: LG H320mb 5.0.1

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
Trop. storm ~~Rosa~~Sergio it's touching ground... Please gimme update 927 D:"
:fire :space :fire

User avatar
Lobby
Developer
Reactions:
Posts: 3127
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 1:58

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

@former member 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

User avatar
cesareborgia94
Inhabitant of a Country
Reactions:
Posts: 985
Joined: Sun Nov 12, 2017 9:23
Location: The Kingdom of Babilandia
Plugins: Show
Version: Beta
Phone model: Samsung Galaxy 360H

Re: Fun condition and action index

Post by cesareborgia94 » Wed Jul 04, 2018 19:09

Lobby wrote:
Fri Nov 17, 2017 17:29
New with the next version: disaster action :teach
Lobby, it may be too late for this question but what does the disaster action do?
Also in the action index, can you specify, explain in-depth what does toasts do?
Thank you for your time.
I rarely make plugins now, but I still make them in spare time.
Disclaimer Please no request, I'm busy with real life stuff, I hope you understand ;)
You can find me here only. Discord is sh**, sorry JA :(

User avatar
Kulche
Inhabitant of a Country
Reactions:
Posts: 761
Joined: Wed Jun 07, 2017 20:28
Location: In front of my new computer
Plugins: Show
Version: Beta
Phone model: I use tablet!

Re: Action Index

Post by Kulche » Wed Jul 04, 2018 19:16

For disaster action, it summons chosen disaster (earthquake, meteor, nukes, etc.) at random or specified location.

Code: Select all

"fun":[
{
"actions":[
{
"type":"disaster",  //Makes fun disastrous
"id":"nuke",  //Shoots nuke at x and y   \/ look down there\/
"x":10,
"y":-10  //Specifies location
}
]
}
]
❤wut❤

nope

Not-so active because of school


...Oh boi...

User avatar
cesareborgia94
Inhabitant of a Country
Reactions:
Posts: 985
Joined: Sun Nov 12, 2017 9:23
Location: The Kingdom of Babilandia
Plugins: Show
Version: Beta
Phone model: Samsung Galaxy 360H

Re: Action Index

Post by cesareborgia94 » Wed Jul 04, 2018 19:20

Kulche wrote:
Wed Jul 04, 2018 19:16
For disaster action, it summons chosen disaster (earthquake, meteor, nukes, etc.) at random or specified location.

Code: Select all

"fun":[
{
"actions":[
{
"type":"disaster",  //Makes fun disastrous
"id":"nuke",  //Shoots nuke at x and y   \/ look down there\/
"x":10,
"y":-10  //Specifies location
}
]
}
]
Does it apply to crime as well?
Sorry for asking the repeated questions, jusy need some confirmation.
Also, if you did not specify location, it would happen at a random place, yes?
I rarely make plugins now, but I still make them in spare time.
Disclaimer Please no request, I'm busy with real life stuff, I hope you understand ;)
You can find me here only. Discord is sh**, sorry JA :(

User avatar
Kulche
Inhabitant of a Country
Reactions:
Posts: 761
Joined: Wed Jun 07, 2017 20:28
Location: In front of my new computer
Plugins: Show
Version: Beta
Phone model: I use tablet!

Re: Action Index

Post by Kulche » Wed Jul 04, 2018 19:25

Propably yes, cuz Lobby wrote it upper.

Idk, try it.
❤wut❤

nope

Not-so active because of school


...Oh boi...

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

Re: Action Index

Post by Lobby » Wed Jul 04, 2018 19:35

Yes, it works also for crime :bc

Toasts are especially useful for debugging. It's basically a text that is shown for a short amount of time and can be used to provide some information. See here for more details: https://developer.android.com/guide/top ... ers/toasts

Usage is quite simple:

Code: Select all

"actions":[{"type":"toast","id":"Hi, I am some text!"}]
If you want to print the value of a variable $myvar on the screen you can use string interpolation:

Code: Select all

"actions":[{"type":"toast","id":"The value of the variable is ${$myvar}"}]
The content of ${*} will be evaluated at runtime and can therefore be used to show the value of variables.
...Have a nice stay

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

Re: Action Index

Post by CommanderABab » Wed Jul 04, 2018 19:45

Show
quote
Lobby wrote:
Wed Jul 04, 2018 19:35
Yes, it works also for crime :bc

Toasts are especially useful for debugging. It's basically a text that is shown for a short amount of time and can be used to provide some information. See here for more details: https://developer.android.com/guide/top ... ers/toasts

Usage is quite simple:

Code: Select all

"actions":[{"type":"toast","id":"Hi, I am some text!"}]
If you want to print the value of a variable $myvar on the screen you can use string interpolation:

Code: Select all

"actions":[{"type":"toast","id":"The value of the variable is ${$myvar}"}]
The content of ${*} will be evaluated at runtime and can therefore be used to show the value of variables.
#stringinterpolation,
#runtimeevaluation
517517Currently using beta 517. 517 What's new? :)
Lua!
:)

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

User avatar
cesareborgia94
Inhabitant of a Country
Reactions:
Posts: 985
Joined: Sun Nov 12, 2017 9:23
Location: The Kingdom of Babilandia
Plugins: Show
Version: Beta
Phone model: Samsung Galaxy 360H

Re: Action Index

Post by cesareborgia94 » Wed Jul 04, 2018 20:14

Thank you all for explaining :)
I rarely make plugins now, but I still make them in spare time.
Disclaimer Please no request, I'm busy with real life stuff, I hope you understand ;)
You can find me here only. Discord is sh**, sorry JA :(

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

Re: Action Index

Post by ElephantEthan » Tue Sep 04, 2018 19:58

Any way to make a building place water?

Code: Select all

"actions":[{"type":"build","id":"$water00","x":1}]
Doesn't build anything.
Perhaps the smartest elephant here. :calc
I ain't playing TheoTown a lot, but when I do, I am in my city
Euife

User avatar
FranchuFranchu
Inhabitant of a Megalopolis
Reactions:
Posts: 720
Joined: Sun May 28, 2017 0:07
Location: Patch of air
Plugins: Show
Version: Beta

Re: Action Index

Post by FranchuFranchu » Tue Sep 04, 2018 23:41

ElephantEthan wrote:
Tue Sep 04, 2018 19:58
Any way to make a building place water?

Code: Select all

"actions":[{"type":"build","id":"$water00","x":1}]
Doesn't build anything.
Also related: Any way to remove and place terrain?
President of the Socialist Republic of Neda

...

User avatar
Kulche
Inhabitant of a Country
Reactions:
Posts: 761
Joined: Wed Jun 07, 2017 20:28
Location: In front of my new computer
Plugins: Show
Version: Beta
Phone model: I use tablet!

Re: Action Index

Post by Kulche » Sat Sep 15, 2018 11:57

Road info in build action seems bit outdated. How can I build roads at specific rotation? Also tunnels, bridges and ramps?
❤wut❤

nope

Not-so active because of school


...Oh boi...

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

Re: Action Index

Post by CommanderABab » Sat Sep 15, 2018 16:06

Road frames update automatically with map rotation.
517517Currently using beta 517. 517 What's new? :)
Lua!
:)

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