Forum

> > CS2D > Scripts > [Solved] Error setting tiles with settile
Forums overviewCS2D overview Scripts overviewLog in to reply

English [Solved] Error setting tiles with settile

1 reply
To the start Previous 1 Next To the start

old [Solved] Error setting tiles with settile

Talented Doge
User Off Offline

Quote
Basically I have made the code without bug. However there is a strange thing. If I put the code in front of all things, no bug. If I put it afterwards, it leads to the bug saying:

1
[00:19:24] LUA ERROR: sys/lua/yuki/aos/aos.lua:25: attempt to call global 'map' (a string value)

I don't get this line of error when I put the code in the start of file.

Part of the code encountering error:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
aos = {}
aos.sel = {}
blockimg = {}
dir = "sys/lua/yuki/aos/"
map = game("sv_map")
prefix = "@"
build_limit = {}
Supply = {}
blocktext = {}
name = {}
realism = {}
R = {}
G = {}
B = {}
flag = {}
team = {}
map_Supply = {}
dofile (dir.."settings.lua")
dofile (dir.."color.lua")
dofile (dir.."map_source.lua")
Supply[1] = map_Supply[1][map]
Supply[2] = map_Supply[2][map]

if game("sv_map") == "aos_random_test" then --and _test then
	local mapx = map("xsize")
	local mapy = map("ysize")
	for i = 1, mapx do
		for o = 1, mapy do
			local random_n = math.random (68, 69)
			parse("settile "..i.." "..o.." "..random_n)
		end
	end
end

Edit: after a few seconds I realize the line
1
map = game("sv_map")

made me encounter the error.
edited 1×, last 15.05.15 12:16:27 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview