#plugin-lua-and-fun
1 messages Β· Page 2 of 1
ah
then just save
also
reason it didnt work is cuz of your getbuilding call
you cant put it out there
yes
if its not in a function
its ran as soon as the draft is loaded
which is during startup
when youre not inside a city, when the city module wont exist
local randomDirection = 1
function script:nextDay()
local slimeDraft = script:getDraft()
local slimeCount = City.countBuildings(slimeDraft)
local slimeX, slimeY = City.getBuilding(slimeCount, slimeDraft)
randomDirection = math.random(1, 4)
if randomDirection == 1 then
Builder.buildBuilding(slimeDraft, slimeX + 1, slimeY)
elseif randomDirection == 2 then
Builder.buildBuilding(slimeDraft, slimeX - 1, slimeY)
elseif randomDirection == 3 then
Builder.buildBuilding(slimeDraft, slimeX, slimeY + 1)
elseif randomDirection == 4 then
Builder.buildBuilding(slimeDraft, slimeX, slimeY - 1)
end
end
what is up with this weird spread
Call script:getDraft() outside so it can cached
probably a logic problem somewhere
i mean
i can't be mad
the code is doing what i made it to do
but to be fair, this pisses me off
Yes not bad, it's because of yiur algorithm
Youre just getting the last slime building to be able to spread not all
i sure do, mate
loop involvement
wait() π§
Dangerous
yes
After that You may want to list all possible directions in a table so you get rid of 8lines of if statements
i've tested it multiple times
okay maybe to be more exact
how do i make it so all slimes do something
all pisses
piss blocks
ask mojang
sounds like more effort than its worth
Nahh it's just a table with 4 elements
script:daily
4 elements of what though
and what then, check them with an if?
No
im not putting functions in tables
local randomDirection = 1
local slimeDraft = script:getDraft()
function script:nextDay()
local slimeCount = City.countBuildings(slimeDraft)
local slimeX, slimeY = City.getBuilding(slimeCount, slimeDraft)
randomDirection = math.random(1, 4)
if randomDirection == 1 then
Builder.buildBuilding(slimeDraft, slimeX + 1, slimeY)
elseif randomDirection == 2 then
Builder.buildBuilding(slimeDraft, slimeX - 1, slimeY)
elseif randomDirection == 3 then
Builder.buildBuilding(slimeDraft, slimeX, slimeY + 1)
elseif randomDirection == 4 then
Builder.buildBuilding(slimeDraft, slimeX, slimeY - 1)
end
end
once again, what could cause only the most recent block spread
dir = {
[1] = {-1, 1}, ... }
}
for i = 1, slimeCount do
local x, y = City.getBuilding(i, slimeDraft)
local frame = Tile.getBuildingFrame(x, y)
Builder.buildBuilding(slimeDraaft,x + dir[frame][1], y + dir[frame][2])
end
Just something like
youre only getting 1 building
and its the one with the highest index
you need to put your spreading code in a loop
Hey
12hrs nice
i do use lookup tables
just when youre nesting them for something like this
just a bit too much if you ask me
okay so now how should that work
didnt i sent the gist?
remove the build part and put your if statements
screw it
dont forget how you acquired slimeCount
local slimeDraft = script:getDraft()
function script:nextDay()
local slimeCount = City.countBuilding(slimeCount)
for i = 1, slimeCount do
local x, y = City.getBuilding(i, slimeDraft)
local frame = Tile.getBuildingFrame(x, y)
-- if statements
end
end
it works now
epic coder moment
theres still missing
it still spreads somewhat oddly but it's way better than before
needs to check whether the draft was already been placed to the assumed dir
the slime tends to spread in the directions that are in red
after it spreads fully in the red directions, only then it starts to normally spread to the blue direction
did the script attached to the building ?
show full code
if does seems im wrong using script:nextDay() its unoptimized
local randomDirection = 1
local slimeDraft = script:getDraft()
function script:nextDay()
local slimeCount = City.countBuildings(slimeDraft)
for i = 1, slimeCount do
local slimex, slimey = City.getBuilding(i, slimeDraft)
local frame = Tile.getBuildingFrame(slimex, slimey)
randomDirection = math.random(1, 4)
if randomDirection == 1 then
Builder.buildBuilding(slimeDraft, slimex + 1, slimey)
elseif randomDirection == 2 then
Builder.buildBuilding(slimeDraft, slimex - 1, slimey)
elseif randomDirection == 3 then
Builder.buildBuilding(slimeDraft, slimex, slimey + 1)
elseif randomDirection == 4 then
Builder.buildBuilding(slimeDraft, slimex, slimey - 1)
end
end
end
frame var is useless
not sure about the main issue but why is i=1
also why are you counting from 1 and not 0
terrible
lua start from 1
what
it causes the spreading to bug
scratch that
Yes counting starts from 1 unlike other lang.
shut up
'int expected' lower your expectations then idiot
wont it just get filled by other piss
Now you see how fun Lua is
i sure do
Now do GUI
doesn't it
well uhm
the computer is doing what i'm telling it to do
actually
what's the purpose of the loop
π€¦ββοΈ
It does nothing
it was a rhetorical question
okay this kinda works
okay now the disappear script works perfectly
now to figure out what this means
Your code
local randomDirection = 0
local randomDisappear = 0
local slimeStop = false
local slimeStopWatch = 0
local slimeDraft = script:getDraft()
function script:nextDay()
local slimeCount = City.countBuildings(slimeDraft)
for i = 1, slimeCount do
local slimex, slimey = City.getBuilding(i, slimeDraft)
local frame = Tile.getBuildingFrame(slimex, slimey)
randomDirection = math.random(0, 3)
randomDisappear = math.random(0, 19)
if randomDirection == 0 and not slimeStop then
Builder.buildBuilding(slimeDraft, slimex + 1, slimey)
elseif randomDirection == 1 and not slimeStop then
Builder.buildBuilding(slimeDraft, slimex - 1, slimey)
elseif randomDirection == 2 and not slimeStop then
Builder.buildBuilding(slimeDraft, slimex, slimey + 1)
elseif randomDirection == 3 and not slimeStop then
Builder.buildBuilding(slimeDraft, slimex, slimey - 1)
end
if randomDisappear == 0 or slimeStop then
Builder.remove(slimex, slimey)
end
end
end
function script:nextMonth()
slimeStopWatch = math.random(0,9)
if slimeStopWatch == 0 then
slimeStop = true
end
end
f..k off dyno
chief
the game will wait til your lua is done before rendering the next frame
and it has plenty of time to wait
wait()
stress test
Hello, i have created a ground plugin with several textures in 1 frame for saving space
How do i segregate the different ground textures in the json?
oh yeah it's for lua there, didn't see
my bad
Ppunish 751066833024712754
yeetinator07#1539 was banned for the following reason: Promotion of an NSFW server
Nice plugin
Mfw theotown seks
Your kindπ
TT x Marqato? π³
puglin*
We are not adding astolfo statues to the game
watch me add one
1984
Im currently reading novel with the same title.
no way
what
anyway lets get back on topic
Amungus
I need custom zone .json
Bruh i think this is where the json discussion nevermind thanks
How could I copy a table has nested tables
I tried to make a new table and index values from table1 to that new table but tables inside table1 couldn't copy
Nvm i found solution from roblox lua
make it recursive
iterate over the tables fields, if the field is a table, call the copy function again
(inevitably deadlock on a circle reference)
Yes yes
Is there any method to get happiness on a certain area? Not overall but area wasn't covered with influences
How to get the wait time of the game
elaborate
The wait time when youre not touching any on the map
Ghost pingu
my gui gets crashed when i suddenly put the game on the tabs and gets back i have no ways to fix it
Help i cant comprehend lua
kinda sounds like a you problem chief
Aw
Start small, and try to find some beginner's tutorials online
There's plenty out there, especially because it's used for roblox
Imma do that, thanks
damn i found it in forums
Hi sorry if I'm In the wrong Channel but is this where you wanna know how to make plugins?
this is where you talk about lua coding. if you want to talk to talk about plugins, youre looking for #plugin-discussion
@random hamlet
uniform float cityTime π³
Pog
Where's that
(the doc)
Found it btw
Cpp debugging in TT is what i we actually need
there is no way to debug shaders though
shaders are too low level
though
what i wouldnt give to be able to attach a lua debugger to the game
there won't be
I dont think it works like this
Since it was written in cpp
probably not
thats like
deep in the graphics engine
also its directly stored in the gpu memory so its not really accessible
Sad I've read something about that lately
also most shaders (especially for theotown) dont have complex algorithms I think
Ey ey, what's the default value of vector arguments if not defined? In shaders
If vec4 arguments are vec4(red, blue, green, alpha) and in lua value of (255, 255, 255, 1.0) draws the frame in original color why the default game shader was
vec4(saturation * (col.xyz - vec3(light)) + vec3(light), col.a); //this is just 2 arguments
col.xyz returns vec3 and vec4(vec3, x) is valid
i wonder if this can dynamically change via runtime
Ok found out it cannot be changed in runtime
That's easy, just making everything 50% more yellow
Any easy way to completely make game ui invisible temporarily with lua, same way as you click 'hide ui' in settings
There's still some gui id that i didn't know so i can't make them invisible
Can anyone teach me how to use the LUA code ??
because json is a way of defining data
it is not scripting
also, if you want to implement basic lua just read the tutorial on the forum
i can help you with specific steps or problems
but im not going to walk through the entire process
Rude
look man, i have chickens to feed
Is it good or not to keep strict lua on in production?
strict lua is good for debuging, but you can't do anything.
not using strict will pass the error, but you don't know the error.
strict lua has no effect on the LuaWrapper for minor errors.
i prefer to keep it on as it makes the script fail earlier, which could make it easier to track down the issue
otherwise you might get cases where your script wont work anymore
and it might write incorrect data to storage tables
which could permanently brick your plugin
yes, use strict lua will show this error: #bugs-n-crashes message
if not, will show this error or nothing: #plugin-support message
also hence why complex industry is so eager to throw errors
i dont want to risk breaking the city storage, since thats pretty much unrecoverable
If I'd change the file name of '.plugin' to '.mpf' and move to managed plugins folder does it will work?
Nvm, i see it needs a magic number
highly doubt it
Damn i just want to debug the behavior of my plugin within
Why can't I iterate over a _ENV table?
@light plinth does that sound like?
he left after saying that too
from what ive been hearing sounds like suspicious jeremiah stuff
jeremiah or this account?
malicious links in a plugin
i dont remember the details, i wasnt around but someone caught me up on it a few months ago
If he could just pretend to be an idiot, that would help for himself to stay here but no more plugin making
Whats he even asking for lmao
Asking for environment table
Because you don't need access to that. Simple as that.
If you disagree and even want to be unbanned, please write a 750 word letter to pickle@theotown.com apologizing for what you have done and arguing why ENV variable should be accessible, but that does not mean we will make it accessible.
Lmao
why i should get access to the ENV variable: i asked nicely
Emotional damage
May i ask... Does fun functionality with build types for road deco has significant effect with multi-deco support turned on in settings.. The old way for road deco having 'type:build' for another kind of deco on its fun was it removes itself to build the called draft. I'm thinking if it stacks when the multi-deco support are involved
It's was Jeremiah, that's to be expected for him since he's banned
Let's end here my question was getting buried
i think it will be better if only the fundamental parts to be unaccesible. it will be better if we can enhance some modules, like table to add clone or merge functions, or Drawing to add custom functions, than duplicating Drawing and drawing or table and Table 
yeah, with itteration to extract all functions into a new module.
same like the draft orig. since there are no functions to change like title, text, etc, without privileged code. and only protect the object like monthly price.
@weak mural since you mentioned .orig are attributes having space are not accessible?
I mean like "influence pollution"
Even camel case won't work in it
Ohh my i haven't hear that function before
it return the table and you know what the next to do.
Lemme check in the docs
It's not in the docs:(
Well i think it's a method, Thank you so much
including malicious code in his script
it wasnt harmful outside tt
it did things like exiting the application after obscure conditions were met
We can say, he simply attacked TT
the plugins he made were decently impressive so its a bit of a shame
What is it
Well i don't Download anyone's plugin as id only lunch the game to debug my work
a whole bunch of custom gui
Pretty expected though
You don't look like Jeremiah
Why does he keep coming back to a game he was banned from? I would've just abandoned this by now and moved onto something else
Don't underestimate human's willingness, as well as stupidity
no idea what drives him, hes got no platform for any of his content anymore
Can't he just start over by pretending to be a new user? He can act like a moron at first then become very good at making plugins a few months later
Because ngl his plugins look cool, without the sus codes
every time he makes an alt he gives himself away really easily
But the way he codes are still remarkable :>
Any other way to debug local plugins in managed plugin folder?
It somehow difference in some ways, like my plugin wont crash when it was in plugin folder but it crashed with the .mpf file i want to debug it there, managed folder deletes foreign file which was not in mpf format you know just to ensure it works in both format
I haven't encounter what my plugins error actually facing before, because it works well in the local plugin dir. until i download both plugin used both of my vendor files from plugin store, removing the local copies and dang i have the same issue.
well how are your "vendor files" implemented
that might shed some light on the issue
I think they're loaded last
You're probably right
Since local plugins get priority
That's been done for development reasons
now what if we could do
{
"components": {
// let's define a custom component called coolMenu
"coolMenu": {
// The base gui object type of the menu
"type": "dialog",
// The arguments that can create the gui object
"args": {
"width": 300,
"height": 180
},
// Let's put some objects in the dialog's body
"content": [
// lets use the coolContent component, and a label
"coolContent",
{
"type": "label",
"args": {
"text": "line 2",
"height": 15
}
}
]
},
"coolContent": {
"type": "layout",
"args": {
"vertical": true
},
"content": [
// let's put some labels in the layout
{
// types that dont have inner content dont need the args tag
"type": "label",
"args": {
// we're gonna replace {template} with a value later
"text": "this is {textContent} text",
"h": "{labelHeight}"
}
},
{
"type": "label",
"args": {
"text": "line 2",
"height": 15
}
}
]
}
}
to define gui

sure be a shame if someone made that
It looks like it's been made...?
i dont think you understand what i mean
this functionality does not exist
unless i make it
ask Jeremiah
I know nothing of the scripting language so yeah, you'd be right
he'll make it
nah, ill do it myself
main issue im running into is those format strings
i want to replace those with runtime data
but i need some way to handle that
the idea is that you'd create the coolContent component with a labelHeight and textContent argument that would automatically be substituted into the args
how to define a function, e.g. onClick, on json? 
@elfin geyser the discord link on your yt channel is invalid btw
Ahh thanks
Fixing it
Is it just me or temporary and permanent invite link was removed?
still can
ye only pc ig
tap and hold on a channel > invite > edit invite
Oh yeah its just the letters are so tiny that it is hard to miss
Right below the search one
veru
been working on a gui module
not quite done yet
Nice nice, whats your plan for on click function
data tags can be of any type
so you can use it to define an onclick as well
still need to write an example script for it
added an example script that used the onclick function
'draft:getContent()' was returned in the game for data drafts i think it's better to use that as it returns the whole raw json of the draft
That's not stored
What is it mean?
Raw json of drafts are not stored in the memory
They get loaded and immediately discarded
But i see he used loader function of the draft at init() to store the contents (provided inside the meta table) in his module
Metadata IS stored in the memory
Same with data drafts
their original contents get stored
Other drafts get their properties parsed and validated by the game and then raw values discarded
Damn i can't even explain in English properly what im trying to explain, m let's settle it here
the module has loadTable and loadComponent available if you wish to define your components in another way
i just picked the meta table since that lets me define arbitrary data
Makes sense
Hey rate my optimized way for go signals timer for busses after it pickups a passenger at station, this loops was called every day
for carId, obj in pairs(CARSPEED) do
obj.countdown = obj.countdown - 1
if obj.countdown <= 0 then
pcall(function() obj.car:setSpeed(obj.orig_speed) end)
CARSPEED[carId] = nil
end
end
I come up with this idea instead of relying on postpone function
- use postpone.
- don't use pcall.
instead of using pcall you should just check if orig_speed is a valid input
pcall incurs significant overhead when it errors
also, you couldve done ```lua
pcall(obj.car.setSpeed, obj.car, obj.orig_speed)
saving the overhead of an intermediate function call
also generally uppercase variables names should be used for constant values
but thats just code style
I thought it will execute at the main thread, and if there's alot of postponed the game performance will be slower
Does the space between setSpeed and obj.car is a valid syntax?
my bad, thats supposed to be a comma
I see
it passes the car as an argument
Yes already tried it but with only 2 arg
the : notation might work but idk
May use dot to be sure
But is it really true that using postpone function has affect on game performance?
of there is an effect, but is it a problem
You could optimize it more if you didn't have to use pairs ()
I believe regular for loops are faster
But maybe that's not possible here
Not possible since i used keys
I think it's more optimized since i don't have to iterate and compare each value to get the given id
optimization is cool and all
but why not take a step back and check if your script actually used a meaningful amount of frame time
excess optimization can really hurt readability and complexity
There's nothing to optimize now
Other heavy loads was up to the user how they can minimize their transit/route count
i am questioning the need to optimize in the first place
unless youre doing thousands of iterations per frame
you dont need jt
Well too much lua calls lags my phone
I know it's on my unit for some reason but at least it lessen also i considered low end devices
ive tested complex industry on my device with about 50 buildings and it had no measurable performance impact
and i usually get 40fps
Im lagging with it though
Also it's why it's often for me to use nextDay than update()
you must be doing an excessive amount of looping then
If i need to spend money, values having decimal does it round up?
Yeah i did it anyway, but it was look good to see when there's a decimal point for balances, unfortunately TT doesn't have decimals when it comes to money
What's the difference between
setRoadOccupation() and buildRoadDeco()
RoadOccupation is special type
RoadDeco is just road decoration
RoadOccupation defines rioters
Not sure if you can override them, but that's just things on the road such as trash, rioters, etc
not something user can control normally
Need some verification if this works.
local append = Array()
for i = "K3L","BL" do -- Types of wagons, passenger or baggage.
for j = 50,60,10,16,20,22 do -- Livery dates 19/20...
for k = 1950,1960,2010,2016,2020,2022 do --Livery dates for frames
for l = "EKO","BAG" do -- Types of wagon for frames passenger or baggage
append:add('{"id": "$K012_ITPTR_'..i..''..j..'", "type": "train car", "template": "$K012_ITPTEMP_GERPEN01", "frames": [{"bmp": "Gerbong_L'..k..'_'..l..'.png","count": 4,"w": 20},{"bmp": "Gerbong_L'..k..'_'..l..'.png","w": 17,"x": 80},{"bmp": "Gerbong_L'..k..'_'..l..'.png","w": 5,"x": 97,"handle x":-3},{"bmp": "Gerbong_L'..k..'_'..l..'.png","w": 17,"x": 102},{"bmp": "Gerbong_L'..k..'_'..l..'.png","w": 5,"x": 119,"handle x":-3}],"frames per variant": 8,"chargeable": false,"animation": [{"id": "$ITP_ANI_PWAG","x": -14}]}')
end
end
end
end
local json = [[
[]]..append:join(',\n')..[[]
]]
Draft.append(json)```
why not just test it
also
you can use runtime.tojson and print it to the log
then inspect the output whether it is as expected
I would rather do fetch a string draft from json than doing that
i would use the lua to generate the json once, then copy it to a file
Ppunish 916640981389021224
Frytkownica#9123 was banned for the following reason: Sharing scams or phishing content.
Print: "hi world"
using print is bad practice, i reccomend using Debug.Toast instead
on a side note
where does print even end up
When the toast is bugged
In the printer
print statements get sent directly to lobbys fax machine
they get sent to lobby by bundesnachrichtendienst
think they appear in stdout
but is that readable anywhere
omw to print celeste lore
the stdout
look man, i dont have the source code and android studio
i dont have a way to view that
literally stdout
xdg-open steam://run/1084020
on linux
with xdg
heck is xdg
protocol
sounds like foss
It opens the steam URL
no idea what's the equivalent of it on windows
open? run?
heck if I know
that's the plan
"start"
never heard of that url thing
it's a steam protocol
You can read about it more here
Lets you make steam into a CLI interface
that makes me curious
cool
now we cooking
sick jebediah kerman you got there
looks neat, and fast
bonus points if i can access screenshots and chat quickly
shouldve written it in uno
I don't have uno
it came free with your copy of theotown dumbass
best I can do is
I prefer it to vs
it happens to fall under one of the licenses i have
i see
it do be using some memory tho
might give it a shot
eh, nothing visual studio doesnt do already
as long as theres the stylecop plugin for it
as it is required for my work
ballin
will try tomorrow
dont care much for the diffrent styles
but will see if their xaml interpreter is any better than vs
Nice
Hello, could anyone tell me how to draw night anim on building through Lua, just like landmark 81 by anhkatori? thx a lotπ
have you got any basic knowledge on lua?
your script would look a little something like ```lua
function script:draw(x, y)
-- here we can check whether it is night time
-- then draw the lighting ontop of the building
end
drawCity is more friendly.
drawcity would result in the drawing getting drawn over buildings that should be infront of it
Hello how do I use this plugin
society if plugin-scripting was used for scripting
there's a forum thread for the plugin that should explain most things
you mean all 3 lua scripters on the server
you're right we need a separate server for lua
true, this channel isnt big enough for us
True
my worst plugin yet is a tool to put together the exact road you want and it works by adding hidden road drafts for EVERY possible combination during startup ._.
think I'll have to go for plan b and just force a restart after crafting a road and then only load the ones during startup the user wants, cause every new option right now would mean an exponential increase of roads to be loaded in lmao
anyone got a better idea hahaha
no I bought the game like three weeks ago lmao
but I've already spent way too much time doing Lua stuff haha
so you just started making plugins with the most difficult thing lol
umm yes hahahaha
I mean I'm comfortable with programming (tho I've never used lua before) and I fell in love with this game so why not ;p
glad you like it
as you can see theotown offers quite an expansive function library
yeah definitely! Though it's quite the trial and error sometimes to figure out how something works in practice vs what's in the documentation
and i want to do way too much right from the start, should've started with a hello world first I guess? but nope first thing i did is some smart traffic lights haha
Theotown Lua is fun
Even though I'm less active in TT now I should make a few more plugins at some point
(I'm a bit late but I don't care)
How do you build one
this channel is for lua, not json, not even sure what your talking about
Make a plugin
What website do you go on
depends on what device, also please go to #plugin-discussion
I diid
hello, do you have 16x16 templates?
I only have templates from 1x1 to 8x8, I'm missing the rest, does anyone have them?
Messy but it's 16x16
Grax
Psorry i forgot the translator why this error
Taba doing night animation test plugin
I do not know what it is "null"
Use English here , Spanish only in #language-bar
sorry i forgot the translator
The json doesn't have an ID. Also, next time go to #plugin-support
also thats not the right location to be putting your stuff
i think the name should be changed to 'plugin-lua-support' or something similar
well technically the channel is also for FUN scripting
for the 3 poeple that have ever used it
poeple just have the misconception that json = scripting
Ok
bruh
SimCity?
You are already an architect π
oh god no
F we are in wrong channel
Hey, I could put nocturnal animations but. the puglin has two images for you to rotate or flip with the arrows but by adding the night animation to the first image it can no longer be rotated
How do I make a plugin with night animation but still rotate??
rotate with the arrows not with the camera
"frame":0
"frame":1
"frame":2
"frame":3
:0
La id de animaciones siempre van asta aribba
sorry leave hello tr
animation ids always go up vrd
if youre planning on lua scripting, visual studio code
Oye te puedo pasar el puglin y me puedes decir que tengo que ASER para crear un puglin que rote no que jite ala cata sino que sea de elaso que tienen flechitas se aseelos pero no con animaciones nocturnas y ya no se quΓ© ASER me ayudas
πΊπ²
Hey, I can pass you the plugin and you can tell me that I have to ASER to create a puglin that rotates, not that jites wing tasting, but that it's made of elaso that has little arrows, it cleans itself but not with nocturnal animations.
Hey, don't diss fun. It's pretty cool (not biased btw)
Wrong channel, but you have to provide additional frames for the rotation
a lot of other alternatives, vsc is best though
Notepad++ works fine too
Anything that can edit text should work though
Visual studio code has a lot of convenient features, but it might be a little intimidating at first
Use #plugin-discussion or #plugin-support to ask for help regarding json issues. This channel is used for lua, a speecial coding language very few people know how to use.
is it not necessary to animate road deco?
planning to make a scrap yard
oh wait it is
scripting is lua btw, you should ask in #plugin-discussion for help with json
hi
It is possible to run other code by changing game language?
Disabling and enabling, scrip or json by just changing language
yes, it's possible.
Next time I request we use a channel that's not this one
cancelled industri
you can set the animation frame
as well as an upgrade, if you dont need to switch often
Okay
now that i think about it, is there a way to have a building unlock requirement controlled by lua
though i suppose you could use a fun variable set by lua
bold of you to assume its not all in fun
the infamous 10 mb rocket animation text file
a classic
ban
sure buddy π€£
LorenaMelo#9096 was banned for the following reason: Sharing scams or phishing content.
person posts nitro scam -> gets banned -> channel remains unread
pretty much
Very true
there are guides on forum
unless you mean json which goes in #plugin-discussion
Wrong channel, use #plugin-discussion
This channel is for lua
Is there scripting in vehicles?
if you know lua, theres some available
actual control of the vehichle itself is still handled by the game though
its theoretically possible but i think that is beyond your level of experience
and it would be quite a lot of work
since the game does not have anything to help with that
Is there anyway I could program the planes to have controls?
I need script of Main fire station I will dupe its helicopters
Easy..
Maybe
then youre in the incorrect channel, this channel is for lua scripting
Lua scripting is used in what what things then?
for doing things that plugins usually dont support
Then lua script is used for what in theotown?
please refer to the tutorials/lua api
lua has a large library of functions and their uses are pretty much infinite
lua can do almost everything, but its not something you can just hop into
I know the powers of lua but don't know in theotown about it
Ok to the tutorials now
theotown has no helicopter related lua apis
youd have to draw and move it yourself
but its better to just lift the helicopter spawner from the in game building
How do I do that now?
theres at least 1 post on the forum that says how to do it
the games json for the fire hq helicopter is not available since it is an in game purchase
but you can just go off a generic helicopter building
Means?
I'm not aware of the limitations
refer to the helicopter tutorial, as you've been told multiple times already
NaonWeh#7650 was banned for the following reason: Sharing scams or phishing content.
my day be so fine
hi i need help how to use a link by lua? i want to make a guy pressing button and he will be sended to link
oh
then ill just make them copying the link
i guess that spendDiamonds (amount) is too not for everyone cuz its not working to me
i dont rly need it just asked
What is lua
please stop misusing this channel
spendDiamonds (getDiamonds ())
Nah, that's just new game+
Is there a simple code generator here?
nope
lua cant be generated
but if you mean json
An easier way to create plugins via friendly UI interface.
Design is more difficult than coding
you probably mean json which is more #plugin-discussion
this channel is for lua
#plugin-lua-fun when
how to call plugin store?
what are you talking about
i want to code shortcut to plugins for pc, like on mobile
i coded button but idk how to make it call store on click
what i should use? openStore(), or something like this?
maybe call an in-game function
i dont think this is currently possible
you'd need to change the game's stage
(stage is settings, city, pluginstore, etc)
you cant really forcibly navigate the user to it
unless you were to find the correct gui buttons and press them for the user
dont think its a right one
ah yes
yes what
what's the difference
idk in tutorials always '
ok
k ill try this code but remade
dont think there is module 'game'
anw modules always start with capital letter
ai won't generate usable code
I'm pretty sure about that
that's not how any of it works, I'm not sure if you can ever open the plugin store with a plugin
definitely gonna work, trust me
they are interchangeable
also chatgpt is trained on the 2019 internet
it wouldnt know the lua api exists
is there any in game functions list
if you do some research youll find it
ghost ping
you need to put "draw ground": true on your json
you can say it 50 million times but the next guy is still gonna come in here with his json question
Ok
Why is JSON a forbidden theme?
That's not scripting
json is bunch of data
JSON is just a simple format meant for describing in-game objects. Scripting is more about programming custom behavior.
and how to find out on the phone where in the figure x and where V
#plugin-discussion please
what id does information dialog of building have? like sidebar is GUI.get('sidebar'), what id does information dialog have?
ye ik there's Script:finishInformationDialog, so we can guess that its informationDialog, but idk, it didnt work
what are you going to use it for
if you want a custom dialog entirely i can point you to script:click
which wont create a dialog if you return false
so you can make your own
ok but then how to access to list with updates?
i just want to have values of variables in information of building
ok nvm i can use Building:setText
Hiw do you make that?
im afraid we do not understand the translation
Please, learn how to write properly without orthographic issues before translating
I hope it translates better, otherwise I delete it and improve it, okay
It has been a while since I accidentally found a plugin that contained nocturnal animation in it so that when it got dark I put the lights or textures at night but Alava removed the building And only the luses were left, there were floating around, I don't know how I did it, I forgot, I hope someone knows how to do that, I also lost the puglin when I deleted everything by accident: (
If it's wrong don't report me. Just tell me and I'll delete it please excuse me
I assume there's something wrong with your night animations but the rest is completely incomprehensible
I also doubt it is related to scripting in any way but I don't care anymore
this is not scripting so use the correct channels
also nobody knows what the problem is
havre is french not soviet
I'm so sorry. What is right Chanel?
Remastered version typical sovet residential- soon
- This isnt the right place for this
- its no longer available
Thank you for telling me and aight
"lua and fun"
I personally would just combine this and #plugin-support
(oldpost again but just saw this) I disagree
that channel is especially for support
and this one is for fun/lua (obv)
so it's different
theres kinda an overlap but I still think it should be separate because of scripting related discussions
however I have a suggestion to make, gonna make it
We will see what that helps
we do a little experimentation
I imagine at least 1 person will still post about Json
ah yes, I can now ask fun attr questions here
:3
Ohhhhh okey okey
Used to be #plugin-scripting, but too many people posted Json instead of Lua
plugin json and fun
you're looking at it
nice
how do I implement dijkstra in fun
step 1 is to write a letter to them
step 2 is to bully justanyone to implement it natively
no one reads those
Yeah, because no one seems to care for topics
||json is fun when it isnt being an ass and actually working||
wow this channel become active for a day
later it'll still be inactive but at least (hopefully) only used correctly
if only there were more coders
wait, actually... I think it'd be cool to add shader discussion in the topics
(it wouldnt change anything cuz all shaders except 2 are made by me for now lol...)
your wish is my command
plugin lua and fun
#Shader-math-discussion when
See you in about 7 buisness weeks
Would ask if using table for json would work?
local character = {
"Yakka",
"Anonymous"
}
local text = {
"Hello world!",
"Makes Sense...",
"Who asked?"
}
local append = {}
-- Sets the array that will be used in the notification
for i = 1, #character do
for j = 1, #text do
for k = 0, 3 do
table.insert(append, '{"id": "$YKPS'..k..'", "type": "topic", "color": { "r": 255, "g": 255, "b": 255 }, "text": "'..character[i]..' : '..text[j]..'"}')
end
end
end
local json = '['..table.concat(append, ',\n')..']'
Draft.append(json)
you can use Runtime.toJson
we're using both
no
thats not how any of this works
Is it possible to implement this thing using fun? I wanna detect road usage in x y (that is, somewhere nearby) relative to my road deco position?
Then change it to another road deco depending on the road usage
ought to be possible with lua, but idk much about fun
wait u can make plugins with Lua?
Is it possible to add background sounds when I zoomed in on an object? using lua or fun?
A sample, is much appreciated
you can use City.playSound for this
but you would also need to keep track of all your buildings
is it possible to build multiple of your building?
file provided for your convenience, might be broken, I don't know
best naming ive ever seen
possibly broken, contains legacy code
theres better solutions for a couple of the parts of it
Yeah, and now I'm reconsidering it again
still possible, just a little more involved
but i would not do it if there are many of your building that might be built
like an rci
I'm attempting on a roaddeco
Is it possible to add script to override cars behavior? Car will NOT despawn until it reaches its destination (say, car is in traffic jam) unless the road from bldg A to bldg B has no connection (despawn)
while you can tell cars that you spawned where to go or to despawn, theres no way to gather information about its surroundings
you can get the car's location
It's working!
fps plugin malware
the sound works well on my android
perhaps i simply have a broken version
either way, it does contain code that is outdated
so bear that in mind
Well, yeah, I'm sorry, this stuff is broken for more than 2 buildings
bx, by = City.getBuilding(1, buildingDraft)
if song then
song.setPosition(bx, by)
end
end```
The following only plays the song for the first building in the list
C++ code?
look at the name of this channel
its a lua programming language
Do we have City.countRoadDecos([draft]) and .getRoadDecos() similar to
.countRoads()
first is i think how many of one deco, second is gow many all decos and third is all road tiles
please read the question again..
Damn i feel like I'm newbie again, does lua support shorthand operations like a += 1
sadly not
I'm thinking how I could add visible path on roads for my TX plugin upon selecting routes
i don't really think that's feasible unless we get some way to get a car's route
What if the path keeps changing?
Yup that's what im thinking since TX bases its "reachable" or "unreachable" state if the test car spawn to reach specific target. I'm thinking of making a 999 speed test car to collect all tiles that car used on its path however its seems unguaranteed due to uncontrollable how system use to calculate path for i-car
How system calculate path for i-car is beyond our control
I wonder if the changing path is proportional to changing reachable/unreachable state, im thinking to my traffic lights
You're relating my TX on your traffic lights?
Im guessing if all roaddecos or roads affect the behavior of the road, does it affect the path?
say, we can control the dirs:[] of the road, indefinetly
does it change all current paths available?
No it's not the car will just disappeared from a long 0 speed made by road decos
yeah, a pre-calculated thing
About modifiying dirs[] it might
What if we put 0.0000001 on a road deco, do car will disappear by being on it for a long time?
Maybe i should just rely my path by adding visible station index number upon picking
car paths dont change once created, im fairly sure
frankly that sounds too wonky and unstable to be viable to me
then if the car is running on the path that have a road changing behavior (say, the direction of the road changes to opposite directions), the car despawn instantly on that road
yea
you can test it yourself
if you demolish a road the cars will drive into it and vanish
Unlikely to get a separate method other than the current smart car system as the pathfinding process is asynchronous and could not even be completed in some cases.
my intention is that youd be able to get the car's path after its spawned
in what format
an array of coordinates of corners/intersections i suppose
kinda depends on the way that data is stored in the game
that would allow visualisation of the car's route, and perhaps some extra shenanigans
use setTile to set the exact pixel youre gonna draw on and pass 0,0 to the x and y in drawText
that way it will be in the same location
(just dont forget to handle city rotation like i always do)
Got it thanks
Could anyone tell me if there is any code to remove the bridge pier?
I don't think so
Lol, look at the six lights, observe the cars when the light is red ...
Schrodinger traffic lights
They do stop and don't
I dont know how to print random strings so I did this. will this work?
you should probably put your strings in a table and randomize that
local t = {'x', 'y', 'z', ...}
print(t[math.random(#t)])```
thanks.
society if lua didn't index from 1
krill issue
by the by, your script will not print anything if the random number is 3
how does spendCurrency differ from spendMoney?
spendcurrency can spend other types of currency
where can I find the names of all types of currency?
pretty sure those are also created by the user
got it, what's the name of the regular currency?
there's earnMoney and the like for default theons
I don't understand what bugdetitem means
what
I can't make it any clearer
a screenshot?
yes
just click your money
And how do I specify this string? Like, what values can it take?
What do the x and y mean? I thought I knew, but I don't.
..coordinates?
it can either refer to screen or map coordinates, but I don't know which specific function you're talking about
any more questions?
It's my creation, and it's wrong about 101% of the time, but I don't understand what exactly it's wrong about (other than earnMoney lol)
I just finished writing the exact same sentence and now I have to delete it all
whatever it is, its not a lua language server
Honestly, I have no idea how to customize VSC for lua, I searched on the internet, but it's a load of crap, I have to write by feel.
???
as I said it's case sensitive
can't you just change the language to lua
how
so
you probably installed multiple lua plugins
you know you can click around on yor computer
also yes, I'm not asking whatever you've done to your vsc
I have no idea how to build a VSC under lua.
you only need the lua language server by sumneko
you probably installed way more than that
fix your spaces and indentiation
???
you ain't going anywhere with those indents
indent all your bodies of functions, loops and if statements
you just added some new lines here and there
nothing indentiation wise
there's also a spare space in your function definition
aand that's not how you'd pass a boolean in the earnMoney function
I'm a noob, I have no idea how to structure it
it might be a wise idea to learn basic lua structure first
still wrong
because that's not how you do it....
read some beginner lua docs
you pass a boolean the same way as any other type (all the other ones are fine)
I can't compile this, and all the guides I look at don't say a word about the layout.
what does compilation have to do with any of this
you don't compile lua files for theotown
i know
also, if your docs don't say anything about structure you're looking at the wrong docs
But you're talking about training, how do I train without compiling?
??????????????????????????
I have 0 idea what you're even talking about
can you just say how to fix it, to understand how it works, I basically decided to try to write such a script to understand about working with lua in theotown, I'm trying to find information about lua programming inside theotown, but all I can find is this site https://doc.theotown.com/modules.
I'm looking for lua training, but it means learning lua in general as a programming language, not a word about private modules like programming in theotown, it doesn't help me much.
