Jump to content

Help with storing values in xml


Recommended Posts

Ive put in a base that works by password and I am trying to store it in an xml and trying to use a scripted function to output the pass from the xml into the chatbox but is inaffective

Here is the script below

function readPassToPlayer ( thePlayer ) 
local passwordXML = xmlLoadFile ( "base.xml", getThisResource() ) 
    if passwordXML then 
        local passNode = xmlFindSubNode ( base.xml, "basepass" ) 
        local nodeReading = xmlNodeGetValue ( passNode ) 
            outputChatBox ( tostring(nodeReading), getRootElement() ) 
        outputChatBox ( "Error Loading File" ) 
addCommandHandler ( "getbasepass", readPassToPlayer ) 

And here below is the actual xml file

>    >cannonballjenkins>>

and below is my resources meta.xml

="samClient.lua" type="client" />    ="lvairbase.lua" type="server" />    ="samServer.lua" type="server" />    src="base.xml" type="client" />

Link to comment

Ya ive switched it around a bit and that didnt seem to work. I went back to the wiki and took another look at the function and tried doing first the parentnode then the subnode then the index number like it said. Ive tried both index as 0 and 1 and this didnt seem to work neither

Link to comment

also to clear this up. I use debug script every time I test anything even if its the smallest thing. And it is telling me that there is a bad argument at line 5 I already know that there is a problem but I cant seem to fix it

Link to comment

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