Lua chatbox
-
Lakan Haraya
- Metropolitan
- Reactions:
- Posts: 131
- Joined: 28 Mar 2019, 07:34
- Location: Philippines
- Plugins: Showcase Store
- Version: Beta
-
Plugin Creator
Platform
Re: Lua chatbox
I would like to tap the building and then GUI will appear, how can I do that?
"ᜀᜃᜓ ᜀᜅ᜔ ᜁᜌᜓᜅ᜔ ᜑᜇᜌ"
CEO of Haráya Motors
“TheoTown Philippines Council”
“Kapulungan Ng Mga Nagkakaisang Lungsod”
CEO of Haráya Motors
“TheoTown Philippines Council”
“Kapulungan Ng Mga Nagkakaisang Lungsod”
-
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
Here's my script from my plugin for exampleLakan Haraya wrote: 16 Feb 2021, 06:53 I would like to tap the building and then GUI will appear, how can I do that?
Code: Select all Reset
local function BankMainUI() local dialog = GUI.createDialog{ icon = Icon.MONEY, title = 'Theonia Regional Bank', width = 350, height = 230, pause = true } local function addLine(label, height) local line = dialog.content:addLayout{height = height - 5} line:addLabel{text = label, w = 0} return line:addLayout{ x = 0} end local theme = dialog.content:addCanvas{ y = 35,onDraw=function(self,x,y,w,h) Drawing.setAlpha(1) Drawing.setColor(83,133,70) Drawing.drawNinePatch(NinePatch.PANEL,x,y,w,h) Drawing.reset() end} local layout stateUI = 'A' selection(dialog,stateUI,theme,layout) local button1 = addLine("",0) local function addSelectionButton(text, state,frame) button1:addButton{ icon = frame, w = -330, h = 30, frameDefault = NinePatch.TUTORIAL_UNMARK, frameDown = NinePatch.TUTORIAL_MARK, text = text, onClick = function(self)stateUI = state past2 = stateUI end, isPressed = function() return stateUI == state end } end addSelectionButton('Deposit','A',Icon.LOAD_PAYBACK) addSelectionButton('Withdraw', 'B',Icon.LOAN_TAKE) addSelectionButton('Loan', 'C',Icon.LOAN) addSelectionButton('Active Loan', 'AC',Icon.LOAN) addSelectionButton(nil,'info',Icon.HELP) end function script:click(x,y,level) local cv = Tile.isBuildingInConstruction(x,y) if not cv and not City.isSandbox() then BankMainUI() return false end end
Lua editor
-
ian`
- Metropolitan
- Reactions:
- Posts: 117
- Joined: 04 Apr 2020, 15:36
- Location: 日本
- Plugins: Showcase Store
- Version: Beta
-
Plugin Creator
Platform
Re: Lua chatbox
Code: Select all Reset
function script:click(x,y) if Tile.isBuildingWorking(x,y) then -- check the building is not in construction and not empty, has power, water, and road connection if needed. yourGUI() -- GUI function return false -- prevent the default dialog appears end end
Lua editor
-
erksmit
- Villager
- Reactions:
- Posts: 24
- Joined: 02 Mar 2018, 10:39
- Plugins: Showcase Store
- Version: Beta
-
Plugin Creator
Re: Lua chatbox
for the plugin im trying to make i need to notify a script in another draft when the user is done doing something, is this possible?
-
Bearbear76
- Inhabitant of a Multiverse
- Reactions:
- Posts: 5701
- Joined: 10 Feb 2017, 12:53
- Location: L2 cache
- Plugins: Showcase Store
-
Plugin Creator
Platform
Re: Lua chatbox
I think using fun variables for simple numbers are good and for more complex stuff use storage.erksmit wrote: 20 Feb 2021, 18:46 for the plugin im trying to make i need to notify a script in another draft when the user is done doing something, is this possible?
Just my opinion
retired
retired
-
erksmit
- Villager
- Reactions:
- Posts: 24
- Joined: 02 Mar 2018, 10:39
- Plugins: Showcase Store
- Version: Beta
-
Plugin Creator
Re: Lua chatbox
yeah i can pass the variables just fine, but i need to notify script 1 that script 2 is done doing stuff, while i can probably just look at a bools state every frame im wondering if theres something cleaner i can useBearbear76 wrote: 21 Feb 2021, 03:53I think using fun variables for simple numbers are good and for more complex stuff use storage.erksmit wrote: 20 Feb 2021, 18:46 for the plugin im trying to make i need to notify a script in another draft when the user is done doing something, is this possible?
-
ian`
- Metropolitan
- Reactions:
- Posts: 117
- Joined: 04 Apr 2020, 15:36
- Location: 日本
- Plugins: Showcase Store
- Version: Beta
-
Plugin Creator
Platform
Re: Lua chatbox
why are there so many functions not works correctly now?
buildBuilding can't build RCI buildings, also isBuildingBuildable always returns false when checking RCI buildings.
Draft:isPlugin() can't work properly, but if not Draft:isPlugin() it works fine.
City.createDraftDrawer(d): isSelectable() gets an error on certain drafts.
buildBuilding can't build RCI buildings, also isBuildingBuildable always returns false when checking RCI buildings.
Draft:isPlugin() can't work properly, but if not Draft:isPlugin() it works fine.
City.createDraftDrawer(d): isSelectable() gets an error on certain drafts.
-
CommanderABab
- AB
- Reactions:
- Posts: 11270
- Joined: 07 Jun 2016, 19:12
- Plugins: Showcase Store
- Version: Beta
-
Plugin Creator
Platform
Re: Lua chatbox
buildBuilding can't build RCI buildings,
Probably unzoned or incorrect level zone.
Probably unzoned or incorrect level zone.
my avatar:
-
ian`
- Metropolitan
- Reactions:
- Posts: 117
- Joined: 04 Apr 2020, 15:36
- Location: 日本
- Plugins: Showcase Store
- Version: Beta
-
Plugin Creator
Platform
Re: Lua chatbox
i have tried it last year and the RCI buildings can be built but without the zoning, and a few months ago it can only be built in zones and those that already have buildings.
EDIT -------
Also Tile.getGroundDraft is not return the draft of the ground. when I use lua wrapper, it says 'LuaRepr'.
EDIT -------
Also Tile.getGroundDraft is not return the draft of the ground. when I use lua wrapper, it says 'LuaRepr'.
-
KINGTUT10101
- 1,000,000 inhabitants
- Reactions:
- Posts: 2211
- Joined: 07 Jul 2016, 20:50
- Location: 'Merica
- Plugins: Showcase Store
- Version: Beta
-
Plugin Creator
Platform
Re: Lua chatbox
I couldn't get buildBuilding() to work with RCI either.
All of my plug-ins, maps and more:
https://sites.google.com/view/retrocity ... authuser=0
YouTube channel:
https://youtube.com/c/kingtut-101
https://sites.google.com/view/retrocity ... authuser=0
YouTube channel:
https://youtube.com/c/kingtut-101
Re: Lua chatbox
Can we use EVENT_CAR_REACHED for a specified car draft or does it takes the information of all cars target reaches?
And also City.spawncar(...) I tried using it but it didnt really did the work. Cars were spawning like how they are in the JSON code and not like the lua. I want them to only spawn in a time cycle (script.nextMonth)
And also City.spawncar(...) I tried using it but it didnt really did the work. Cars were spawning like how they are in the JSON code and not like the lua. I want them to only spawn in a time cycle (script.nextMonth)
Re: Lua chatbox
With a little hope to have an answer I also want to talk about notifications. I have made some notifications they are pop-uping at the times when I want but there is one problem I dont really know to fix...yusuf8a684 wrote: 01 Jun 2021, 15:16 Can we use EVENT_CAR_REACHED for a specified car draft or does it takes the information of all cars target reaches?
And also City.spawncar(...) I tried using it but it didnt really did the work. Cars were spawning like how they are in the JSON code and not like the lua. I want them to only spawn in a time cycle (script.nextMonth)
I have put those notifications in script:nextMonth, yeah they pop up once it becomes next month but then they continue to pop up everyday. I want them to pop up once every month. How can I fix this (because this is annoying to close notifications every TT day)
Re: Lua chatbox
Is it possible to automatically rebuild a building that has reached level TTT in Lua to level T?
Re: Lua chatbox
local x,y
function script:init()
local building = Draft.getDraft('$prm_com02_01')
end
function script:daily (x, y, level)
local count = City.countBuildings(building)
for i, count do
x,y = City.getBuilding(i, building)
Builder.remove(x, y)
end
end
Is this a valid lua?
function script:init()
local building = Draft.getDraft('$prm_com02_01')
end
function script:daily (x, y, level)
local count = City.countBuildings(building)
for i, count do
x,y = City.getBuilding(i, building)
Builder.remove(x, y)
end
end
Is this a valid lua?
-
Hadestia
- Inhabitant of a Megalopolis
- Reactions:
- Posts: 722
- Joined: 17 Jul 2017, 14:16
- Location: Philippines
- Plugins: Showcase Store
-
Plugin Creator
Platform
-
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
Can i know how can i include explosion animation when removing buildings using "Builder.remove(x,y)"?
-
Lobby
- Inhabitant of a Supercluster
- Reactions:
- Posts: 3761
- Joined: 26 Oct 2008, 10:34
- Plugins: Showcase Store
Re: Lua chatbox
You don't. The explosion animation when removing a building is drawn by the removal tool itself so it cannot be drawn if the tool is not active.
-
CERRERA
- Townsman
- Reactions:
- Posts: 48
- Joined: 25 Jan 2020, 04:19
- Location: Philippines
- Plugins: Showcase Store
- Version: Beta
-
Plugin Creator
Platform
Re: Lua chatbox
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
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
You do not have the required permissions to view the files attached to this post.
Everything you can imagine is real
-
kyoshimine1
- Townsman
- Reactions:
- Posts: 50
- Joined: 02 Oct 2020, 22:11
- Location: Japan
- Plugins: Showcase Store
-
Plugin Creator
Platform
Re: Lua chatbox
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
Would it be possible to do something like that using Lua?
Let's say, if I wanted the property
"conductive":trueTurn 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?
自分の街のプラグインを作るのが好きなんです・・・
また、ドット絵を描くのも好き!

また、ドット絵を描くのも好き!
-
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
Do this methodkyoshimine1 wrote: 22 Mar 2022, 15: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":trueTurn 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?
If it toast the value you put from its json probably you can change it dynamically