Hey everyone,
I hope this can serve as an introduction as well as my first question to contribute to the RMXP Community.
I am having a problem finding the correct Function and maybe even the correct Syntax to achieve my goal. I am not new to programming or RUBY, but I often get it mixed it with the syntax and functions of other Programming Languages that I know, so this problem is rather embarrassing to admit to lol. :blush:
Question #1, can someone ascertain as to why I am unable to insert escape characters within the sprintf function as I would be able to with the print function in most other OOPLs? I am trying to create the following effects with the following code.
string variable = "Hello"
another_string_variable = "World!"
text = sprintf("%s\n %s", string_variable, another_string_variable)
----->Hello
World!
However, I am given,
----->Hello? World!
with the "?" being placed within a box. Common Sense dictates that the function does understand that I am trying to use an excape character, but it seems as if it doesn't know what to do. Referencing the Ruby Manual, using escape characters is definately possible.
Ultimately, I am using self.contents.draw_text to draw some text within a window. However, since the text is of vast quantity, it must be expressed with multiple lines, and in the practice of good programming, I would like to not have a self.contents.draw_text for every line.
Question #2, can someone give me the syntax to open and read from a text file located in the directory with the rest of the RV Data file? I also can't remember if its possible and/or necessary to define a parameter which will represent the amount of lines to read, as well as which line to start on. Again, this will be used to display vast amounts of text.
Thanks for your help everyone,
Osgiliath
I hope this can serve as an introduction as well as my first question to contribute to the RMXP Community.
I am having a problem finding the correct Function and maybe even the correct Syntax to achieve my goal. I am not new to programming or RUBY, but I often get it mixed it with the syntax and functions of other Programming Languages that I know, so this problem is rather embarrassing to admit to lol. :blush:
Question #1, can someone ascertain as to why I am unable to insert escape characters within the sprintf function as I would be able to with the print function in most other OOPLs? I am trying to create the following effects with the following code.
string variable = "Hello"
another_string_variable = "World!"
text = sprintf("%s\n %s", string_variable, another_string_variable)
----->Hello
World!
However, I am given,
----->Hello? World!
with the "?" being placed within a box. Common Sense dictates that the function does understand that I am trying to use an excape character, but it seems as if it doesn't know what to do. Referencing the Ruby Manual, using escape characters is definately possible.
Ultimately, I am using self.contents.draw_text to draw some text within a window. However, since the text is of vast quantity, it must be expressed with multiple lines, and in the practice of good programming, I would like to not have a self.contents.draw_text for every line.
Question #2, can someone give me the syntax to open and read from a text file located in the directory with the rest of the RV Data file? I also can't remember if its possible and/or necessary to define a parameter which will represent the amount of lines to read, as well as which line to start on. Again, this will be used to display vast amounts of text.
Thanks for your help everyone,
Osgiliath