-- a script made to examine items from afar in adv mode this uses the adv mode's look cursor to function,
-- works best when keybinded to a button.
--uses warmists old vector search functions
local GMI=df.global.game.main_interface
local Advlook= GMI.adventure
local Sheets= GMI.view_sheets
Sheets.viewing_itid:resize(0)
function getItemAtPos(x,y,z) -- gets the item index @ x,y,z coord
--local x,y,z=getxyz() --get 'X' coords
local vector=df.global.world.items.all -- load all items
for i = 0, #vector-1 do -- look into all items offsets
local curpos=vector[i].pos --get its coordinates
local cx=curpos.x
local cy=curpos.y
local cz=curpos.z
if cx==x and cy==y and cz==z then --compare them
return vector[i] --return index
end
end
--print("item not found!")
return nil
end
function getxyz() -- this will return pointers x,y and z coordinates.
if Advlook.look.open==true then
local x=Advlook.look.cursor.x
local y=Advlook.look.cursor.y
local z=Advlook.look.cursor.z
return x,y,z -- return the coords
end
end
function sheetlooker(x,y,z)
Sheets.viewing_x=x
Sheets.viewing_y=y
Sheets.viewing_z=z
end
if Advlook.look.open==true then
sheetlooker(getxyz())
local examineitem=getItemAtPos(getxyz())
Sheets.viewing_itid:insert("#",examineitem.id)
Sheets.open=true
Sheets.active_sheet=6
end
ok this kinda became a bit of a bug bear so I went and whip up a script to restore the old examine items from afar feature that is missing in df51 adv mode.
to use this just use the look keyboard button and align the look cursor directly over the item you want to examine and run the script.