Temgamer wrote: 26 Jun 2020, 22:53
Also, is it possible to make console command require arguments? I tried TheoTown.registerCommand("testt", function(arg)) but this seems doesn't work how I expected
I don't think there are any arguments. What do you want to do?
Temgamer wrote: 26 Jun 2020, 22:53
Also, is it possible to make console command require arguments? I tried TheoTown.registerCommand("testt", function(arg)) but this seems doesn't work how I expected
I don't think there are any arguments. What do you want to do?
I just wanted to make a command, which would set radius and zone around some building by taking radius and zone ID as parameters
Temgamer wrote: 26 Jun 2020, 22:53
Also, is it possible to make console command require arguments? I tried TheoTown.registerCommand("testt", function(arg)) but this seems doesn't work how I expected
I don't think there are any arguments. What do you want to do?
I just wanted to make a command, which would set radius and zone around some building by taking radius and zone ID as parameters
Tried something like that but it doesn't work. That's why I'm trying to create a terminal in TheoTown which gives you more powerful commands but for personal reasons I can't work on it for a while :/
local c1 = 0
function script:update()
TheoTown.registerCommand(name,function(name,arg)
if c1 == 0 then
c1 = 1
Debug.toast('On')
elseif c1 == 1 then
c1 = 0
Debug.toast('Off')
end
end)
end
function script:click(x,y,level)
if c1 == 1 then
Your stuff ...
end
end
local function seperate(value)
local result = ""
value = tostring(value):reverse()
for set in value:gmatch("..?.?") do
result = result..set..","
end
result = result:sub(1, -2):reverse()
return result
end
function comma_value(amount)
local formatted = amount
while true do
formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')
if (k==0) then
break
end
end
return formatted
end
print(comma_value(1234567))
In other languages you'd be able to use the string format function to do that for you, but Lua is different
function comma_value(amount)
local formatted = amount
while true do
formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')
if (k==0) then
break
end
end
return formatted
end
print(comma_value(1234567))
In other languages you'd be able to use the string format function to do that for you, but Lua is different
I tried it before, but didn't work. now it works. lol
-- Bearbear
local function seperate(value)
local result = ""
value = tostring(value):reverse()
for set in value:gmatch("..?.?") do
result = result..set..","
end
result = result:sub(1, -2):reverse()
return result
end
-- Internet
function comma_value(amount)
local formatted = amount
while true do
formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')
if (k==0) then
break
end
end
return formatted
end
-- Test
print('The bear way: '..seperate(1234567))
print('The internet way: '..comma_value(1234567))
local function seperate(value)
local result = ""
value = tostring(value):reverse()
for set in value:gmatch("%d%d?%d?") do
result = result..set..","
end
result = result:sub(1, -2):reverse()
return result
end
print(seperate(1234567890))
Is there road with road decoration have specific conditions? Because when i'm place road decoration on road, the script doesn't work. Even when i use Tile.isRoadDeco(x,y,level).
Did you use Builder.isRoadDecoBuildable to check if it is buildable in the first place? Road decorations can define requirements like flags and alignment for the road they can be placed on.
distian wrote: 01 Jul 2020, 17:16
Anyway, that is sometime give you an answer not from the array.
Are you sure?
Regarding your issues with road decorations, how does your exact code look like? Also, overlay is not meant to be used to build stuff, although you can do that
This isn't about my script, i'm just replied to commanderABab about my signature,
Regarding your issues with road decorations, how does your exact code look like? Also, overlay is not meant to be used to build stuff, although you can do that