Jump to content

map converter problem


karlis

Recommended Posts

addCommandHandler("move",function(_,_,mapname,x,y,z)
local ticks = getTickCount()
local map = xmlLoadFile(mapname..".map")
local file = xmlCopyFile(map,mapname.."_Moved.map")
xmlUnloadFile(map)
local nodes = xmlNodeGetChildren(file)
for k,v in ipairs (nodes) do
xmlNodeSetAttribute(v,"posX",xmlNodeGetAttribute(v,"posX")+x)
xmlNodeSetAttribute(v,"posY",xmlNodeGetAttribute(v,"posY")+y)
xmlNodeSetAttribute(v,"posZ",xmlNodeGetAttribute(v,"posZ")+z)
end
xmlSaveFile(file)
xmlUnloadFile(file)
print("MapMove: Moving \""..mapname..".map\" done in "..getTickCount()-ticks.." miliseconds with "..#nodes.." elements !")
end)

things that are fine:

-file, nodes, and map is proper elements/tables

-loop is entered

-output is fine and with proper values, like it should be

-no errors

now the problem:

map is not saving, adding it manually before didnt help, too.

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...