Can I execute a txt file from a script? - Printable Version +- Save-Point (https://www.save-point.org) +-- Forum: Games Development (https://www.save-point.org/forum-4.html) +--- Forum: Code Support (https://www.save-point.org/forum-20.html) +--- Thread: Can I execute a txt file from a script? (/thread-318.html) |
Can I execute a txt file from a script? - deValdr - 04-18-2010 If I have a txt file called "Text" in my games data folder. The content of this txt file is: print "hi" How can I execute this text file from an in-editor script? [Resolved] Can I execute a txt file from a script? - Charlie Fleed - 04-18-2010 Try Code: file = File.open("Text", "rb") [Resolved] Can I execute a txt file from a script? - deValdr - 04-18-2010 Thanks a lot. It works ^^ EDIT: when i have a whole class with lots of stuff in the txt document, I get the following error: Syntax error occurred while running script [Resolved] Can I execute a txt file from a script? - vgvgf - 04-18-2010 That's simple, you have syntax error in the text file. Try copying the script from the text file to the RMXP scripts and run the game, then RMXP will tell you where the syntax error is. [Resolved] Can I execute a txt file from a script? - deValdr - 04-18-2010 I tried, but I don't get any errors. So, what I'm trying to do is to have the Scene_Title class in a txt document and load it into the game using the code charlie provided. [Resolved] Can I execute a txt file from a script? - vgvgf - 04-18-2010 Try with this code insteand: Code: file = File.open("Text", "rb") [Resolved] Can I execute a txt file from a script? - deValdr - 04-18-2010 I'm closer now. but It gives me the following error: line 4: cannot convert array into string [Resolved] Can I execute a txt file from a script? - vgvgf - 04-18-2010 Ohh, sorry, I forget a bit of code: Code: file = File.open("Text", "rb") [Resolved] Can I execute a txt file from a script? - deValdr - 04-18-2010 Thank you very much. You have been of great support ^^ |