Jump to content

[help] xmlSaveFile


HunT

Recommended Posts

Posted

Where Wrong ? :roll: (first time with xml)

  
function memo () 
myMemo = guiCreateMemo(19,58,360,275,"",false,MemoPanel) 
  
--------------------------------------------------------------------------- 
elseif (source == mapbott2) then -- botton open memo 
memo () -- work 
LoadText() -- work 
elseif (source == mapbott6) then -- botton close memo 
SaveText() -- work 
  
function LoadText() 
        local mapText = xmlLoadFile("img/maptest.xml") 
        if (mapText) then 
                local value = xmlNodeGetValue(mapText) 
                guiSetText(myMemo, value) 
        end 
end 
  
function SaveText() 
         xmlNodeSetValue(mapText, guiGetText(myMemo)) -- debug error 
         xmlSaveFile(mapText) -- debug error 
         xmlUnloadFile(mapText) -- debug error 
         end 
  

Tnx.

Posted
function memo () 
myMemo = guiCreateMemo(19,58,360,275,"",false,MemoPanel) 
  
--------------------------------------------------------------------------- 
elseif (source == mapbott2) then -- botton open memo 
memo () -- work 
LoadText() -- work 
elseif (source == mapbott6) then -- botton close memo 
SaveText() -- work 
  
function LoadText() 
    local mapText = xmlLoadFile("img/maptest.xml") 
    if (mapText) then 
        local value = xmlNodeGetValue(mapText) 
        guiSetText(myMemo, tostring(value)) 
        xmlUnloadFile(mapText) 
    end 
end 
  
function SaveText() 
    local mapText = xmlLoadFile("img/maptest.xml") 
    if (mapText) then 
        xmlNodeSetValue(mapText, guiGetText(myMemo)) 
        xmlSaveFile(mapText) 
        xmlUnloadFile(mapText) 
    end 
end 

You have the file "resourceName/img/maptest.xml" at downloaded client side folder, right?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Work Tnx :wink:

Other Question.

Why in memo with key p open the admin panel? t show the cursor for chat . . .y etc.

is impossible to write PAPPATAPA in memo :mrgreen: why open 4 times the admin panel and 2 times the cursor :|

Posted
You're welcome.

About that, you must use guiSetInputEnabled to disable the binds and so on.

Oh yep work fine

  
elseif (source == mapbott2) then 
memo ()  
LoadText() 
guiSetInputEnabled ( true) 
elseif (source == mapbott6) then 
SaveText() 
guiSetInputEnabled ( false ) 
  
  

Tnx Again

Posted

Omg xml Stress me :roll:

For export the map list i have :

  
mapEdit = guiCreateEdit(140,339,117,26,"date xml",false,MemoPanel)  
  
elseif (source == mapbott7) then -- botton for create xml with name from edit 
exportDate = guiGetText(mapEdit) 
exportText = guiGetText(myMemo) 
local FinalText =  xmlCreateFile(exportDate,exportText) 
xmlSaveFile ( FinalText ) 
xmlUnloadFile ( FinalText ) 
  

Work Fine but the name file is not .xml

Posted
mapEdit = guiCreateEdit(140,339,117,26,"date xml",false,MemoPanel) 
  
elseif (source == mapbott7) then -- botton for create xml with name from edit 
exportDate = guiGetText(mapEdit) 
exportText = guiGetText(myMemo) 
local FinalText =  xmlCreateFile(exportDate ..".xml",exportText) 
xmlSaveFile ( FinalText ) 
xmlUnloadFile ( FinalText ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Other Problem With XML :roll:

My Problem Now is The "OutPut Code"

The script Work Fine:

  
elseif (source == mapbott7) then -- Botton for create xml 
local exportDate = guiGetText(myEdit) -- get the text from the edit 
local exportText = guiGetText(myMemo) -- get the text from the memo 
local metaNode =  xmlCreateFile(exportDate ..".xml",exportDate) -- crate the file and root with the text from  edit 
if (metaNode) then 
xmlNodeSetValue(metaNode, exportText) -- set the value (text) with text from memo 
xmlSaveFile ( metaNode ) 
xmlUnloadFile ( metaNode ) 
  

image :

20120321171207.png

XML :

  
<21-03-2012>ACCEPTED :1: BADlands BLASTAround        race-badlandsblastaroundDECLINED :</21-03-2012> 
  

?????

Tnx for help

Posted

And the problem is? you're not telling us anything.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Must be something about the encoding, I'm not sure. Anyway, that doesn't appear on the GUI, so why is that a problem?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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...