Lua chatbox

The Lua scripting language allows you to give your plugin more advanced features.
Previous topicNext topic
User avatar
erksmit
Villager
Reactions:
Posts: 24
Joined: 02 Mar 2018, 10:39
Plugins: Showcase Store
Version: Beta

Plugin Creator

Re: Lua chatbox

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: 722
Joined: 17 Jul 2017, 14:16
Location: Philippines
Plugins: Showcase Store

Plugin Creator

Platform

Re: Lua chatbox

Post by Hadestia »

erksmit wrote: 16 Aug 2022, 10: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
 ! Message from: Hadestia
Visit my YouTube channel:
https://youtube.com/channel/UC5qG-r8y21036JZbGRClbdQ
User avatar
ian`
Metropolitan
Reactions:
Posts: 117
Joined: 04 Apr 2020, 15:36
Location: 日本
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Lua chatbox

Post by ian` »

i realized the onDraw argument now ignores parent padding. is it a bug or a fix? :bt
:bc
User avatar
JustAnyone
Honorary Contributor
Reactions:
Posts: 3666
Joined: 23 Jul 2017, 10:45
Location: Easter Island
Plugins: Showcase Store

Platform

Re: Lua chatbox

Post by JustAnyone »

That is the intended change as of 1.10.73
User avatar
erksmit
Villager
Reactions:
Posts: 24
Joined: 02 Mar 2018, 10:39
Plugins: Showcase Store
Version: Beta

Plugin Creator

Re: Lua chatbox

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`
Metropolitan
Reactions:
Posts: 117
Joined: 04 Apr 2020, 15:36
Location: 日本
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Lua chatbox

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.
:bc
F
Frodo01
Settler
Reactions:
Posts: 5
Joined: 13 Sep 2020, 19:25

Re: Lua chatbox

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
Metropolitan
Reactions:
Posts: 148
Joined: 11 Jan 2024, 07:47

Plugin Creator

Platform

Re: Lua chatbox

Post by Armin Hpj »

CERRERA wrote: 06 Dec 2021, 13: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
e
emma87921
Settler
Reactions:
Posts: 1
Joined: 19 May 2025, 08:49

Re: Lua chatbox

Post by emma87921 »

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!
C
COMBRO
Settler
Reactions:
Posts: 5
Joined: 05 Oct 2025, 02:31

Re: Lua chatbox

Post by COMBRO »

hello, may I ask? I want to know how the railway crossing plugin works, why can the crossing bars open and close automatically when a train approaches? Please answer 🙏
User avatar
yinx
Small-town resident
Reactions:
Posts: 32
Joined: 11 May 2026, 01:58
Location: Ha Noi
Plugins: Showcase Store

Plugin Creator

Platform

Re: Lua chatbox

Post by yinx »

COMBRO wrote: 04 Mar 2026, 09:38 hello, may I ask? I want to know how the railway crossing plugin works, why can the crossing bars open and close automatically when a train approaches? Please answer 🙏
It's simple: just use the countcarroad function. Essentially, railway tracks also have the 'road' attribute and trains have the 'car' attribute, so this function works. You just need to monitor the cell where the vehicle count increases—that means a train has arrived. At that point, simply switch the frame status from open to closed :fire
Previous topicNext topic