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.

Map Name

Status
Not open for further replies.

OS

Sponsor

Sorry, but I forgot how to check a map name for '[text_here]'.
IF anyone could show me how, I would much appreciate it. Also, how would I delete this text after checking it, so that the Map Name could be seen without this extra text? Keep in mind that I do not want to delete this text permenently (becuase the player will come back to the map that is checked, and if the text is deleted, my script won't run on the map!)

Peace!
 
I don't quite understand what you're getting at, but you can store the current map name into a variable as a string by using a Script command and entering this:

Code:
$game_variables[1] = $game_map.name

This will store the current map's name into variable 1. Then, if you wanted to show it in a text box, you just have to enter \V[1] to display the variable's contents in the message box. You can make it any variable number you want, of course.

(Edit) Oh now I see, when I replied initially I could have sworn this was in the general support board - maybe it got moved - so I was thinking something more basic.
 
I think he's talking about like how the Mode7 works. You add [#] to the end of the map name, where # is some number, and Mode7 reads it to figure out how it needs to modify that map. I don't know how to do it either, I'm afraid.
 

OS

Sponsor

Thanks for replying. I didn't realize $game_map.name existed, I thought I had to add that myself, but didn't know where the name would come from...(i r not think :|)

I shall resume work! Thankee. Peace!

EDIT: I still need to know how to check the string for specific text, and how to clear it from view while on that map. Make sense? I don't care all that much about the latter part, but I absolutely need the specific text checking!

Peace!
 
I still don't know why people do this. Its an old style of coding that is actually pretty bad for compatability. What if some other script uses map name or something?

It's better to make a constant with map ids in all honestly.

Code:
class Game_Map
  Name_Your_Constant = [map_id, ...]
end

No needs to read the map name, modify it, etc. I actually suggest making a module and putting your constant in that to add even more compatability, but its up to you.
 
Even better, i think they should put dummy map events for each map that they want the system to work on. Like, in every map will/may have an event named Config, and so in its contents they should hold all the configuration for that map. Oh, just an idea... ^^

BTW, just to not make it so off-topic, here´s my solution:
Code:
class Game_Map
  attr_reader :name
  alias aliasing_old_init initialize
  def initialize
    aliasing_old_init
    @name = ""
  end

  alias aliasing_old_setup setup
  def setup(map_id)
    aliasing_old_setup(map_id)
    @mapinfos = load_data("Data/MapInfos.rxdata")
    @name = @mapinfos[@map_id].name
    @name.gsub!(/\[.*\]/, '')
  end
end
It should be easier if i knew exactly which kind of characters your scripts requires you to put on map names. In this case i just covered the Mode07 characters (the [#] thing).

And oh, i haven´t tested it yet, so use at your own risk. Just copy/paste it above main. To check map´s name, use
Code:
$game_map.name
That´s it. ^^
 

OS

Sponsor

I have decided to use an array or a Hash. I hate setting it up, but I guess having an efficient script is worth it! My Random Weather Generator is becoming a very large script, and this may make it a little bit larger (I'll need to add for loops...), but I guess I might as well do it...

Peace!
 
Status
Not open for further replies.

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