DarkArtist wrote:It would be pretty cool too btw if msdpexits added a prefix or suffix that indicates door status. Since we have to pattern match anyway, it wouldn't make it any harder.
function parseExits()
local exits = {}
local str = atcp.MSDPROOM_EXITS
local dirs = {"North","South","East","West","Up","Down"}
for k,v in pairs(dirs) do
if string.findPattern(str, v) then
local len = string.cut(string.reverse(string.cut(atcp.MSDPROOM_EXITS, string.find(str,v) + string.len(v) + 1)), 1)
exits[v] = len
end
end
return exits
end
-- use this function to run away to the direction specified returned and open the door (if there is one):
function runAway(dir)
if parseExits()[dir] == "O" then
send(dir)
end
end
{
West = "O",
South = "C",
East = "O",
North = "W"
}
Users browsing this forum: No registered users and 4 guests