Latest map name in Save Screen?

Started by AresWarrior, June 29, 2010, 08:43:09 pm

Previous topic - Next topic

AresWarrior

June 29, 2010, 08:43:09 pm Last Edit: June 29, 2010, 08:46:02 pm by AresWarrior
Since there's a way to have the timestamp and playtime, shouldn't there be a way to add the map name too? I don't know exactly what script to add that shows the file's map. $game_map.name doesn't work because that shows the map you are currently on, and not the map that you were on when you saved to the file. Is there a way to show the last map? Thanks.  :)

G_G

try this in a new script
then use $game_map.name
class Game_Map
  def name
    return @map.name
  end
end


However not sure if that'll work, I've seen other methods of doing it

winkio

He is looking for a modification of Window_SaveFile.

AresWarrior

June 30, 2010, 12:48:03 pm #3 Last Edit: June 30, 2010, 01:04:46 pm by AresWarrior
i will try game_guy's script. i think i can add $game_map.name to the draw_text code after inserting his script.  i can modify window_safefile by myself. thanks

edit: i get an error whenever i try to save/load. it says something like "undefined method for 'name'"

G_G

instead of using $game_map try @game_map

ForeverZer0

I just did this for the CMS I made (will release by next week), but you cannot use the global variable ($game_map), because when it reads that variable to display the windows, it will always be the same for every window. You have to use the loaded variable for each specific file. It requires a modification of the what all is loaded from the game file for the save-file windows.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

AresWarrior

idk what i'm doing wrong. i've tried $game_map.name and @game_map.name but still getting the "undefined method for 'name'" error.

ForeverZer0

Quote from: AresWarrior on June 30, 2010, 09:24:27 pm
idk what i'm doing wrong. i've tried $game_map.name and @game_map.name but still getting the "undefined method for 'name'" error.


I'm not sure, but I don't think that "@game_map" is loaded normally just to make the SaveFile Windows, you will have to add it, but I think there other variables that will load first, you might have to have it load some unwanted things jut to be able to access it.

Its hard to explain briefly, but as soon as I get the demo made for my CMS I will release it, and you can see how I did it.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

AresWarrior


AresWarrior

I looked at the demo but I still don't understand how you did it. Can someone explain how? Thanks

ForeverZer0

Quote from: AresWarrior on July 27, 2010, 01:50:12 pm
I looked at the demo but I still don't understand how you did it. Can someone explain how? Thanks


I'll make a demo/tutorial when I get a chance.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

SBR*

July 28, 2010, 05:15:44 am #11 Last Edit: July 29, 2010, 03:20:54 pm by SBR*
Quote from: AresWarrior on July 27, 2010, 01:50:12 pm
I looked at the demo but I still don't understand how you did it. Can someone explain how? Thanks


Look, you load data from an external file using:

VARIABLE = Marshal.load(FILENAME)


Where VARIABLE is the variable and FILENAME is the name of the file, it's a string. FILENAME is 'stored' in a variable in a lot of cases. First you have to open the file, and after it, you have to close it, but that's already done in the Window_SaveFile script, so we just have to load the variable. Please note that the variable should have the same name as the variable in the external file, but it doesn't have to be of the same kind (with 'kind', I mean 'local', 'class', 'instance' or 'global'. Is 'area' the correct term for this? Whatever...). So, go to line 32 of the Window_SaveFile script and add a new line after that line. Now, paste this piece of code in that line:

See EDIT: ShowHide
      @game_map = Marshal.load(file)


file Is the variable that refers to the string with the filename. Now you can access $game_map of that file.

I see you can figure out the rest yourself? :P

EDIT:
      @game_self_switches = Marshal.load(file)
     @game_screen = Marshal.load(file)
     @game_actors = Marshal.load(file)
     @game_party = Marshal.load(file)
     @game_troop = Marshal.load(file)
     @game_map = Marshal.load(file)


All the class variables, except @game_map, could be anything (I think...).

ForeverZer0

Also remember that things must be loaded in the order they were saved.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

SBR*

Quote from: ForeverZero on July 28, 2010, 04:29:04 pm
Also remember that things must be loaded in the order they were saved.


Aha, so that's how it works :P. I'll edit my post.