denny199 Posted February 9, 2013 Posted February 9, 2013 (edited) Hey there, I was making a new house system, but now I have got a problem I don't know how I can get this: <houses> <house dim="0" interior="1" num="0" x="2132.9653320313" y="-1309.9451904297" z="23.981597900391" lx="2126.8481445313" ly="-1320.8674316406" lz="26.624277114868" cost="55555" owner="denny19" street="DenR Kutjes Street" sellprice="55555" lockStatus="unlock" NAAM_ah_grepaper2="http://www.mostert.org/3dindepraktijk/afbeeldingen/h4/cedfence.jpg" NAAM_ah_grepaper2="http://frexpaper.com/wp-content/uploads/2013/01/Wood-texture-image.jpg"></house> </houses> --etc... These lines from the file: NAAM_ah_grepaper2="http://www.mostert.org/3dindepraktijk/afbeeldingen/h4/cedfence.jpg" and this line: NAAM_ah_texturename1="http://frexpaper.com/wp-content/uploads/2013/01/Wood-texture-image.jpg" etc.. etc.. My local code of getting line one and further of the xml file. housenumber = 0 root = xmlLoadFile ("homes.xml") local houseHeadRootNode = xmlFindChild (root,"houses",0) local houseRootNode = xmlFindChild (houseHeadRootNode,"house",tonumber(housenumber)) -- don't know how to continue So, how can I get those two lines? Kindly Regards, Danny Edited February 11, 2013 by Guest Sometimes I dream about cheese
Anderl Posted February 9, 2013 Posted February 9, 2013 You can use xmlNodeGetChildren. "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
denny199 Posted February 9, 2013 Author Posted February 9, 2013 I tried different codes, but I still didn't find out why it didn't work: Like: function naamen() housenumber = 0 root = xmlLoadFile ("homes.xml") local houseHeadRootNode = xmlFindChild (root,"houses",0) local houseRootNode = xmlFindChild (houseHeadRootNode,"house",tonumber(housenumber)) for _, shader in ipairs ( xmlNodeGetChildren ( houseRootNode ) ) do local name = xmlNodeGetName ( shader ):gsub ( "NAAM_", "" ) outputChatBox ( name ) end end end addCommandHandler ( "testname", naamen ) But nothing happens... Sometimes I dream about cheese
denny199 Posted February 11, 2013 Author Posted February 11, 2013 Just for the people who are not understanding me: Well, I'm actually trying to make costum texture for houses from a link, so it will save in the xml system where all the houses with info are located for exmaple, I'm choosing ingame the world texture "funturf_bla" then that will save in the xml at the same line at where you are in like this: NAAM_funturf_bla = "texturelinkfromwebsite.com/lol.png" Now I want to get everything behind NAAM_ So After that I can get all the texturelinkfromwebsite.com/lol.png paths etc. So I can import it to a world texture with shaders from a website link. Edit: Sorry for double post. Sometimes I dream about cheese
denny199 Posted February 13, 2013 Author Posted February 13, 2013 bumperdiebumpbump, nobody can help me? or can give my a idea for a new save/load system instead of xml? Sometimes I dream about cheese
Anderl Posted February 13, 2013 Posted February 13, 2013 "houses" is already the root node in the XML file, you don't need to search for it. I would use MySQL or SQLite for that, though. "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
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