Main Menu
  • Welcome to The RPG Maker Resource Kit.

Variables in scripts

Started by Shadow Eye, March 24, 2008, 10:44:11 PM

0 Members and 1 Guest are viewing this topic.

Shadow Eye

Okay, in my game, I'm using a skill system similar to The Elder Scrolls' style(think RuneScape if you've never played, its close too). I've made a menu to show the skill names and their current levels/exp, but instead of the numbers moving to the left when the place moves up,such as a calculator does, they move to the right. Now, I'm a novice(did I say novice? Try TOTAL NOOB) at scripting, so I have no idea what I did wrong. Here's the line I used to call the variables:

self.contents.draw_text(140, 0, 100, 32, $game_variables[1].to_s)

Now, I think it has something to do with the 'to_s' part, but I wouldn't know what to change it to if it was, so I really need help. If you need anythingelse to further explain the problem, I'll be happy to help. Thanks in advance.

Falcon

This isn't a calculator. Play around with the numbers, and you'll understand how it works.

Shinami

It could have to do with the fact you're not specifying alignment with the draw_text method.

draw_text(x, y, width, height, str, align)
Align is an optional argument that can be specified but it isn't a requirement to be passed on.
Excerpt from the RMXP help book:

Horizontal text is left-aligned by default; set align to 1 to center the text and to 2 to right-align it.
Vertical text is always centered.


Sidenote:to_s is a conversion method that converts something into a string/text.

Shadow Eye

Thanks, that helped a lot! I guess I didn't check the help thorough enough(checked through index and help sections several times, guess I should have used search part...) It works perfectly now.