RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Variables in scripts

0 Members and 1 Guest are viewing this topic.

**
Rep:
Level 86
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.

******
Revolution is not a bed of roses.
Rep:
Level 91
Project of the Month winner for July 2009
This isn't a calculator. Play around with the numbers, and you'll understand how it works.

***
Rep:
Level 90
Skilled Scripter, Shitty Mapper, Decent Writer.
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:
Code: [Select]
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.

**
Rep:
Level 86
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.