#plugin-lua-and-fun
1 messages · Page 12 of 1
can someone help me how to make pavement?
I forgor🗿
and If I could ask for default texture
thanks
uuh
I cant find them
I'm so stupid that I don't know how to use theotown forums 😎
ian help me
I don't know how to thank you
I need ians phone number
Even tho it would cost gold prices for me to call internationally
idk, i only have 1~2 hours on weekdays to develop it.
can I do something like this to generate repetitive animations?
it doesn't quite work
if you using the merge function, make sure there are no animation tag before on your main draft.
yeah, there are no
this a sample script is i made and used on the in-game Willis Tower landmark.
next time i will use the alias id tag. lol
home house
roofs ruined
eliminated
you should utilize a template
also, build the string then just call draft.append only once
that would be a good idea
sure will
Hi
watafak
The Profile 😳
I like how dark roof combined with bright walls
by using Draft.append I have successfully minified my json from 4.3k to 2.5k lines
we need to go deeper
cut the frame. 
😳
Oh, Kulche, ik, it's silly question, but how to make random frame choosing
For example, i have 12 frames, and i need to get random frame
I place this building, and magically choosing random one from 12 frames
as I said then
This is possible if you use multiple frames in 1 image
it doesn't have to be a single image
it will work as soon as you provide at least 2 frames
It's just for example and I use it as a deco
Help. How to increase Police Car numbers?
Wait... in pca.theotown I put 3x3 size. Not 1x1.
is it possible to make animations with the decals?
🤔
I think i know what you wanna do
And i also think that is possible
now
"script": "#LuaWrapper",
"meta": {
"luawrapper": {
"dev": true,
"privileged":"mmmm", // Don't forget to provide a key
"title":"Tutorial",
"text":"Should open a link",
"frames":[{"bmp":"yt.png"}],
"strict lua":true,
"script":"1main.lua"
}
}
Help
This one not show
Botton
don't use wrapper if you use this function and it still not show the GUI.
function script:event(_, _, _, event)
if Tile.isBuildingWorking(x,y) then
if event == Script.EVENT_TOOL_ENTER then
GUI.get('cmdCloseTool'):click()
showDialog()
end
end
Help
{
"id":"$tencent_mark_john_joshua_cerrera",
"type":"commercial",
"title":"Tencent",
"author":"",
"frames":[{"bmp":"tencent.png"}],
"width":4,"height":4,
"level":3,
"script": "#LuaWrapper",
"meta": {
"luawrapper": {
"dev": true,
"privileged":"¿¿¿¿¿", // Don't forget to provide a key
"title":"Tutorial",
"text":"Should open a link",
"frames":[{"bmp":"yt.png"}],
"strict lua":true,
"script":"1main.lua"
}
}
}
]```
refer to this
actually, i never use the finishInformationDialog, but it maybe like:
local function showDialog()
-- Content
end
function script:finishInformationDialog(_, _, _, dialog)
local button = dialog.controls:addButton{
w = 0,
text = 'text',
icon = Icon.MENU,
onClick = function()
showDialog()
end
}
end```
you can read https://forum.theotown.com/viewtopic.php?p=164287 on the '6. Special Cases' part.
What do u call this?
Is that window?
Why the button not appearing
If I try to add
Create dialogue
The building details are covered by dialogue tab
i don't know why because i don't know how is your code.
why not try this code?
I try it but the building is become unpressable
Unpressble
The building stats is gone
are you want to create a button like this ^ or open the dialog when you click the building?
Yah
use logical operator.
function script:click(x, y, lvl)
if Tile.isBuildingWorking(x, y) then
showDialog()
return false
end
end```
Finally you gave me a clue to make openurl thing.
Oww its covert hahaha
Copied the message before you delete it.
Put a debug toast at the end of your function to verify it actually runs
Errors in GUI functions do not get toasted
Were
Here?
Ye
Still unpressable
Same result into this
so, the code is actually working.
remove that function if you want to open the default building dialog.
Sorry what function
this
??????
--actually, i never use the finishInformationDialog, but it maybe like:
---local function showDialog()
-- Content
--end
function script:finishInformationDialog(_, _, _, dialog)
local button = dialog.controls:addButton{
w = 0,
text = 'text',
icon = Icon.MENU,
onClick = function()
showDialog()
end
}
end
--use logical operator.
function script:finishInformationDialog(_, _, _, dialog)
--function script:click(x, y, lvl)
if Tile.isBuildingWorking(x, y) then
showDialog()
-- return false
end
end
Idk what to do
Help
Ok
This channel is for Fun and Lua coding only.
Use #plugin-discussion or #plugin-support instead.
Missing comma
Im making a simple welcome message by using toast,but when I wanted to add a username in it went error.
Here's the code:
"Welcome back mayor",
TheoTwon.getUserName(),
",You're running Theotown version ",
Runtime.getVersion(),
" ."
)
function script:enterCity()
Debug.toast(
"Welcome back to",
City.getName(),
",Your beloved city."
)
end```
TheoTwon is not a valid library
Also you shouldnt put code there
typo is the hardest bug
Put it in script:init instead
Something like this huh?
Debug.toast(
"Welcome back mayor",
TheoTwon.getUserName(),
",You're running Theotown version ",
Runtime.getVersion(),
" ."
)
)
function script:enterCity()
Debug.toast(
"Welcome back to",
City.getName(),
",Your beloved city."
)
end```
no
script:init is an event function just like script:entercity
you need to use it the same way
So i should add a function in front of it?
Something like this?
Debug.toast(
"Welcome back mayor",
TheoTwon.getUserName(),
",You're running Theotown version ",
Runtime.getVersion(),
" ."
)
end
function script:enterCity()
Debug.toast(
"Welcome back to",
City.getName(),
",Your beloved city."
)
end```
yes
note that the toast puts commas between every seperate argument in debug.toast
so your first toast will likely come out unintended
Lesser comma?
your first toast would come out like
"Welcome back mayor,erksmit,,You're running Theotown version ,11945a, ."
also fix your TheoTwon typo
Something like this?
Debug.toast(
"Welcome back mayor TheoTown.getUserName(), You're running Theotown version Runtime.getVersion()"
)
end
function script:enterCity()
Debug.toast(
"Welcome back to",
City.getName(),
",Your beloved city."
)
end```
no that would toast "Welcome back mayor TheoTown.getUserName(), You're running Theotown version Runtime.getVersion()", literally
you can put strings together in lua with the .. operator
remove the function(), probably
Error
Show dialog is an ID?
Can I change it?
What should I write this
I see the issue
Lua is very simple
That means a local function needs to be before anything calling it
So you need to put showdialog before finishinformationdialog or it won't work
when you get bored with the existing region creation gui
night mode: "true"
not scripting
oh oops
answered in dms anyway
Wtf
?
?
fps 7
How did you get this screen
I mean in the game
it's in wip
it is not available, it's a work in progress plugin
Ok
by setting your 'icon' variable to something else
How to write it
local button = dialog.controls:addButton:SetIcon( string png = "nil" ){}
?
what is this abomination
put your icon draft in a variable and set it as icon
that would be the best solution probably
My 3 attempt won't work
How to use it properly
Draft.getDraft('$animationid'):getFrame(),
?
That's lobby reply to me
what.
also, using 'botton' instead of 'button' in ids is very concerning lol
you grab the drafts on init, not when generating the ui
getDraft won't do anything by itself
this is the intended result of the code you posted
i dont know what the issue is
''local function showDialog()
local dialog = GUI.createDialog{
icon = Icon.PLAY_AD_VIDEO, -- Icon of the dialog
title = 'Open video', -- Title of the dialog
text = 'Are you sure that you want to open the tutorial video on Youtube?', -- Text for the inner area of the dialog
width = 220, -- Width of the dialog, 300 by default
height = 120, -- Height of the dialog, 160 by default
closeable = true, -- Show close button, true by default
pause = true, -- Pause game when dialog is open, true by default
onUpdate = function() end, -- Called every frame
onCancel = function() end, -- For closeable dialogs when close button is hit
onClose = function() end, -- When the dialog gets closed
-- An array of actions that will be shown as buttons, nil by default
actions = {
{
icon = Icon.CANCEL, -- Icon on the button
text = Translation.control_cancel, -- Text on the button
},
{
icon = draft:getFrame(), -- Icon for the
text = 'Show video', -- Text on the button
onClick = function()
end, -- Will be called when the button gets clicked
golden = true -- Will make the button golden, false by default
}
}
}
end
function script:init()
local building = Draft.getDraft('$tencent_yt_botton_.anim')
end
function script:finishInformationDialog(_, _, _, dialog)
local button = dialog.controls:addButton{
w = 0,
---SetIcon( string yt = "nil" )
text = 'How i made it',
frameDefault = NinePatch.GOLD_BUTTON,
framePressed = NinePatch.GOLD_BUTTON_PRESSED,
icon = Icon.PLAY_AD_VIDEO,
onClick = function()
showDialog()
end
}
end''
What kind of programming language does TheoTown use?
Java for base game, on PC you need to install 64-bit java to run the game
Thanks, but is it possible to develop a plugin on mobile?
you have a misconception of whats required to make plugins
you should check out some guides on the forum to get an idea
I understand.
How to connect this
local dialog = GUI.createDialog{
icon = Icon.PLAY_AD_VIDEO, -- become a frame
{}
{}
{}
}end
Into this
local botton = Draft.getDraft('$tencent_yt_botton_.anim')
showDialog()
end```
Idk how to do there local function
local icon
function script:init()
text = 'Show video', -- Text on the button
icon = Draft.getDraft('tencent_yt_botton_.anim')draft:getFrame(1)
end,
onClick = function()
end,
golden = true
}```
Is that correct
...what?
Nothing about this makes sense
The first 2 code snippets are fine on their own, I don't know what you want to achieve
The 3rd code snippet is just all sorts of incorrect
as someone with 0 lua knowledge, i can absolutely confirm the expert's words, trust the sources 
I am literally the pinned message here
||Don't Watch it||
...
You believe that the earth was flat?
Desolan edited it
gui looks good
do you have samsung?
Yes & I use it right now
you can clearly see it's not for you.
how do i make the past decal stay like what marcato did in his decal pack?
- is it a line of code in the .json or something else?
not scripting?
breh
gotta move it to support i guess
the new building icons are cool and all
but now we need a function to display our own
or i just need the id of the frames to implement it myself
yea but now complex industri icons look cringe in comparison
shut up, I made both of those :badeline:
Get ready for long crash messages.
fixed now https://bit.ly/390AY1v
whats the plug in name and where can i get it any links ?
how to make religion plugin?
Ok
Huh
do
"level": 1,
v1.5.2: https://bit.ly/3xB3Gza
Really?
that's how decals are made
Owww sounds good
Plugin download: https://bit.ly/3mcvrYt
Heightmap tutorial: https://forum.theotown.com/viewtopic.php?f=35&t=10039
For business/copyright enquiries visit the about page on my channel on desktop and you will see the email address.
This is a family friendly video.
Biffa does Cities: Skilines content,
and President Smith, KT101, and I (on my Theo...
Found some problems.
"level": 1,
brother?
yes
. . .
<@&368799288127520769> IP grabber here
@void wolf also works
He posted bit.ly links to rickroll and yeah
978373224620519495
Cheers
That's why you shouldn't click random links, kids
NvrGnaGvUUp#0043 was banned for the following reason: rule 7
Tho not like ips are usefull
I mean afaik all they can do is control your device by IP
1.1.255.255 here your ip
Damn doxed
I mean they kinda cant
Only thing you can do is dos them
Ah
You can't even get someone's accurate location with it
Just the isp reported location
Good bye Mr
its rather off topic innit
You're off topic
ok
Is there any moveable button API that i could use in newer version of the game?
Since the forum one had an error.
I think ian made one
Yes, i use 'ian s code but it didn't work.
it still works.
I guess i will use the build in sidebar thing.
i figured out how to use "require" in the "LuaWrapper" script, but you still need to restart the game if the module changes.
You probably didn't define a required field for your draft
@fluid trail maybe ur switching east for west
Hei, coba cek game ini deh:
https://theotown.com/share?id=DiTClRZz
insane
real scripting hours
Good script
He is sharing a link,so he can get diamonds, isn't it considered an advertisement?
Literally for him (buat kamu): ||jangan promosi disini,baca #rules kalau gak paham pakai Google translate!.||
It isn't ad anyways?
I mean it technically is but eh
what the
he meant about light blue button, not diamond count
I dont think so , but ok
bro
5
cinco
ROMÂNIA, ROMÂNIA!
?
If you are Romanian, let's talk on #language-bar , not here
@peak zenith also as for the vehicle frame, how can it recognize the rotation of the car?
[
{
"id": "$dense.pol.station.150",
"type": "police",
"author": "Plugin creator website 3.0 & Ryk_Mak_2050",
"width": 3,
"height": 3,
"frames": [
{
"bmp": "Dense Police Station.png"
}
],
"title": "Dense Police Station",
"text": "To accommodate your densely populated city. It has 7 Police Cars to patrol and respond to crime quickly.",
"price": 70000,
"influence police": 120,
"performance": true,
"monthly price": 150,
"build time": 47,
"power": -15,
"water": -15
}
]
What? Please elaborate.
You are romania
Since we have tiles for building, but not for vehicles
Ayst wrong file again aaaa
Sorry I'm newbie but there is no vehicle code there. maybe in "text" code which I change it earlier but send a wrong file.
Please go to #plugin-discussion or #plugin-support, this channel is about discussions about fun and lua scripting
He is saying about lua
and plugin scripting
Where do I write rotation aware? (QuickEdit)
Not the correct channel, but it doesn't really matter
You can put the line pretty much anywhere, I'd put it between line 21 and 22 because I think that looks nice
The line you need is
"rotation aware": true,
And on mobile as well, so I can't even see it
/\ next time /
(this includes @fallow yarrow message #plugin-lua-and-fun message below)
i can keep repeating that infinitely, but nobody is gonna listen anyway
might as well answer their question and get it over with
how do you do this colored text lol
Not sure how but maybe you can use this code below.
This doesn't work on mobile
thanks
you can do it for a variety of languages
watch this
function Io.exitCity()
Io.all = nil
end
yea
How do i make those uhh
Those blue arrows to change deco
And to script it
I suck at scripting
as erk said, "do you have a json"
should make an automated reply script at this point
itd answer about 60% of these questions
not yet
banned nitro scams usually
they post here, get banned then pidroid deletes their message
damn, lua error levels do not work
so the game was written in lua? 🐸
so it's written in Java and the game logic is executed via LuaJIT?
Some newer parts are lua as far as I'm aware but it's mostly java
is ian in this sever
server
oh found him
@weak mural do you accept animation dev tool suggestions
happen
yes, all my plugins accept any suggestions.
add war pls
since the NeighborCity module is available, it should be possible to add war. lol
maybe, wouldnt be very interactable still since its just a virtual neighbor
use car module to control the tank and artillery, 

oh, could you add importing animations into animation dev tool by putting in the animation code in it
What should I change because it bugs
first, this is not scripting
second, what bugs
third, I don't see any errors here (unless??)
fourth, some attributes are redundant as they have those values by default
It says "Error with "$Night_Animation"
that's not helpful
also, that's not a very creative id name and it might cause conflicts
What should I write instead ?
anything else that isn't extremely generic
Ok
After writing the plugin's basic code, what do I need to do next to get the night animation
hello
hi, I would like to learn how to make a plugin with multiple buildings, and which of them has also a rotation frame, how does it work? are there json I can use as standard/model? thankss
and also a night frame for both rotations obviously)
How to fixed this code error guys ?
How tho
and uh i need to know how to make a perfect json for the decoration stuff
is a pack just a bunch of jsons in the same zip?
I genuinely need some help
because I have to correctly write in one json: the default+night and rotation+night, which isn't very intuitive to me at least
noob, what can I say
I Am Working On Something Better Than Ian's ADT
Going To Post Screenshots Soon.
well thats tough to beat
I Learned Lua When I Used To Make Private Roblox Game With My Friends.
time to rest
more like
debugging
org.luaj.vm2.LuaError: ?:-1 attempt to call a nil value
for a afternoon
os.exit()
Cant find
Oh yeah
Anyways gonna change abit of the code in Mdks Sunken highway wall json
Will be hard since idk which of the { ] are supposed to be in or not
Ah bollocks
The codes wrong
Because i didnt copy the whole text
Theres no } and [ because it wont let me copy it
please stop using this channel for non scripting stuff
thanks evereyone✌️ it seems like I am asking too much, sorry
i feel bad for this person
Check the pins in #plugin-discussion and yes and no, because you can make plugins on mobile as well.
A pack is like multiple things in one plugin. There will be multiple frames for different buildings, but you can cram all the code into one .json
(I'm new to these stuff, take this w a grain of salt)
.json scares me because i have no idea how it works
And also I have no idea how to work lua
That would be cleaner ye I guess
a part from jokes, if anyone has any idea please tell me, otherwise I have no other way to move on and proceed because I am getting stuck on the damn scripting when the plugins is basically done
told you to stop using this channel for non scripting related matters, I'm gonna start warning next time
Someone should change the channel description to explicitly say it's not for JSON. It might help a little
Done!
akshually fun attribute is json 🤓
technically, fun isnt scripting
That's why you should change channel description again...
Essentially, yea
Is it possible to unable rotation on a composition?
Why would you want to do that?
Because i made a composition without the other frames
deprecated
plugin creators still use functions
Now support slopes
What a great fps
It can manage the population and size of each building?
||just a suggestion||
I've been waiting for this for 2 years
Wait. Is this selection tool?
Similar to districts feature in Cities: Skylines but it's just for decoration (for now)
you should add some functions such as count buildings of each type, total population, total worker,... using lua
😄
if there are too many updates for a building that it is not convenient to scroll through them, is there a way to divide them into several parts using LUA?
You mean a modular building?
?
show what it is please
@soft salmon
got this error when i click edit area @cursive parcel
Invalid user
He always leaves the server immediately after posting
You could create a GitHub issue
oh i see
No, i mean this
oh upgrades
possible, but unless you have a interest in lua scripting you'll find it too much effort
I'm studying lua right now, and if it's possible, I'll try to do it. Although I don't understand everything yet, I can do simple functions and interface.
v1.3 released
What is he trying to do by leaving the server? 🤔
Good question
Hotfix released
Please write, if you know.
It's not a set method I can explain
For a guide to gui
You're looking to edit the existing GUI for the upgrade button
I looked through all the documentation, but i didn't find any code encoding upgrades
It would be wonderful
Now that I look at it
I can't find a method for giving a building upgrades
Without that, you're not getting anywhere
Ok
Who asked you
Uh oh
That's not scripting
Ok
If you say one more time your rude
My plan was to overwrite the onclick for the upgrade button in the dialog to show a custom menu
Ok
Ok
Check builder library
@stoic vector the areas plugin keep having error when i click edit😭😭😭😭😭
ok so i found out that
it got errors everytime i minimized the screen
no
every time i change the screen resolution
If you do this, I will write you down as a co-author for a future plugin, since without this, playability will suffer greatly.
dont see it there either
it was just my idea, im too busy to actually make it
Okay
Why io on other lua executors returns a table but nil in theotown?
IO Library is removed from TheoTown
For security reasons?
One of my plugins may need it for it's translations (to free up space on main lua file)
Translations should be provided with translation drafts
DSA, for instance, is translated in such manner
What about (without using translation drafts) providing translation files (for each language) on plugin folder and using local localTranslation=Runtime.fromJson(io.open(".../translation/en.json"):read())
{
"1":"Translation A",
"2":"Translation B",
"3":"Translation C"
...
}```
@light plinth
??
@short ridge Don't ping admins for no reason
sounds like a worse solution
you can do this using the json meta table tag
if you really must
No, io support will not be added.
For security reasons?
Correct
A quick question, Car.spawn() function returns a table with methods stored inside isn't?