[ANSWERED] How to code using fun?

Learn here how to create and use plugins.

Moderator: Plugin Moderators

User avatar
TheFennekin
Neighborhood fox
Reactions:
Posts: 2728
Joined: 24 Aug 2017, 11:17
Location: Wandering around
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

[ANSWERED] How to code using fun?

#1

Post by TheFennekin »

So I wanted to do a plugin that when you touch it, it will change into another building/object. Also, if you upgrade the said building, the clicking fun function would be gone. How do I code it?

Idk how fun attribute works... I'm a bit confused :lol:
Last edited by TheFennekin on 25 Mar 2022, 02:32, edited 1 time in total.

User avatar
TheFennekin
Neighborhood fox
Reactions:
Posts: 2728
Joined: 24 Aug 2017, 11:17
Location: Wandering around
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: How to code using fun?

#2

Post by TheFennekin »

Addition, let's say I only wanted to make the click function to be used only when it's night. Is that possible?

User avatar
LightBlue
TheoTown Veteran in Pension
Reactions:
Posts: 946
Joined: 13 Feb 2022, 12:34
Location: Earth
Plugins: Showcase Store
Version: Beta
Contact:

Platform

Re: How to code using fun?

#3

Post by LightBlue »

Idk...

User avatar
TheFennekin
Neighborhood fox
Reactions:
Posts: 2728
Joined: 24 Aug 2017, 11:17
Location: Wandering around
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: How to code using fun?

#4

Post by TheFennekin »


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

Platform

Re: How to code using fun?

#5

Post by Lobby »

Hi, fun is not able to detect state of the day. For that you are encouraged to use Lua.

However, the other things can be done using fun and would probably look like that:

Code: Select all    Reset

[ { // ... "on click fun":[ { "condition":{"type":"upgrade","id":"id of the upgrade","invert":true}, "actions":[ {"type":"remove"}, {"type":"build","id":"id of another building"} ] } ] } ]
JSON checker
Check

User avatar
TheFennekin
Neighborhood fox
Reactions:
Posts: 2728
Joined: 24 Aug 2017, 11:17
Location: Wandering around
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: How to code using fun?

#6

Post by TheFennekin »

Oh I see, thank you so much Lobby!

Post Reply Previous topicNext topic

Return to “Tutorials and Documentation”