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.

[Resolved]Displaying current map's name in draw_text command

The title basically explains the jist of it. I'm making a CMS that has a window that displays the name of the map the player is on, but I'm having difficulty figuring out the command.


I ran a search and there was no matches, so if this has been answered already, sorry, feel free to redirect me if you can find it.


What i'm trying in the string section is

RPG::MapInfo.name, even tried adding .to_s to the end, but to no avail. When I put either of these commands in, the in-game window reads "RPG::MapInfo" instead of giving an error.
 
What you're looking for is this:
self.contents.draw_text(x, x, self.contents.width - x, x, $game_map.name.to_s)
just draw text of the
variable $game_map.name (to_s of course) its not RPG::MapInfo (attr won't work you need a global variable)
(note this is ripped off of the cms I use so ignore the other commands and x,x are variables for location)

Hope that helps :thumb:
 
Velocir_X":2g7jh8lg said:
What you're looking for is this:
self.contents.draw_text(x, x, self.contents.width - x, x, $game_map.name.to_s)
just draw text of the
variable $game_map.name (to_s of course) its not RPG::MapInfo (attr won't work you need a global variable)
(note this is ripped off of the cms I use so ignore the other commands and x,x are variables for location)

Hope that helps :thumb:



thanks a ton, i noticed the RPG::MapInfo built-in module had a name method, and didn't even think about looking in the Game_Map section.
 
It might be D:
lemme take a look

EDIT:
For all I know it is D:
But try this:

add these to lines to Game_map
attr_accessor :map_name

and
@map_name = map.name

then try $game_map.name
 
Velocir_X":30uscqui said:
It might be D:
lemme take a look

EDIT:
For all I know it is D:
But try this:

add these to lines to Game_map
attr_accessor :map_name

and
@map_name = map.name

then try $game_map.name

any specific location to add the @map_name = map.name? I added it before the initialize method, right below the attr section, and it's giving me another NoMethodError for map instead of name now.
 
Velocir_X":2i05tv4j said:
It should be below the initialize method in Setup with the rest of the local variables

NameError for map now.

don't worry about it, it's proving to be more trouble than it's worth. Thanks for trying to help though, it's probably something with the SDK or MACL.

i'll leave the topic unresolved in case someone else has an idea of what's wrong.
 
In Game_Map, inside setup, find the line
@map_id = map_id

Add this after it:

[rgss]map_infos = load_data('Data/MapInfos.rxdata')
@name = map_infos[@map_id].name
[/rgss]

also add this before initialize:
[rgss]attr_accessor :name
[/rgss]

Now you can do $game_map.name
 
silver wind":iq9ldqdy said:
In Game_Map, inside setup, find the line
@map_id = map_id

Add this after it:

[rgss]map_infos = load_data('Data/MapInfos.rxdata')
@name = map_infos[@map_id].name
[/rgss]

also add this before initialize:
[rgss]attr_accessor :name
[/rgss]

Now you can do $game_map.name


thanks!
 

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