Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Text Help

Star

Sponsor

Here I go. I'm at it again :box: Another stump in the mud..

Here's my problem. I'm trying to create text to appear icons to tell you which inventory you're about to select. The problem isn't getting the text to appear. It's more like getting rid of the old text. You see.. I either end up having the same text everywhere. Or all the text adds up together. When I try disposing it I get the "Bitmap gone error" of course.

I even ended up getting RGSS has encountered a problem and must close XD

Never seen that before..

Well here's what I'm trying to do
Code:
 

case @selector_position

 

when 1  # on all items

 

text = "All Items"

@selector_position_window.contents.draw_text(0, 40, 120, 32, text, 0)

@selector_position_window.x = 250

 

when 2 # on recovery items

 

text = "Recovery"

@selector_position_window.contents.draw_text(0, 40, 120, 32, text, 0)

@selector_position_window.x = 290

 

when 3 # on Food items

 

text = "Food"

@selector_position_window.contents.draw_text(0, 40, 120, 32, text, 0)

@selector_position_window.x = 340

 

#  and so on........................

 
If I do it this way I end up with all the text jumbling up as I increase in index

Code:
 

case @selector_position

 

when 1  # on all items

 

text = "All Items"

@selector_position_window.contents.draw_text(0, 40, 120, 32, text, 0)

@selector_position_window.x = 250

 

when 2 # on recovery items

 

text = "Recovery"

@selector_position_window.x = 290

 

when 3 # on Food items

 

text = "Food"

@selector_position_window.x = 340

 

#  and so on........................

 
if I do it this way I end up with all text being "all items"

I've tried disposing the previous text with a @selector_position_window.self.contents.dispose and met with a savage error of mass carnage.

Please help me oh masters of scripting, so that I, grasshopper, may attain more knowledge.

:angel:
 

Star

Sponsor

Atoa":190qwbnj said:
instead of "dispose" ou can try "clear" the contens always before drawing the text.


@selector_position_window.contents.clear
You're epic. :box: Score one for Atoa! I'm one step closer to being a good scripter. I think :down:
 
StarGGundam2":210vlc1d said:
Atoa":210vlc1d said:
instead of "dispose" ou can try "clear" the contens always before drawing the text.


@selector_position_window.contents.clear
You're epic. :box: Score one for Atoa! I'm one step closer to being a good scripter. I think :down:

The best step you can take is searching through both the default scripts and the help file. That's because there are a lot of useful pieces of information there.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top