Stevenn Posted April 6, 2012 Share Posted April 6, 2012 well, I've got a problem i'm trying to set the memo text using a .xml file local Rules = xmlLoadFile ( "xml/rules.xml" ) local Ruless = xmlNodeGetValue ( Rules ) window = guiCreateWindow(462,275,716,474,"",false) Rules = guiCreateButton(13,76,82,35,"Rules",false,window) memo = guiCreateMemo(117,29,582,386,"",false,window) function buttonClick(button) if (button) ~= "left" then return end if (source == Rules) then guiSetText(memo, tostring(Ruless)) end end addEventHandler("onClientGUIClick", resourceRoot, buttonClick, true) the file rules.xml inside the xml folder: <Ruless> My rules here </Ruless> "Bad arguement at line: 2" Link to comment
drk Posted April 6, 2012 Share Posted April 6, 2012 (edited) local rules = xmlLoadFile ( 'xml/rules.xml' ) window = guiCreateWindow(462,275,716,474,"",false) Rules = guiCreateButton(13,76,82,35,"Rules",false,window) memo = guiCreateMemo(117,29,582,386,"",false,window) addEventHandler ( 'onClientGUIClick', root, function ( ) if ( source == Rules ) then guiSetText ( memo, tostring ( xmlNodeGetValue ( rules ) ) ) end end ) Edited April 6, 2012 by Guest Link to comment
Castillo Posted April 6, 2012 Share Posted April 6, 2012 -- script: local Rules = xmlLoadFile ( "xml/rules.xml" ) local Ruless = xmlNodeGetValue ( Rules ) window = guiCreateWindow(462,275,716,474,"",false) Rules = guiCreateButton(13,76,82,35,"Rules",false,window) memo = guiCreateMemo(117,29,582,386,"",false,window) function buttonClick ( button ) if ( button ~= "left" ) then return end if ( source == Rules ) then guiSetText ( memo, tostring ( Ruless ) ) end end addEventHandler ( "onClientGUIClick", resourceRoot, buttonClick ) -- rules.xml My rules here Link to comment
drk Posted April 6, 2012 Share Posted April 6, 2012 (edited) . Edited April 6, 2012 by Guest Link to comment
Stevenn Posted April 6, 2012 Author Share Posted April 6, 2012 Solidsnake14, your code is wrong. nope it works i just forgot to add it into the meta.xml Link to comment
drk Posted April 6, 2012 Share Posted April 6, 2012 Solidsnake14, your code is wrong. nope it works i just forgot to add it into the meta.xml I've seen wrong then. Link to comment
Stevenn Posted April 6, 2012 Author Share Posted April 6, 2012 Solidsnake14, your code is wrong. nope it works i just forgot to add it into the meta.xml I've seen wrong then. actually, mine worked too Link to comment
Castillo Posted April 6, 2012 Share Posted April 6, 2012 Solidsnake14, your code is wrong. It's not wrong, but yours is wrong. I clicked on "Rules" button and it didn't load the text from the XML file. Link to comment
drk Posted April 6, 2012 Share Posted April 6, 2012 Solidsnake14, your code is wrong. It's not wrong, but yours is wrong. I clicked on "Rules" button and it didn't load the text from the XML file. I know, I've seen fast and wrong. Link to comment
Castillo Posted April 6, 2012 Share Posted April 6, 2012 You shouldn't say someone else code is wrong when you haven't even tested it. Link to comment
drk Posted April 6, 2012 Share Posted April 6, 2012 You shouldn't say someone else code is wrong when you haven't even tested it. I need sleep dude Link to comment
Cassandra Posted April 7, 2012 Share Posted April 7, 2012 You shouldn't say someone else code is wrong when you haven't even tested it. I need sleep dude Who's stopping you then? 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