Lua chatbox
Moderator: Plugin Moderators
- ian`
- Supporter
- Reactions:
- Posts: 100
- Joined: Sat Apr 04, 2020 17:36
- Location: Indonesien
- Plugins: Show
- Version: Beta
Re: Lua chatbox
i got the other fact. if you call the build mode from createDraftDrawer, the draft will be added to the history as a new even if the draft in there before, not replace the last one. @Lobby Sorry to mention you, could you fix this bug?

-
- Inhabitant of a Megacity
- Reactions:
- Posts: 152
- Joined: Thu Jan 30, 2020 16:56
- Plugins: Show
Re: Lua chatbox
Code: Select all Reset
GUI.addCanvas { w = 30, h = 30, onDraw = function(self, x, y, w, h, hoverX, hoverY) if hoverX ~= nil or hoverY ~= nil then Drawing.setColor(0, 0, 0) else Drawing.setColor(255, 255, 255) end Drawing.drawRect(x, y, w, h) end } --What do you think? Test this lua code on your PC ((not required but recommended) and reply with a screenshot or video)
Interactive Lua editor
- Lakan Haraya
- Metropolitan
- Reactions:
- Posts: 125
- Joined: Thu Mar 28, 2019 9:34
- Location: Philippines
- Plugins: Show
- Version: Beta
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”
Pinoy? Sali na
https://discord.gg/9n7PFy
CEO of Haráya Motors
“TheoTown Philippines Council”
“Kapulungan Ng Mga Nagkakaisang Lungsod”
Pinoy? Sali na

https://discord.gg/9n7PFy
- rjroldan1
- Inhabitant of a Megalopolis
- Reactions:
- Posts: 647
- Joined: Mon Jul 17, 2017 16:16
- Location: Philippines
- Plugins: Show
- Contact:
Re: Lua chatbox
Here's my script from my plugin for exampleLakan Haraya wrote: ↑Tue Feb 16, 2021 8:53I 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
Interactive Lua editor
.╔═╗─────────────╔╗────────
║╬║─╔╗╔╦╗╔═╗╔╗─╔╝║╔═╗─╔═╦╗
║╗╣─╠╣║╔╝║╬║║╚╗║╬║║╬╚╗║║║║
╚╩╝╔╝║╚╝─╚═╝╚═╝╚═╝╚══╝╚╩═╝
───╚═╝────────────────────
T.P.C.
Plugin creator Doesn't had Cities
- ian`
- Supporter
- Reactions:
- Posts: 100
- Joined: Sat Apr 04, 2020 17:36
- Location: Indonesien
- Plugins: Show
- Version: Beta
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
Interactive Lua editor

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
- Former Bearbear65
- Reactions:
- Posts: 5347
- Joined: Fri Feb 10, 2017 14:53
- Plugins: Show
- Version: Beta
Re: Lua chatbox
I think using fun variables for simple numbers are good and for more complex stuff use storage.
Just my opinion
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: ↑Sun Feb 21, 2021 5:53I think using fun variables for simple numbers are good and for more complex stuff use storage.