The RPG Maker Resource Kit

Other Game Creation => Program Troubleshooting => Topic started by: J-Crew on October 31, 2006, 01:16:39 AM

Title: Is it possible?...
Post by: J-Crew on October 31, 2006, 01:16:39 AM
 ??? I was wondering if you could incorperate in-game variables into windows. For example: You want the number that variable #1 equals in a common pop up window. Would you use anything other than the draw_text method? When I tried that, it said it could not convert fixnum to string. Please help. Thanks! ???
Title: Re: Is it possible?...
Post by: Blizzard on October 31, 2006, 05:17:59 PM
You can use $game_variables[X] where X is the ID to refer to variables. And you need to use following syntax for the draw_text:

self.contents.draw_text(x, y, w, h, string, align)
(but you know that already.)

You should also be careful with strings. Numbers are not strings until you "convert" them to such with .to_s

For example:

num = 5
self.contents.draw_text(0, 0, 320, 32, 3.to_s + " - 1 is " + num.to_s)


You will get as output

Quote3 - 1 is 5

But using

num = 5
self.contents.draw_text(0, 0, 320, 32, 2 + " - 1 is " + num)


will result in the same typeerror you just got.
Title: You my friend...are the best
Post by: J-Crew on October 31, 2006, 09:22:29 PM
You my friend ... are the best! I can't thank you enough for the help.