jkub Posted May 15, 2009 Share Posted May 15, 2009 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() ) else outputChatBox ( "Error Loading File" ) end end 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
Lordy Posted May 15, 2009 Share Posted May 15, 2009 look at line 5.. base.xml just as this, is trying to access a table called base with a key "xml".. You have to put the passwordXML variable there instead Link to comment
darkdreamingdan Posted May 16, 2009 Share Posted May 16, 2009 This is what script debug is for. It would have easily picked it up. Make sure you activate debugscript and you'll save yourself a lot of time. Link to comment
jkub Posted May 16, 2009 Author Share Posted May 16, 2009 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
jkub Posted May 16, 2009 Author Share Posted May 16, 2009 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now