Hey Nick,
[FIXED] ---- by putting this line here instead of at the beginning of the draw_room function (at the end)
if string.match (room.info, "waypoint") then
WindowDrawImage (win, "waypoint", left, top, right, bottom, miniwin.image_stretch) -- stretch to fill
end
end -- draw_room
I've added the bold code in my mapper.lua as follows:
local function get_room (uid)
local room = supplied_get_room (uid)
room = room or { unknown = true }
-- defaults in case they didn't supply them ...
room.name = room.name or string.format ("Room %s", uid)
room.name = mw.strip_colours (room.name) -- no colour codes for now
room.exits = room.exits or {}
room.area = room.area or "<No area>"
room.hovermessage = room.hovermessage or "<Unexplored room>"
room.bordercolour = room.bordercolour or ROOM_COLOUR.colour
room.borderpen = room.borderpen or 0 -- solid
room.borderpenwidth = room.borderpenwidth or 1
room.fillcolour = room.fillcolour or 0x000000
room.fillbrush = room.fillbrush or 1 -- no fill
room.texture = room.texture or nil -- no texture
WindowLoadImage (win, "waypoint", "worlds\plugins\images\waypoint.bmp")
room.textimage = nil
if room.texture == nil or room.texture == "" then room.texture = "test5.png" end
if textures[room.texture] then
room.textimage = textures[room.texture] -- assign image
else
if textures[room.texture] ~= false then
local dir = GetInfo(66)
imgpath = dir .. "worlds\plugins\images\" ..room.texture
if WindowLoadImage(win, room.texture, imgpath) ~= 0 then
textures[room.texture] = false -- just indicates not found
else
textures[room.texture] = room.texture -- imagename
room.textimage = room.texture
end
end
end
return room
end -- get_room
and in my draw_room
local function draw_room (uid, path, x, y)
if string.match (room.info, "waypoint") then
WindowDrawImage (win, "waypoint", left, top, right, bottom, miniwin.image_stretch) -- stretch to fill
end
local coords = string.format ("%i,%i", math.floor (x), math.floor (y))
-- need this for the *current* room !!!
drawn_coords [coords] = uid
-- print ("drawing", uid, "at", coords)
if drawn [uid] then
return
end -- done this one
-- don't draw the same room more than once
drawn [uid] = { coords = coords, path = path }
local room = rooms [uid]
-- not cached - get from caller
if not room then
room = get_room (uid)
rooms [uid] = room
end -- not in cache
I tried, and removed this code from my actual mapper plugin
if string.match (room.info, "waypoint") then
WindowDrawImage (win, "waypoint", left, top, right, bottom, miniwin.image_stretch) -- stretch to fill
^^^ should I have done load?
All special rooms normally load via fillcolour as follows
elseif string.match (room.info, "guild") then
special_room = true
room.fillcolour = mapper.GUILD_FILL_COLOUR.colour
room.fillbrush = 0 -- solid
I've set the room.info to waypoint, and I'm getting this.
Run-time error
Plugin: DemonMUSH_Mapper (called from world: Demonclient)
Immediate execution
...\Master Vivi\Desktop\MUSHclient\lua\altermapper.lua:545: attempt to index global 'room' (a nil value)
stack traceback:
...\Master Vivi\Desktop\MUSHclient\lua\altermapper.lua:545: in function 'draw_room'
...\Master Vivi\Desktop\MUSHclient\lua\altermapper.lua:980: in function 'draw'
[string "Plugin: DemonMUSH_Mapper"]:240: in function 'process_exits'
[string "Trigger: Exits_Line"]:1: in main chunk
I tried again, but this time I modified it by adding this part again if room.info and room.info ~= "" then
if string.match (room.info, "shop") then
room.fillcolour = mapper.SHOP_FILL_COLOUR.colour
room.fillbrush = 8 -- medium pattern
elseif string.match (room.info, "waypoint") then
WindowDrawImage (win, "waypoint", left, top, right, bottom, miniwin.image_stretch) -- stretch to fill
elseif string.match (room.info, "guild") then
room.fillcolour = mapper.GUILD_FILL_COLOUR.colour
room.fillbrush = 0 -- solid
and now I get
Run-time error
Plugin: DemonMUSH_Mapper (called from world: Demonclient)
Immediate execution
[string "Plugin: DemonMUSH_Mapper"]:323: bad argument #6 to 'WindowDrawImage' (number expected, got nil)
stack traceback:
[C]: in function 'WindowDrawImage'
[string "Plugin: DemonMUSH_Mapper"]:323: in function 'supplied_get_room'
...\Master Vivi\Desktop\MUSHclient\lua\altermapper.lua:250: in function 'get_room'
...\Master Vivi\Desktop\MUSHclient\lua\altermapper.lua:914: in function 'draw'
[string "Plugin: DemonMUSH_Mapper"]:240: in function 'process_exits'
[string "Trigger: Exits_Line"]:1: in main chunk
Not sure where I went wrong on it. |