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
34
35
36
37
38
39
40
shops = {}
for k,v in pairs (entitylist()) do
	if entity(v.x,v.y,"name"):sub(1,4)=="shop" and entity(v.x,v.y,"type")~= 93 then
		table.insert(shops,tonumber(entity(x,y,"name"):sub(5,6)),{x,y})
	end
end
function openShop(shopID)
	local shop = shops[shopID] -- our shop
	if shop then -- if the shop exists
		for k,v in pairs(shop) do -- our shop's triggers all the doors it has
			if entity(v.x, v.y, "state")==false then -- trigger them if needed
				parse("trigger "..entity(v.x, v.y, "name"))
			end
		end
	end
end
addhook("usebutton","_ub")
function _ub(id,x,y)
	if entity(x,y,"name"):sub(1,4) == "shop" then
		openShop(tonumber(entity(x,y,"name"):sub(5,6)))
	end
end
--[[
Essentially what this does is when you start the script (in other words, when the map is loaded) it'll go through all entities once and if
any of them contain the name "shop", it'll add them to 'shops' table
Example of a dyn_wall entity for a shop
	Name: shop01aaa
	Trigger:
Another example of a dyn_wall entity for a shop
	Name: shop01gate
	Trigger:
	
This works with all entities except for buttons (since you'll be using those to trigger other things)
So you're not constrained to just using the walls.
The limit of shops is 99.
]]
So something like this? See if it works. Oh and for the record, I left line 13 the same as yours since while reading documentation DC had written there that this variable is fcked so I didn't bother to test it out and see what value it gets when dyn walls are closed/open.