function on_xml_read() RegisterScriptCallback("on_xml_read", function(xml_file_name, xml_obj) -- XML file i want to change local xml_to_change = [[gameplay\dialogs.xml]] -- Check if its the file i want to change if xml_file_name == xml_to_change then -- Here is my code to change XML local barter_dialog = [[ st_barter_init 1 dialogs.st_trader_dialog_reply barter_ui.start ]] xml_obj:insertFromXMLString(barter_dialog) end end) end