User Tools

Site Tools


lua:scripting:firetemple

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
lua:scripting:firetemple [2015/01/01 09:38] vodurlua:scripting:firetemple [2015/01/01 09:50] (current) vodur
Line 99: Line 99:
 do do
  
-local cols=5 +local function revdir( dir ) 
-local rows=5 +    if dir == "north" then return "south" 
-local basevnum=501 +    elseif dir == "south" then return "north" 
- +    elseif dir == "east" then return "west" 
-local function getvnum( col, row) +    elseif dir == "west" then return "east" 
-    return basevnum-1 + (row-1)*cols + col+    end
 end end
  
-local function setexflag( dir, flg) +--Randomized Prim's algorithm http://en.wikipedia.org/wiki/Maze_generation_algorithm 
-    if not(mob.room[dir]:flag(flg)) then +local walls={} 
-        olc(dir.." "..flg) +local maze={} 
-    end+ 
 +for k,v in pairs(getroom(501).exitsdo 
 +    table.insert(walls, { dir=v, exit=getroom(501)[v]} )
 end end
  
-local out={} +while #walls>0 do 
- +    local wallind=randnum(1,#walls) 
-for row=1,rows do +    local wall=walls[wallind] 
-    local second={} +    table.remove(wallswallind) 
-    for col=1,cols do +     
-        table.insert(out, "#") +    if not maze[wall.exit.toroom] then 
-        local room=getroom(getvnum(col,row)+        wall.exit:setflag("dormant", false
-         +        wall.exit:setflag("door"false
-        if room.east then +        wall.exit.toroom[revdir(wall.dir)]:setflag("dormant", false) 
-            table.insert(out, room.east:flag("dormant"and " " or "-"+        wall.exit.toroom[revdir(wall.dir)]:setflag("door", false
-        end +        maze[wall.exit.toroom]=true 
-         +        for k,v in pairs(wall.exit.toroom.exits) do 
-        if room.south then +            table.insert(walls{ dir=v, exit=wall.exit.toroom[v]} )
-            table.insert(secondroom.south:flag("dormant") and "  " or  "| ")+
         end         end
     end     end
-    table.insert(out,"\n\r"..table.concat(second).."\n\r")+     
 +     
 +                   
 end end
  
-sendtochar(mob, table.concat(out)) 
  
 end end
 </code> </code>
lua/scripting/firetemple.1420105086.txt.gz · Last modified: 2015/01/01 09:38 by vodur