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.
Simple Map Screenshot

0 Members and 1 Guest are viewing this topic.

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
Simple Map Screenshot
Version: 1.0
Author: cozziekuns, Zeus91
Date: September 5th, 2011

Version History


  • <Version 1.0> 2011.05.09 - Original Release

Planned Future Versions

  • Will look into adding support for events and characters.

Description


This script allows you to take a screenshot of a whole map, depending on the map id. The screenshot will not include the characters.

Features

  • Configurable screenshot key
  • Changable path for where you want to save the screenshot
  • Can force a screenshot from Scene_Map.

Instructions

See script. This script requires my Tilemap to Bitmap Converter.

Script


Code: [Select]
#
# This script requires my Tilemap to Bitmap Converter, which can be found at:
# http://pastebin.com/raw.php?i=Jmqcn5rq
#
#===============================================================================
# Simple Map Screenshot
#-------------------------------------------------------------------------------
# Version: 1.0
# Author: cozziekuns (rmrk)
# Last Date Updated: 9/5/2011
#===============================================================================
# Description:
#-------------------------------------------------------------------------------
# This script allows you to take a screenshot of a whole map, depending on the
# map id. The screenshot will not include the characters.
#===============================================================================
# Updates
# ------------------------------------------------------------------------------
# o 9/5/2011 - Started Script.
#===============================================================================
# To-do List
#-------------------------------------------------------------------------------
# o May include support for characters and events.
#===============================================================================
# Instructions
#-------------------------------------------------------------------------------
# Copy and paste this script above Main Process but below Materials. Change the
# modules as you wish.
#
# You can force a screenshot on the current map by using an event script call
# (split into three lines).
#
# id = $game_map.map_id
# b = $game_system.tilemap_to_bitmap(id)
# $scene.take_tilemap_screenshot(b)
#
# Scripters can force a screenshot from Scene_Map by using method
# take_tilemap_screenshot($game_system.tilemap_to_bitmap(map_id)), where map_id
# is the id of the map you want to force a screenshot of.
#===============================================================================

module COZZIEKUNS
 
  module MAP_SCREENSHOT
   
    SCREENSHOT_BUTTON = Input::F5
    SCREENSHOT_PATH = "Tilemap" # What the screenshot saves as
   
  end

end

#=============================================================================
# ** Bitmap Export by Zeus81
#=============================================================================

class Bitmap
 
  RtlMoveMemory_pi = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')
  RtlMoveMemory_ip = Win32API.new('kernel32', 'RtlMoveMemory', 'ipi', 'i')
 
  def address
    RtlMoveMemory_pi.call(a = "\0" * 4, __id__ * 2 + 16, 4)
    RtlMoveMemory_pi.call(a, a.unpack('L')[0] + 8, 4)
    RtlMoveMemory_pi.call(a, a.unpack('L')[0] + 16, 4)
    a.unpack('L')[0]
  end
 
  def make_png(filename)
    file = File.open(filename, 'wb')
   
    def file.write_chunk(chunk)
      write([chunk.size-4].pack('N'))
      write(chunk)
      write([Zlib.crc32(chunk)].pack('N'))
    end
   
    file.write("\211PNG\r\n\32\n")
    file.write_chunk("IHDR#{[width,height,8,6,0,0,0].pack('N2C5')}")
    RtlMoveMemory_pi.call(data="\0"*(width*height*4), address, data.size)
    (width*height).times {|i| data[i<<=2,3] = data[i,3].reverse!}
    deflate, null_char, w4 = Zlib::Deflate.new(9), "\0", width*4
    (height-1).downto(0) {|i| deflate << null_char << data[i*w4,w4]}
    file.write_chunk("IDAT#{deflate.finish}")
    deflate.close
    file.write_chunk('IEND')
    file.close
  end
 
end

#==============================================================================
# ** Scene_Map
#==============================================================================

class Scene_Map < Scene_Base
 
  alias coz_terrainzoom_sm_update update
  def update(*args)
    coz_terrainzoom_sm_update(*args)
    if Input.trigger?(COZZIEKUNS::MAP_SCREENSHOT::SCREENSHOT_BUTTON)
      take_tilemap_screenshot($game_system.tilemap_to_bitmap($game_map.map_id)) rescue raise("This script requires Tilemap to Bitmap Convereter, which can be found at http://pastebin.com/raw.php?i=Jmqcn5rq")
    end
  end
 
  def take_tilemap_screenshot(bitmap)
    raise "#{bitmap} is not a bitmap" if not bitmap.is_a?(Bitmap)
    i = 1
    while FileTest.exist?(COZZIEKUNS::MAP_SCREENSHOT::SCREENSHOT_PATH + i.to_s + ".png")
      i += 1
    end
    bitmap.make_png(COZZIEKUNS::MAP_SCREENSHOT::SCREENSHOT_PATH + i.to_s + ".png")
  end
 
end

Credit


  • cozziekuns
  • Zeus91, for the Bitmap Exporter script

Support


Post down below.

Known Compatibility Issues

Will not work with parallax maps.

***
Rep:
Level 69
RESIDENT ADONKADONK
Will it work with SwapXT? Not just compatibility errors, but will it capture the swapped tiles, and not the tiles in the database?

I'm back.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Why not just try it and see?