• maps png picture material
    4 replies, posted
[code] local _mapName = string.lower( game.GetMap() ) local _mapPicturePath = "maps/" .. _mapName .. ".png" local _mapPNG = Material( "../maps/no_image.png", "noclamp smooth" ) if file.Exists( _mapPicturePath, "GAME" ) then _mapPicturePath = "../" .. _mapPicturePath _mapPNG = Material( _mapPicturePath, "noclamp smooth" ) print( "Loaded " .. _mapPicturePath ) else print( _mapPicturePath .. " not found." ) end [/code] This load the map image if i have it on my drive, but not when the png is in a workshop file. is it possible to copy from the workshop file to the maps folder? with file.Read and file.Write or have someone other ideas?
The only directory that can be written to is the /data/ folder.
[code] local _mapName = string.lower( game.GetMap() ) local _mapPicturePath = "maps/" .. _mapName .. ".png" local _mapPNG = Material( "../maps/no_image.png", "noclamp smooth" ) if file.Exists( _mapPicturePath, "GAME" ) then //look for original png file.Write( _mapPicturePath, file.Read( _mapPicturePath, "GAME" ) ) //Write original file to data/maps/ //file.Write to data/maps/mapname.png if file.Exists( _mapPicturePath, "DATA" ) then //look if it was successfull _mapPNG = Material( "../data/" .. _mapPicturePath, "noclamp smooth" ) //use the new png file print( "Loaded " .. _mapPicturePath ) else print("Loading failed") end else print( _mapPicturePath .. " not found." ) end [/code] this failed: [code] file.Write( _mapPicturePath, file.Read( _mapPicturePath, "GAME" ) ) [/code] did i something wrong or is it not working? (file exists, i can read the file, but writing is not working)
[QUOTE=poepel;52492759][code] local _mapName = string.lower( game.GetMap() ) local _mapPicturePath = "maps/" .. _mapName .. ".png" local _mapPNG = Material( "../maps/no_image.png", "noclamp smooth" ) if file.Exists( _mapPicturePath, "GAME" ) then file.Write( _mapPicturePath, file.Read( _mapPicturePath, "GAME" ) ) //file.Write to data/maps/mapname.png if file.Exists( _mapPicturePath, "DATA" ) then _mapPNG = Material( "../data/" .. _mapPicturePath, "noclamp smooth" ) print( "Loaded " .. _mapPicturePath ) else print("Loading failed") end else print( _mapPicturePath .. " not found." ) end [/code] this failed: [code] file.Write( _mapPicturePath, file.Read( _mapPicturePath, "GAME" ) ) [/code] did i something wrong or is it not working? (file exists, i can read the file, but writing is not working)[/QUOTE] Moku already said you can only write to "DATA".
i am writing to DATA: [code] _mapPicturePath = "maps/" .. _mapName .. ".png" file.Write( _mapPicturePath, ... //file.Write -> "data/maps/" .. _mapName .. ".png" [/code] i read in "GAME" and I am writing in "DATA" but the writing is not working found the problem! :D the subdirectories wasn't there in data folder ... :D
Sorry, you need to Log In to post a reply to this thread.