Post by psy on Nov 7, 2005 9:44:50 GMT -5
Hey everyone! I'm working on an on-screen map, which I've wanted since day 1, but SE seems to think we don't need one.
It's pretty rough right now and only works for Bastok Mines and Port since the origin (0, 0) seems to change for different maps. I went out to North Gusta and my marker was off the screen ><
Anyhoo here's what I have so far:
Test maps
I used the maps from FFAssist (converted from GIF to JPG) and put them in a subdir "map" below the scripts directory.
Haven't figured out a way to auto-load maps on zoning since there is no function that I can find to tell me the player's current zone *nudge nudge Tiny*
-psy
It's pretty rough right now and only works for Bastok Mines and Port since the origin (0, 0) seems to change for different maps. I went out to North Gusta and my marker was off the screen ><
Anyhoo here's what I have so far:
-- FFXI coords origin at H-I, 6-7 (at least for Bastok Mines it is)
-- each grid point is 40 apart, border is 18 pixels
-- Global Variables, Initializations ------------------------------------------
mapSize = 512
mapScale = 1
coordPerSquareXI = 40
coordPerSquareMap = 31
borderSize = 18
mapOriginX = 100
mapOriginY = 0
xiOriginX = mapOriginX + ((( mapSize + ( coordPerSquareMap )) * mapScale ) / 2 )
xiOriginY = mapOriginY + ((( mapSize - ( coordPerSquareMap * 3 ) ) * mapScale ) / 2 )
markerSize = 8
transparency = 64
mapDir = "map/"
mapName = "ea_0.jpg"
markerName = "marker.png"
-- Functions ------------------------------------------------------------------
function map2ScreenCoord(mapX, mapY)
local retX = xiOriginX - ( markerSize / 2 )
local retY = xiOriginY - ( markerSize / 2 )
retX = retX + ( mapX * coordPerSquareMap / coordPerSquareXI ) + 2
retY = retY - ( mapY * coordPerSquareMap / coordPerSquareXI ) - 2
return retX, retY
end
--- Main (kinda) --------------------------------------------------------------
mapObj = Graphics.primitive_CreateObject()
Graphics.primitive_SetPosition( mapOriginX, mapOriginY, mapObj )
Graphics.primitive_SetSize( mapSize * mapScale, mapSize * mapScale, mapObj )
Graphics.primitive_SetColor( transparency, 255, 255, 255, mapObj )
Graphics.primitive_SetTexture( mapDir .. mapName, mapObj )
Graphics.primitive_SetVisibility( 1, mapObj )
markerObj = Graphics.primitive_CreateObject()
screenX, screenY = map2ScreenCoord( FFXI.player_GetXPos(), FFXI.player_GetYPos() )
Graphics.primitive_SetPosition( screenX, screenY, markerObj )
Graphics.primitive_SetSize( markerSize, markerSize, markerObj )
Graphics.primitive_SetColor( 255, 255, 255, 255, markerObj )
Graphics.primitive_SetTexture( mapDir .. markerName, markerObj )
Graphics.primitive_SetVisibility( 1, markerObj )
-- Main while loop
while true do
screenX, screenY = map2ScreenCoord( FFXI.player_GetXPos(), FFXI.player_GetYPos() )
Graphics.primitive_SetPosition( screenX, screenY, markerObj )
Windower.script_Sleep(50);
end
Test maps
I used the maps from FFAssist (converted from GIF to JPG) and put them in a subdir "map" below the scripts directory.
Haven't figured out a way to auto-load maps on zoning since there is no function that I can find to tell me the player's current zone *nudge nudge Tiny*
-psy