Lua chatbox

The Lua scripting language allows you to give your plugin more advanced features.

Moderator: Plugin Moderators

User avatar
CERRERA
Townsman
Reactions:
Posts: 48
Joined: 25 Jan 2020, 06:19
Location: Philippines
Plugins: Showcase Store
Version: Beta
Contact:

Plugin Creator

Platform

Re: Lua chatbox

#181

Post by CERRERA »

20211206_232418.jpg
20211206_232418.jpg (62.41 KiB) Viewed 26610 times
Anyone can help me?

If u press building or category you will go into link

Example I press the help category you will go to yt

Sorry Idk how lua works

User avatar
kyoshimine1
Townsman
Reactions:
Posts: 50
Joined: 03 Oct 2020, 00:11
Location: Japan
Plugins: Showcase Store

Plugin Creator

Platform

Re: Lua chatbox

#182

Post by kyoshimine1 »

I have a question. I was creating a new plugin and it occurred to me that I could use Lua to do something....

Let's say, if I wanted the property
"conductive":true
Turn false, but only after a certain time since I entered the city, for example 5 minutes.
Would it be possible to do something like that using Lua?

User avatar
Hadestia
Inhabitant of a Megalopolis
Reactions:
Posts: 727
Joined: 17 Jul 2017, 16:16
Location: Philippines
Plugins: Showcase Store
Contact:

Plugin Creator

Platform

Re: Lua chatbox

#183

Post by Hadestia »

kyoshimine1 wrote:
22 Mar 2022, 17:51
I have a question. I was creating a new plugin and it occurred to me that I could use Lua to do something....

Let's say, if I wanted the property
"conductive":true
Turn false, but only after a certain time since I entered the city, for example 5 minutes.
Would it be possible to do something like that using Lua?
Do this method

Code: Select all    Reset

Debug.toast(Draft.orig.conductive)
Lua editor
Run
If it toast the value you put from its json probably you can change it dynamically

User avatar
erksmit
Villager
Reactions:
Posts: 24
Joined: 02 Mar 2018, 12:39
Plugins: Showcase Store
Version: Beta

Plugin Creator

Re: Lua chatbox

#184

Post by erksmit »

What happens with a lua script when i enter online mode? Im trying to make a script compatible with it, its got multiplayer: false in its manifest.

User avatar
Hadestia
Inhabitant of a Megalopolis
Reactions:
Posts: 727
Joined: 17 Jul 2017, 16:16
Location: Philippines
Plugins: Showcase Store
Contact:

Plugin Creator

Platform

Re: Lua chatbox

#185

Post by Hadestia »

erksmit wrote:
16 Aug 2022, 12:07
What happens with a lua script when i enter online mode? Im trying to make a script compatible with it, its got multiplayer: false in its manifest.
It will still work but locally

User avatar
ian`
Supporter
Reactions:
Posts: 119
Joined: 04 Apr 2020, 17:36
Location: 日本
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Lua chatbox

#186

Post by ian` »

i realized the onDraw argument now ignores parent padding. is it a bug or a fix? :bt

User avatar
JustAnyone
Honorary Contributor
Reactions:
Posts: 3688
Joined: 23 Jul 2017, 12:45
Location: Easter Island
Plugins: Showcase Store

Platform

Re: Lua chatbox

#187

Post by JustAnyone »

That is the intended change as of 1.10.73

User avatar
erksmit
Villager
Reactions:
Posts: 24
Joined: 02 Mar 2018, 12:39
Plugins: Showcase Store
Version: Beta

Plugin Creator

Re: Lua chatbox

#188

Post by erksmit »

With the addition of the Car module i had the idea of dynamically spawning cars with diffrent tails depending on what they carry (what they carry is decided within). Now i wanted to also dynamically set the animation of the car to show a certain resource on its cargo bed, but i noticed there are no functions to set a car's animation. Would it still be possible to do this?

User avatar
ian`
Supporter
Reactions:
Posts: 119
Joined: 04 Apr 2020, 17:36
Location: 日本
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Lua chatbox

#189

Post by ian` »

also the method to change the car despawn time when the car speed is zero. AFAIK, the default car despawn time is 10 days in normal speed.

User avatar
Frodo01
Settler
Reactions:
Posts: 5
Joined: 13 Sep 2020, 21:25

Re: Lua chatbox

#190

Post by Frodo01 »

I don't understand what is wrong with this script. Nothing happens when the police car is at the coordinates of the road decoration.

function script.update()
-- Debug.toast("starting code!")
local car = Draft.getDraft('$carpolice00')
local carX = car.getX()
local carY = car.getY()
if Builder.isRoadDecoBuildable('$undead_horde_plugin_00', carX, carY) then
Builder.removeRoadDeco(carX, carY)
Debug.toast("destroy undead!")
end
end

User avatar
Armin Hpj
Small-town resident
Reactions:
Posts: 35
Joined: 11 Jan 2024, 09:47

Plugin Creator

Platform

Re: Lua chatbox

#191

Post by Armin Hpj »

CERRERA wrote:
06 Dec 2021, 15:28
20211206_232418.jpgAnyone can help me?

If u press building or category you will go into link

Example I press the help category you will go to yt

Sorry Idk how lua works
Write lua script For Tutorial

User avatar
emma87921
Settler
Reactions:
Posts: 1
Joined: 19 May 2025, 10:49

Re: Lua chatbox

#192

Post by emma87921 »

Appreciate the detailed explanation on City.earnMoney() and the use of privileged scripts. The clarification on using nil for optional parameters and the distinction between . and : in Lua syntax were especially useful.

Looking forward to more insights like this—thanks again!

User avatar
Bhacraft
Settler
Reactions:
Posts: 2
Joined: 14 Jan 2026, 16:29

Re: Lua chatbox

#193

Post by Bhacraft »

Cara membuat lua untuk menambah penghasilan bulanan di sebuah bangunan

User avatar
Bhacraft
Settler
Reactions:
Posts: 2
Joined: 14 Jan 2026, 16:29

Re: Lua chatbox

#194

Post by Bhacraft »

Ada yg punya contoh script lua yg ada pendapat bulanan pada sebuah bangunan dengan tipe file zip

User avatar
PBbunnypower
Inhabitant of a Megacity
Reactions:
Posts: 277
Joined: 26 Aug 2022, 11:49
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Lua chatbox

#195

Post by PBbunnypower »

Not possible. Monthly income attribute can only be used by trusted plugin creators, which you are not.

Post Reply Previous topicNext topic

Return to “Lua Scripting”