#plugin-lua-and-fun
1 messages Β· Page 11 of 1
alright if thats what you want to believe
the sleep deprivation be hitting hard
Now time to code the City Destroyer 42-069
With it's first task
Burn every building in the city
I'm afraid that might burn some other stuff as well
like your device, and possibly its' surroundings
he's making a DSA dlc
we're going to uranus??
nah its cinematic camera tool
i want to make waypoints with diffrent zoom levels between them, so that the camera changes zoom level as it moves
but moving the zoom level linearly looks unnatural
so i will modulate the way the zoom goes with this
thats where excessive amounts of maths come in
yeah im out
i knew youd get it
If your plugin doesn't use the gauss function like my discord bot does, I don't want it
Ah yes let's use it in script: update
Nice functions you got there
thanks theyre 3x^2-2x^3 and 6x-6x^2
with this i can calculate the required zoom change per frame
zoom
:0
i wonder if i slap a function into a default module like util would it stay there for the rest of the session
Just do
this might get out of hand
lua.lua when
So Complex industries are ongoing now?
ye im working on it
I'll look up on your branch later
i deleted my branch im just working on main now
I don't reccomend looking at it right now anyways because I'm in the middle of refactoring a bunch of code
Sounds like an excuse
Always has been
What does it mean, please help.
Game crashes every time I'm using my "texture pack"
Looks like a Lue error from one of kingtut's plugins i think
i have all plugins disabled
Ah
Looks like the game had a stroke
except of my plugins
You tried to call getabsoluteday
But the table you called it on didn't exist
yes yes
Do you use math random
no
That's wack l
Do you even use any scripts
You must've broken something by overwriting base game stuff
In not lua related that's probably an out of bound array indexes
I breathe a sigh of relief everytime someone mentions that an error they found isn't from me
Thought this is the right place.
So how to fix the alignment of the car? The west and east frames are offset while the north and south frames aren't. Gfx and json were based on in-game cars. It's v2
we can't help without your plugin resources
also not scripting, move somewhere else
@torpid spear I'll pm you
sure
How do i issue a fire disaster on a certain building with a toggleable button
Also a custom dialog
see the gui compendium
See all tge libraries
Does anyone have a cheatsheet for the icons
check in game
get the plugin developer tools plugin
it includes a gui example, with a list of all available icons
When I use my plugin, this error appears when loading the game. What does it mean?
I haven't any scripts or coding. Json only.
Game tried to get a random number
Those are in a range of 0 to n where n is passed by the game
Game tried to pass it a negative value
Obviously you can't do that
landTiles array was empty
that means game failed to locate any of the following drafts
$ground00, $dirt00, $sand00
if (seed.equals(SEED_SAND) || seed.equals(SEED_SAND_ONLY)) {
landTiles.add(Drafts.get("$beach_gnd00", GroundDraft.class));
} else if (seed.equals(SEED_GRASS) || seed.equals(SEED_GRASS_ONLY)) {
landTiles.add(Drafts.get("$ground00", GroundDraft.class));
landTiles.add(Drafts.get("$dirt00", GroundDraft.class));
landTiles.add(Drafts.get("$sand00", GroundDraft.class));
} else if (seed.equals(SEED_SNOW) || seed.equals(SEED_SNOW_ONLY)) {
landTiles.add(Drafts.get("$permanent_snow00", GroundDraft.class));
} else {
for (int i = 0; i < Drafts.LAND_TILES.size(); i++) {
GroundDraft draft = Drafts.LAND_TILES.get(i);
if (draft.autoBuild) {
if (draft.spawn == null) {
landTiles.add(draft);
} else {
spawnableTiles.add(draft);
}
}
}
}
you can override drafts and or disable them
Hang on this is your texture pack plugin isn't it
Probably overweote something you shouldn't have
placing graphics on the world texture would probably be a safer method
it is
there was a graphics issue
i made count 12 but there were only 6 frames
i fixed it
Lua error always have lua vm in the stacktrace
Well, "always"
Except when they dont
but still appears
so thats not my json issues
because frames and count values are equal
You probably still have a problem then
not true
but if i click ignore it also works fine
also how does your plugin look like
?
You want me to screenshot plugin folder?
and this causes errors?
this error
but if i set games id
like $tree00
with my own id works well
if you want to overwrite game buildings you use "inherit" and define the values you would like to change
can I see how are you trying to overwrite it
yes
but i need to understand how firstly
Oh
found an example
like that as i understand
title id is wrong
title id should refer to translation ID as defined in translations
should be kept empty when inheriting to keep the default values
show code
I would recommend to remove any redundant attributes
like the influences and metatags
the same
overwrite overwrites the original draft
inherit inherits the tags of the original draft
also the order in which tags is placed in a draft is irrelevant
one more interesting thing. Trees are not moving now.
lol
you probably deleted the frames per variant part
some of them are in wind position
You were right
also
you only need to specify the tags that you want to change
theres no need to specify the width and heights again
Okay, I will go learn java first to solve the problem
simply reverse engineer the game
try to separate them and try again one by one.
The notes button aint workin for me
why tf is that the RR link
Can anyone help me I was trying to make a night animation
You didjt define the type tag
Or if you did, it's not a valid type
Hang on
I think you forgot to put a comma behind the type line
How do I type the correct way ?
I can't tell you if I don't know how you wrote it in the first place
I tried following this I ignore the ID and just went from type animation-> light true -> light switching true and frames
Let's say I got confused what is Array , Object and Value XD
Uhm
This channel is only for Lua and Fun discussions
Please move to #plugin-support
Is "TA" was Jeremiah?
what could it be 
Dats cool
Nice!
dats some OpenTTD stuff right there

