TheUpThroughRoof function in AT has 3 settings; one for the low roof in the starting rooms, one for the corridors and one where it doesn't know where it's starting. The last one starts low and does 30 steps but the first 2 do only 12.
You have steps = 1. I'd say you need at least 12 steps to get through the roof and that is only if you start very close to the roof. Otherwise the rest of your function looks ok.
Actually because you only have one option you don't need the "op" argument. Just change
Code: Select all
local startpos, steps
if op == 1 then -- in Luke room
startpos = 44
steps = 1
end
to
Code: Select all
local startpos = 44
local steps = 12
Or if the roof is different height in different places, add a startpos argument. Here, I'll just write up a more general function.
Code: Select all
local function UpThroughRoof(startpos, steps)
steps = (steps or 12) -- defaults to 12 if steps == nil.
player:update()
if player.Y > startpos + steps then -- already above roof.
return
end
for i = 0,steps,1 do teleport(nil,nil,startpos+i) player:turnDirection(1) yrest(50) end
yrest(1000)
teleport(nil,nil,120)
player:update()
end
See how that works. You use it like this
Code: Select all
UpThroughRoof(44) -- Starts at 44 and drills up 12 steps to 56
UpThroughRoof(44,30) -- Starts at 44 and drills up 30 steps to 74
As a truly general purpose function it shouldn't have "teleport(nil,nil,120)" because the function wont know how high you are going and what you will be doing once you're through the roof. I also suspect 120 is too high for this script.