How can I spcript on mobile or is it impossible
Although I don't reccomend it, it's entirely possible
All you need is a text editor
Preferably one with Lua syntax highlighting
Ok
Know a good app for IPhone?
Sit and eat apple
Ok
that's an ios app?
too?
I remember him saying he uses an iphon3
or am I wrong
Atleast I donβt have to worry about diamonds
π
||but seriously I canβt find an app||
I'm not a new player but same
lol
Wtf is moon doing in the game?
ogg topic
LipokReal#6241 was banned for the following reason: Spam.
Do not the soammig5
Yes
ok
i play this game for 2 years and i still dont know tf is that
It's some hacker coding stuff
What's the best hacking tutorial for that?
Wow
lua is kinda easy if you are a roblox coder
I don't think roblox lua and theotown lua is the same
lua is kinda easy if you are a coder*
real!!!
if its not same then you can adapt to the change more easily if you have experience with lua
Lua is lua why would it be different
Who knew lua was easy if you already know lua
Well no it's really not
I have no idea how lua works
Its easy
Instead you can violently type then every if and for
While technically correct code, that's ugly
Loa is a fun and brain-straining
Lua should be in the course major π«
if (seg.equals(FOOL);
then (seg.is(Fool));
end;
Fixed it for you ;)
Now your Lua code is perfect
Oh thank uou kingtot111
so many tabs
Lots of scripts
its needed
Complex industri scripts leaked???
oh noo
For fun, you should combine all the scripts into one main script
Another light exercise for you
itd be uh
a few lines long
there are 1284 lines of lua
the longest script is the logistics script at 163 lines
it will probably become a lot longer with optimizations
half of those are comments. lol
ian hot fire
Ye and empty lines
I need to preserve my sanity
bingo, +100 points
It's both lua how hard can it be
Programmer level: 10000
This is what happens when I'm too lazy to come up with actual solutions to problems
Looks like yanderedev worked on this project
sounds unoptimized
What do you mean? 36 if statements aren't the pinnacle of design?
They are only good if there are 36 if statements over multiple abstraction layers
otherwise, you're a yandev
you should implement isEven
Hi everyone, can anyone help me pls? I drew a night frame for the windows of my building and I tried to implement it with a plugin in the game but it won't accept it. Is there something wrong with the code I am using, how can I fix it?
""needs road":true" :(
exactly that
aah, mamma mia!π
As it says, you did not specify the width and height of your building
This measurement is in tiles
I get it
But I did
The game Is making fun of me or I am clearly missing something ππ
right
I had meant that height there as the height of my Image and I didnt understand It was referring to the baseplate..
I am for real trying to figure out things my self but wtf did I messed up this time?
such a noobπ
Probably forgot a comma
yes
sorry, actually no
After I checked a couple of times I found an extra comma that was not needed at the end, at the height value
lol
Ah
That's definitely not ideal
And why they switched sides?like.. the building shines while the windows that are supposed to light up are dark
how
Aren't the name files in right oder here?
Even if they are, might as well test swapping them
I am alredy trying that right know, let's see
hello guys, the scripts use Lua for programming?
nice
The slider thing and scrollers is the only things i need
thanks bro. Are you have a tutorial video?
I don't
aah ok
Where's my blue light protection
gradients?
I have blue-defence glasses so Im good π
I want to acquire the gui
- Turn on debug mode then experimental features, if they are disabled
- Turn on "Revamp GUI" in "Plugins" section
May cause lag on some low-end devices
If TheoTown lags or crashes because of this plugin, I need feedback
amazing
unfortunately, drawRect is broken on the latest version.
ded
Rest in peace for that lua
where issue
background, i use drawRect only for it.
Help pls
How can I do this
Does it includes custom sliders?
Alright so know one wants to build a national guard so I will. Now I need help cause this is my first time. 1st question, where is the website to make it?
Theres no website that does the job for the script
Due to how complex lua is
Pca only does json
Aw so I can't do it on mobile?
You can write lua on mobile
Manually
Theres no automated silicon sorcery to write it for you
LUA hard
You're gonna give up after 39 minutes
Probably in 69-70mins
Or if he is desperate, 420-500mins
depends
Lets wait and see
yeah
Lul bruh
if you dont have previous programming experience, i doubt you can do it
Could yall maybe just stop saying stuff like that jeez so negative and mean
I'd recommend looking up a few general programming tutorials before you begin
Those will give you a better idea of where to start
Kk
Then look up some tutorials about Lua specifically
Then start trying to make scripts for your plug-in idea
Gotta start small
Ok I'll start trying to find some on youtube
I'm just trying to be a realist here
Jumping straight to making a plugin is skipping too many steps
You should follow some tutorials first on making simple lua programs outside tt
They aren't trying to be mean
Thinking that was also my mistake here
Making something complex like a LUA plugin without now knowing anything is a recipe for a bad time, but there are tutorials that can really help
.-.
Trailing comma
what trailing
Please post this to #plugin-support next time
This is for discussing plugin lua and functions
Plugin name?
Already an ingame residential building
XD
Oooooo
aos
aos
aos
The official video for βNever Gonna Give You Upβ by Rick AstleyTaken from the album βWhenever You Need Somebodyβ β deluxe 2CD and digital deluxe out 6th May ...
^
why does it utalize drawRect, instead of drawLine?
also generateId function can be replaced by Runtime.getUuid
hot fire
Uhh hmm soo sliders are actually drawings?
What are the mod you use and that look amazing
"Plugin name?" moment
Default in game building
What are the best building mods
Not the right place to ask bub
Also why do people say plugins are mods
i keep saying addon lol but when i realize its theotown i edit it to plugin
Y'all play too much Minecraft
no, too much cities skylines
is shading good
Not so noticable
Not scripting
oops wrong chanel
I'm new to discord, any complete plugin tutorial on what to add to the creation?
https://forum.theotown.com/viewtopic.php?f=41&t=2965&sid=62a34599c681b049cfc6532f98a0f329 Here is a link to the "getting started" page to the TT forum website, I recommend you to read "Copyright", "How to write a plugin" and "How to create a building in 10 steps" for start
Also, if you dont know how to install plugins manually, I also recommend you to check the Youtube video by Kamikazi "Installing plugins in the new way (1.9.95+)", the link is also in the "Getting started" page in the TT forum website
Also, any questions that is not LUA-realted (Advanced plugins) go in #plugin-discussion
Yeah, or that channel too
dont click
its in the wrong channel, and also its gibthub instead of github so everytime you see a link like these check carefully
gib tub
@potent jolt
@potent jolt Again
god
zxc#0154 was banned for the following reason: nitro scam
Theotown has weapon against them now.
How do I make a plugin for example a deco, when clicked, will turn into another deco etc. It changes back when it's clicked again and the cycle repeats
I know it would be "on click fun"but I don't know what to put next
[
{
"id":"$ncpc01",
"type":"category",
"title":"new category",
"frames":[{"bmp":"icon_pic.png"}],
"ordinal":10
},
{
"id": "$idpc01",
"type": "commercial",
"level": 2,
"author": "autor",
"width": 1,
"height": 1,
"preview frames":[{"bmp":"pic.png"}],
"frames": [
{"bmp": "pic.png"}
],
"frames winter":[
{"bmp": "winter_pic.png"}
],
"animation":[
{"id":"2x2l", "x":3, "y":-2},
{"id":"2x2l", "x":4, "y":-1},
{"id":"1x3l", "x":6, "y":-1}
]
}
]
the building doesn't appear in game
the category works tho
can someone help?
@gentle canopy really sorry for ping, but I think that you might know what's wrong here
should I make another file that makes the building in that category?
or sth
please help
everything is fine here
send the whole file
also not scripting related, move somewhere else
can i dm u?
sure
gimme sec
Im checking the category tutorial in the forum and I dont know what might be wrong, I never used categories, sorry
Also, futures questions about JSON code should go in #plugin-discussion
RCI buildings won't appear in normal categories, only in the manual build categories @stoic vector
sorry
then what I should do
Dont worry, just be sure to use the correct channel next time π
change the type of the building to soemething different
okay :)
so np "award"?
yep
okay lemme try
oh
@stoic vector u gonna tally this or nah?
not anymore
okidoki
Sad
:Improperuseofpensive:
Also seems like the lua and fun only has been being completely ignored for the last week in this channel
Aleevf#3700 was banned for the following reason: scam
again with this
be carefull what you wish for
because i will do it
and i dont have the permissions to unban
oof
do it π
ban him
#suggestions message
Thanks for your feedback
?
Doesn't a lua programmer know that?
Is it possible to make an anim change over time?
Like it changes color based on time of the day
Soo you can apply a shadow on a building; at mornings and afternoons shadow will be orange, noon and nights will be zero shadow
Somebody should try this
Yes
By using a gray overlay, and drawing it at various colors
nice
imagine that's being implemented to game
probably there would be a new code line for extra shadow anim, kinda like night anim we have
that would be too complicated but you can indeed do this
why would they implement a special thing for it, when you can just do it via lua
you could even just modularize it and use the meta table
.-.
Oh yeah that dubai plugin already does that. Probably possible to test some things out with it
It probably wont be me the one testing it but
oπ€
is it me or rotation aware animations don't work with the drawing module
yeah that's just effort and extra two lua functions
this will have a significant impact on the computational performance π
π this emoji have a different meaning
a comet 10x smaller than that will still wipe out humanity
If you hate lue erksmit's solution would be the best here
pretty good solution for many things
basically I want to draw a rotation aware animation on a building using Drawing.drawImage and setTile
which so far works fine, but the animation just spins lol
add "rotation aware": true
Should be easy enough, just retrieve the rotation of the city, then draw the correct frame
this worked when I was adding night anims on a car, without it the night anim was rotating
omg haven't thought of that really
yeah that's what I've been speaking about when I said 'two extra lines of code'
I'd put the rotation frames in an array with indexes 0 to 3
Then grab the correct one according to the current rotation
yes
I wasn't aware drawimage drew animations in the first place
Bro were past JSON rn
what else was it supposed to draw
yeah
an attempt was made lol
Anyway
If you give it the frame number, it won't play the animation
You'll need to get the frame for every rotation
this looks kinda ugly but works surprisingly well
except it changes size when I zoom lol
Alright first off
Let's buffer those frame numbers
Instead of fetching both the draft, and the frames every time
no β€οΈ
Fine
lol
disapproved for lack of optimization
Anyways I think you need drawTileFrame
yet you didn't suspend suburban living's shit code (yet)
good idea
image
Lol
so not gonna work
(flat building :sadeline:)
Yeah well
Can't rely on the docs half the time
If you don't want to do that
Use this
According to city scale
And don't forget to call drawing.reset
Or you can try out the method you said wouldn't work first
You don't know til you try
Also
Are you using luawrapper or just restarting the game every time
both actually
Lol
It won't change anything until you're dealing with requires and draft:call
So just put it on
drawtileimage doesn't work or I'm doing something wrong
most probably the latter one
What are you attempting
to draw the animation
Well, yeah but how
i replaced drawImage with drawTileImage
What's the code
nope
Zamn
Well
I suppose that won't work then
Try toasting the frame
So you at least know you've got one
And it doesn't error without you knowing
You can always just trying it this way
I could
Frames are just numbers, when you actually look at them
At least in the lua
I really love the lua
do I just use city.getView?
it doesn't seem to do anything either
at least not with this
It works fine for me, but I'm in drawcity I'm pretty sure
You're overwriting the X y you use for settile
Use _ to discard the value
why this channel randomly show as not read while there are no single message
someone posts nitro scam
gets banned
pidroid removes message
it's now marked as unread
thats fine too, it's not my code after all
wtf is happening in this server
my mans kulche probably sleeping
why kulche lol
no context + wrong lyrics
I knew there was some weirdness going on
No matter what, discord will deliver the wierd
why are you pinging me now
||dsv1023||.#9353 was banned for the following reason: spam
#rubbish-bin or #general please
but will it ever get finishedπ
I think we all know the answer
why is getRotation output clockwise and rotation aware counterclockwise, man
Beautiful eyes
No your not, happy April Fools!
Don't worry tomorrow will become normal (i hope)
Is upsidedown and the spelling is also the other way around
Confusing right?
Well the only i can tell if this is #plugin-lua-and-fun is by looking at the channel description
For example here is definitely plugin scripting because of the description (lua scripting and other stuff)
is there a way to check game's language with lua?
Try checking the TheoTown settings table
Any suggestion to improve these?
you ran out of memory
Also massive function calls
How make on click fun?
A what
Why icon with h & w values won't render
I add padding to the parent instead
I found a way to fix Drawing.drawRect, Drawing.drawImageRect, and Drawing.drawNinePatch in 1.10.45
https://forum.theotown.com/viewtopic.php?f=115&t=14831
should provide error when a negative value is passed
also does not call drawing.reset
but overall, a good temporary fix
You can find download link there
Download: https://forum.theotown.com/viewtopic.php?p=184326#p184326
Join my discord server: https://discord.gg/48HyXpT5yR
#TheoTownShorts #TheoTownShort #YoutubeShorts #YoutubeShort #Shorts #Short
This is a family friendly video.
Biffa does Cities: Skilines content,
and President Smith, KT101, and I (on my TheoTown playlist: https://www.you...
Shimber me timbers π₯Ά
oi nice tips for lua scripting
thanks again koukeh
Any other way to draw animated image with Drawing API?
Drawing.drawImage(Draft.getDraft(id), ...) -- draw animated image but would be an error cus it return table than number
Drawing.drawImage(draft;getFrame(i), ...) -- draw un-animated image :/
can't you theoretically use the second option and increment i manually?
By that i need to use Runtime.postpone() to slower the fps that's massive when you call it onUpdate()
Or maybe use Runtime.getTime()
Also need help for name argument here
no idea
Yes but if you don't cache the frame numbers I'd lose my mind
Check the spendcurrency function
Pretty sure you can only earn bus tickets and region coins with it
nah, region coins have a secret method for that
Not even the region coins 
Drawing.drawQuad bypasses Drawing.setClipping and always affects all pixels
I hope devs will fix it in 1.10.49/50/51
I've looked through all the lua docs but I didn't find anything related to setting table (or maybe I'm just blind)
its not in the docs
you can access it with Settings.key
youre gonna have to find out yourself what key you need though
my blind geuss would be Settings.LANGUAGE
this is #plugin-lua-and-fun
thank you, I'll try it
you can always just use pairs() to go through all keys
and maybe log them then look for the correct one
hmm, i could generate documentation that way
function script:clickEvent(x, y, _)
for k, v in pairs(TheoTown.SETTINGS) do
Debug.log(k, ' - ', v)
end
end```
this doesn't give any output
or maybe i'm referring to a completely wrong settings
i use TheoTown.SETTINGS.hideUI
so, it should be possible
unless, the settings table is not actually existing in lua
have you ensured clickevent runs?
judging from the fact that hideUI is not capitalized
try using language without capitals
doesn't work either
well, geuss youre gonna have to find it elsewhere
TheoTown.SETTINGS.locale for languange. return nil for default or xx.
Why do you want it anyway
There are already better ways for handling translation strings
To Add some feature to Russian player only
ah
@light plinth ban this dude for impersonating
Lebby#5651 was banned for the following reason: Impersonation.
when the lebby is sus
WHOAREYOU
@elder glacier π³
onInit = function(label)
if Font.DEFAULT:getHeight() > label:getHeight() then
label:setAlignment(0.5, 0)
end
end```
use this on the index label to make the number position same with the first line.
LOL
You are hitting such high fps on this game.. 8 and 3
damn so high
You need electric
I mean look at the city name (000 is the one, I have 23 fps) and rating
23k fps π±
000k
23k fps π³
feverdream
16R GNA GV U U fps π±
#869597141851578428 pwease uwu owo
oΟo
sUS
Fish
The fps so good π
fps dead
sUS
sus
sUS
Fps π±
- sUS
- Fps dead π
- The building hasn't electric
i think it has no water too
Yeap
why tho
ok
I dunno what's the point of that
does anyone know how to code in the Code Editor app? or is there another application that can be used to code?
Or is there a script template?
use the old reliable https://pca.theotown.com
An easier way to create plugins via friendly UI interface.
very little to code
and very easy to use
Better learn the basic syntax
@potent jolt help
smh
Rekruter na XV krucjatΔ#5713 was banned for the following reason: nitro scam
omg i witness that
just like live demolition, it's beautiful
lol π€ π€ π€ π€ π€ π€ π π€£ π€ π€£ π€ π€£ π π€£ π€£ π π€ π€£
@open arch
What the hack
Dam that's a lot
How to reduce?
try using a different text editor.
What do you recommend for IOS?
For some reasons the game let me in but the night frame is nonexistent
I don't know I'm not a scripting expert
Thanks lol
epic
Working with JSON was kinda wacky though but managed to do it. Huge thanks to the TheoTown plugin creator website for providing me an easy way to create lines of code
I think your back is strong now because you know how to efficiently make night anims and others will come
I congrlate you
Thanks
β
It's even more beautiful than mine ππ
damnnn
volter#4887 was kicked for the following reason: nitro scam
Can't ban them
Aha i knew it was a scam
remember to read the links before clicking in case some of you forget
discord.geft/R3aLL1NkN0SCAM
i lost my list of malware types
trojan + malware + spyware + worm + adware + crypto miner + ransomware + bitcoin miner + root kit + theotown diamond miner + ok
Do yall animate using json
Disgusting
Ew
the fuc u say
I died.
If you think its hard then its not
skill issue
i love the fps
Nice lag
1-10 fps π± π³
cool but the fps is too high dude!!!
Help me please
I re-read all the tutorials and did not understand how to make a one-way road with only 1 lane
I only need the left lane
if first index is zero then the straight road is on 5 and 10 index. so it would be:
[
{
"dirs": [
?, ?, ?, ?, //0
?, ?, ?, ?, //1
?, ?, ?, ?, //2
?, ?, ?, ?, //3
?, ?, ?, ?, //4
0, 0, 1, 1, //5
?, ?, ?, ?, //6
?, ?, ?, ?, //7
?, ?, ?, ?, //8
?, ?, ?, ?, //9
2, 0, 2, 0, //10
?, ?, ?, ?, //11
?, ?, ?, ?, //12
?, ?, ?, ?, //13
?, ?, ?, ?, //14
?, ?, ?, ?, //15
]
}
]```
The 0 rotation (it's a default rotation when you open a city) is the main reference for every rotation. If your code is right on 0 rotation, that will be right on every rotations.
Thanks you
?????
@elder glacier What
2, 0, 2, 0, //10
?, ?, ?, ?, //11
?, ?, ?, ?, //12
?, ?, ?, ?, //13
?, ?, ?, ?, //14
?, ?, ?, ?, //15
dont ever touch to dirs
gotta touch paper and pens instead
Tricky#1431 was banned for the following reason: Nitro phishing.



