Ergebnis 1 bis 19 von 19

Thema: Projekt Box (VX): Script Umschreiben - Hilfe gesucht!

  1. #1

    Projekt Box (VX): Script Umschreiben - Hilfe gesucht!

    Hallo Zusammen,

    für mein neustes Projekt möchte ich ein Script benutzen, welches ein Screenshot des aktuellen Spielebildschirms macht.
    Ein passendes habe ich jetzt gefunden, jedoch vermisse ich eine Funktion, die ich dringend brauche.

    Es müsste einfach noch eine Bedinung eingefügt werden, das man das Script mit einem Switch aktivieren bzw. deaktivieren kann!

    "Denn man soll nur an einer bestimmten Stelle im Spiel ein Bild machen können, nicht dauerhaft"

    Das Script ist im folgenden Spoiler. Wenn mir das einer entsprechend Anpassen könnte wäre das wirklich super!
    Kann mich dann nur mit einem Crediteintrag revanchieren




    Ich hoffe dass das nicht so schwer zu machen ist... Aber ich selbst habe vom Scripten keine Ahnung und brauche da dringend Hilfe.
    Die Engine ist RPG Maker VX.


    Viele Grüße
    Memorazer

    Geändert von Memorazer (06.07.2014 um 19:21 Uhr)

  2. #2
    Ich kann es nicht testen, da ich den VX nichtmehr installiert habe, aber das hier sollte funktionieren:
    Code:
    #===============================================================================
    # Screenshot Taker
    # By Jet10985 (Jet)
    # PNG and BMP saving code by: Zeus81
    #===============================================================================
    # This script will allow you to take screenshots of the current gamescreen
    # with the push of a button
    # This script has: 7 customization options.
    #===============================================================================
    # Overwritten Methods:
    # None
    #-------------------------------------------------------------------------------
    # Aliased methods:
    # Graphics: update
    #===============================================================================
    =begin
    Notes:
    
    All screenshots are saved in a folder in the game directory called "Screenshots"
    and they are named sequentially, depending on how many screenshots are in
    the folder already.
    =end
    
    module JetScreenshotTaker
      
      # Do you want to save the screenshot as a .bmp, or a .png?
      # .bmp is basically instant, and is 32-bit but the alpha channel is not
      # compatible with every image editing program.
      # .png is slightly slower but it is usually smaller than the .bmp
      # true is for .png, false if for .bmp
      SAVE_AS_PNG = true
      
      # Which button do you have to press to take a screenshot?
      SCREENSHOT_BUTTON = Input::F5
    
    # Which switch must be active to be able to make a screenshot?
    # If this value is negative then you can always make screenshots.
    SCREENSHOT_SWITCH = 1
      
      # Do you want a pop-up window to appear when a screenshot has been taken?
      # The popup window will display how many seconds it took for the screenshot
      POPUP_SCREENSHOT_WINDOW = false
      
      # Would you like a sound effect played when a screenshot is taken?
      SCREENSHOT_SE = false
      
      # What SE would you like played?
      SCREENSHOT_SE_FILE = "Decision2"
      
      # Do you want to add a "Watermark" or some other image ontop of screenshots?
      WATERMARK = false
      
      # What is the name of the watermark image name?
      # This should be in the Pictures folder
      # Watermark image starts at (0, 0) which is top left, so make the image
      # screen-sized and place the contents accordingly.
      WATERMARK_IMAGE = "Watermark"
      
    end
    
    #===============================================================================
    # DON'T EDIT FURTHER UNLESS YOU KNOW WHAT TO DO.
    #===============================================================================
    
    # Bitmap export v 3.0 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 export(filename)
        jet_file_type = JetScreenshotTaker::SAVE_AS_PNG ? ".png" : ".bmp"
        Dir.mkdir("Highscore") unless File.directory?("Highscore")
        filename = "Highscore/Highscore #{Dir.entries("Highscore").size - 1}#{jet_file_type}"
        file = File.open(filename, 'wb')
        case format=File.extname(filename)
        when '.bmp'
          data, size = String.new, width*height*4
          RtlMoveMemory_ip.call(data.__id__*2+8, [size,address].pack('L2'), 8)
          file.write(['BM',size+54,0,54,40,width,height,1,32,0,size,0,0,0,0].pack('a2L6S2L6'))
          file.write(data)
          RtlMoveMemory_ip.call(data.__id__*2+8, "\0"*8, 8)
        when '.png'
          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')
        when ''; print("Export format missing for '#{filename}'.")
        else     print("Export format '#{format}' not supported.")
        end
        file.close
      end
    end
    
    class << Graphics
      
      alias jet9991_update update unless $@
      def update(*args)
        jet9991_update(*args)
        if Input.trigger?(JetScreenshotTaker::SCREENSHOT_BUTTON) && (SCREENSHOT_SWITCH < 0 || ($game_switches[SCREENSHOT_SWITCH]))
          old_time = Time.now
          f = Graphics.snap_to_bitmap
          if JetScreenshotTaker::WATERMARK
            a = Cache.picture(JetScreenshotTaker::WATERMARK_IMAGE)
            f.blt(0, 0, a, a.rect)
          end
          f.export("Image")
          if JetScreenshotTaker::SCREENSHOT_SE
            RPG::SE.new(JetScreenshotTaker::SCREENSHOT_SE_FILE, 100, 100).play
          end
          if JetScreenshotTaker::POPUP_SCREENSHOT_WINDOW
            time = Time.now
            real_time = (time - old_time)
            elapsed_time = (real_time * 1000.0).to_i / 1000.0
            p "Screenshot taken: #{elapsed_time} seconds"
          end
        end
      end
    end
    Jetzt würde es nurnoch funktionieren wenn der Switch mit ID 1 auf "true" gestellt ist.

    Bitte aber beim nächsten Mal nicht in einem Spoiler, sondern in Code-Tags hochladen, damit die Formatierung nicht verloren geht. So wie es im Moment ist, kann man den Code kaum lesen.

  3. #3
    Hi Cornix,

    danke schonmal, aber ich habs grad getestet und es funktioniert noch nicht...

    Jetzt kann ich gar keine Screenshots mehr machen, ob mit oder ohne Switch aktiviert, da folgende Fehlermeldung auftaucht. Sobald man den Trigger "F5" drückt... Muss ich da denn noch was anpassen??



    Zeile 117:
    Code:
       if Input.trigger?(JetScreenshotTaker::SCREENSHOT_BUTTON) && (SCREENSHOT_SWITCH < 0 || ($game_switches[SCREENSHOT_SWITCH]))
    Habs jetzt auch in Code-Tags hochgeladen.
    Danke für den Hinweis!

    Geändert von Memorazer (06.07.2014 um 19:29 Uhr)

  4. #4
    Ja natürlich, mein Fehler, ich habe nicht gesehen, dass der untere Code-Abschnitt sich in einer anderen Klasse befindet:

    Code:
    #===============================================================================
    # Screenshot Taker
    # By Jet10985 (Jet)
    # PNG and BMP saving code by: Zeus81
    #===============================================================================
    # This script will allow you to take screenshots of the current gamescreen
    # with the push of a button
    # This script has: 7 customization options.
    #===============================================================================
    # Overwritten Methods:
    # None
    #-------------------------------------------------------------------------------
    # Aliased methods:
    # Graphics: update
    #===============================================================================
    =begin
    Notes:
    
    All screenshots are saved in a folder in the game directory called "Screenshots"
    and they are named sequentially, depending on how many screenshots are in
    the folder already.
    =end
    
    module JetScreenshotTaker
      
      # Do you want to save the screenshot as a .bmp, or a .png?
      # .bmp is basically instant, and is 32-bit but the alpha channel is not
      # compatible with every image editing program.
      # .png is slightly slower but it is usually smaller than the .bmp
      # true is for .png, false if for .bmp
      SAVE_AS_PNG = true
      
      # Which button do you have to press to take a screenshot?
      SCREENSHOT_BUTTON = Input::F5
      
      # Do you want a pop-up window to appear when a screenshot has been taken?
      # The popup window will display how many seconds it took for the screenshot
      POPUP_SCREENSHOT_WINDOW = false
      
      # Would you like a sound effect played when a screenshot is taken?
      SCREENSHOT_SE = false
      
      # What SE would you like played?
      SCREENSHOT_SE_FILE = "Decision2"
      
      # Do you want to add a "Watermark" or some other image ontop of screenshots?
      WATERMARK = false
      
      # What is the name of the watermark image name?
      # This should be in the Pictures folder
      # Watermark image starts at (0, 0) which is top left, so make the image
      # screen-sized and place the contents accordingly.
      WATERMARK_IMAGE = "Watermark"
      
    end
    
    #===============================================================================
    # DON'T EDIT FURTHER UNLESS YOU KNOW WHAT TO DO.
    #===============================================================================
    
    # Bitmap export v 3.0 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 export(filename)
        jet_file_type = JetScreenshotTaker::SAVE_AS_PNG ? ".png" : ".bmp"
        Dir.mkdir("Highscore") unless File.directory?("Highscore")
        filename = "Highscore/Highscore #{Dir.entries("Highscore").size - 1}#{jet_file_type}"
        file = File.open(filename, 'wb')
        case format=File.extname(filename)
        when '.bmp'
          data, size = String.new, width*height*4
          RtlMoveMemory_ip.call(data.__id__*2+8, [size,address].pack('L2'), 8)
          file.write(['BM',size+54,0,54,40,width,height,1,32,0,size,0,0,0,0].pack('a2L6S2L6'))
          file.write(data)
          RtlMoveMemory_ip.call(data.__id__*2+8, "\0"*8, 8)
        when '.png'
          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')
        when ''; print("Export format missing for '#{filename}'.")
        else     print("Export format '#{format}' not supported.")
        end
        file.close
      end
    end
    
    class << Graphics
      
      alias jet9991_update update unless $@
      def update(*args)
        jet9991_update(*args)
        if Input.trigger?(JetScreenshotTaker::SCREENSHOT_BUTTON) && (JetScreenshotTaker::SCREENSHOT_SWITCH < 0 || ($game_switches[JetScreenshotTaker::SCREENSHOT_SWITCH]))
          old_time = Time.now
          f = Graphics.snap_to_bitmap
          if JetScreenshotTaker::WATERMARK
            a = Cache.picture(JetScreenshotTaker::WATERMARK_IMAGE)
            f.blt(0, 0, a, a.rect)
          end
          f.export("Image")
          if JetScreenshotTaker::SCREENSHOT_SE
            RPG::SE.new(JetScreenshotTaker::SCREENSHOT_SE_FILE, 100, 100).play
          end
          if JetScreenshotTaker::POPUP_SCREENSHOT_WINDOW
            time = Time.now
            real_time = (time - old_time)
            elapsed_time = (real_time * 1000.0).to_i / 1000.0
            p "Screenshot taken: #{elapsed_time} seconds"
          end
        end
      end
    end
    Versuch es nocheinmal mit dieser minimalen Veränderung.

  5. #5
    @Cornix:
    Vielen, vielen Dank Cornix. Es funktioniert wunderbar

    Du hattest zwar den Switch-Part noch weggelassen, aber das hab ich schnell noch gefixt und nun passts!

    Hier nochmal den Code falls ihn jemand anderes auch benutzen möchte: Credit an Jet, Zeus81 und Cornix

    Code:
    #===============================================================================
    # Screenshot Taker
    # By Jet10985 (Jet)
    # PNG and BMP saving code by: Zeus81
    # Modified by Cornix
    #===============================================================================
    # This script will allow you to take screenshots of the current gamescreen
    # with the push of a button
    # This script has: 7 customization options.
    #===============================================================================
    # Overwritten Methods:
    # None
    #-------------------------------------------------------------------------------
    # Aliased methods:
    # Graphics: update
    #===============================================================================
    =begin
    Notes:
    
    All screenshots are saved in a folder in the game directory called "Screenshots"
    and they are named sequentially, depending on how many screenshots are in
    the folder already.
    =end
    
    module JetScreenshotTaker
      
      # Do you want to save the screenshot as a .bmp, or a .png?
      # .bmp is basically instant, and is 32-bit but the alpha channel is not
      # compatible with every image editing program.
      # .png is slightly slower but it is usually smaller than the .bmp
      # true is for .png, false if for .bmp
      SAVE_AS_PNG = true
      
      # Which button do you have to press to take a screenshot?
      SCREENSHOT_BUTTON = Input::F5
      
      # Which switch must be active to be able to make a screenshot?
      # If this value is negative then you can always make screenshots.
      SCREENSHOT_SWITCH = 35
    
      # Do you want a pop-up window to appear when a screenshot has been taken?
      # The popup window will display how many seconds it took for the screenshot
      POPUP_SCREENSHOT_WINDOW = true
      
      # Would you like a sound effect played when a screenshot is taken?
      SCREENSHOT_SE = false
      
      # What SE would you like played?
      SCREENSHOT_SE_FILE = "Decision2"
      
      # Do you want to add a "Watermark" or some other image ontop of screenshots?
      WATERMARK = false
      
      # What is the name of the watermark image name?
      # This should be in the Pictures folder
      # Watermark image starts at (0, 0) which is top left, so make the image
      # screen-sized and place the contents accordingly.
      WATERMARK_IMAGE = "Watermark"
      
    end
    
    #===============================================================================
    # DON'T EDIT FURTHER UNLESS YOU KNOW WHAT TO DO.
    #===============================================================================
    
    # Bitmap export v 3.0 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 export(filename)
        jet_file_type = JetScreenshotTaker::SAVE_AS_PNG ? ".png" : ".bmp"
        Dir.mkdir("Highscore") unless File.directory?("Highscore")
        filename = "Highscore/Highscore #{Dir.entries("Highscore").size - 1}#{jet_file_type}"
        file = File.open(filename, 'wb')
        case format=File.extname(filename)
        when '.bmp'
          data, size = String.new, width*height*4
          RtlMoveMemory_ip.call(data.__id__*2+8, [size,address].pack('L2'), 8)
          file.write(['BM',size+54,0,54,40,width,height,1,32,0,size,0,0,0,0].pack('a2L6S2L6'))
          file.write(data)
          RtlMoveMemory_ip.call(data.__id__*2+8, "\0"*8, 8)
        when '.png'
          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')
        when ''; print("Export format missing for '#{filename}'.")
        else     print("Export format '#{format}' not supported.")
        end
        file.close
      end
    end
    
    class << Graphics
      
      alias jet9991_update update unless $@
      def update(*args)
        jet9991_update(*args)
        if Input.trigger?(JetScreenshotTaker::SCREENSHOT_BUTTON) && (JetScreenshotTaker::SCREENSHOT_SWITCH < 0 || ($game_switches[JetScreenshotTaker::SCREENSHOT_SWITCH]))
          old_time = Time.now
          f = Graphics.snap_to_bitmap
          if JetScreenshotTaker::WATERMARK
            a = Cache.picture(JetScreenshotTaker::WATERMARK_IMAGE)
            f.blt(0, 0, a, a.rect)
          end
          f.export("Image")
          if JetScreenshotTaker::SCREENSHOT_SE
            RPG::SE.new(JetScreenshotTaker::SCREENSHOT_SE_FILE, 100, 100).play
          end
          if JetScreenshotTaker::POPUP_SCREENSHOT_WINDOW
            time = Time.now
            real_time = (time - old_time)
            elapsed_time = (real_time * 1000.0).to_i / 1000.0
            p "Screenshot taken: #{elapsed_time} seconds"
          end
        end
      end
    end

    Gude Nacht

  6. #6
    Credits sind nicht nötig, das waren 2 Zeilen Code.

  7. #7
    Hallo Zusammen,

    muss das Thema doch nochmal aufgreifen, da ich gerne noch ein paar Dinge umgeschrieben hätte (wenn möglich).
    Es handelt sich um ein Screenshot-Script für mein Highscorebild.

    Die Funktion das man erst nach einem Switch ein Bild machen kann wurde bereits hinzugefügt und nun bräuchte ich
    zum Einen noch die Angabe einer Variablen darin (die sich nach Benutzung immer um 1 erhöht)
    und wenn möglich eine andere Eingabe-Taste für die Screenshot Funktion (derzeit F5) - hätte das gerne
    über die Abfrage eines bestimmten Buchstaben (P).

    Könnte mir hierbei nochmals jemand helfen?
    Hab` halt keinen Plan vom Scripten und hier sind ja fähige Leute unterwegs

    Vorab vielen Dank!

    Hier der Code:

    Code:
    #===============================================================================
    # Screenshot Taker
    # By Jet10985 (Jet)
    # PNG and BMP saving code by: Zeus81
    # Modified by Cornix
    #===============================================================================
    # This script will allow you to take screenshots of the current gamescreen
    # with the push of a button
    # This script has: 7 customization options.
    #===============================================================================
    # Overwritten Methods:
    # None
    #-------------------------------------------------------------------------------
    # Aliased methods:
    # Graphics: update
    #===============================================================================
    =begin
    Notes:
    
    All screenshots are saved in a folder in the game directory called "Screenshots"
    and they are named sequentially, depending on how many screenshots are in
    the folder already.
    =end
    
    module JetScreenshotTaker
      
      # Do you want to save the screenshot as a .bmp, or a .png?
      # .bmp is basically instant, and is 32-bit but the alpha channel is not
      # compatible with every image editing program.
      # .png is slightly slower but it is usually smaller than the .bmp
      # true is for .png, false if for .bmp
      SAVE_AS_PNG = true
      
      # Which button do you have to press to take a screenshot?
      SCREENSHOT_BUTTON = Input::F5
      
      # Which switch must be active to be able to make a screenshot?
      # If this value is negative then you can always make screenshots.
      SCREENSHOT_SWITCH = 35
    
      # Do you want a pop-up window to appear when a screenshot has been taken?
      # The popup window will display how many seconds it took for the screenshot
      POPUP_SCREENSHOT_WINDOW = true
      
      # Would you like a sound effect played when a screenshot is taken?
      SCREENSHOT_SE = false
      
      # What SE would you like played?
      SCREENSHOT_SE_FILE = "Decision2"
      
      # Do you want to add a "Watermark" or some other image ontop of screenshots?
      WATERMARK = false
      
      # What is the name of the watermark image name?
      # This should be in the Pictures folder
      # Watermark image starts at (0, 0) which is top left, so make the image
      # screen-sized and place the contents accordingly.
      WATERMARK_IMAGE = "Watermark"
      
    end
    
    #===============================================================================
    # DON'T EDIT FURTHER UNLESS YOU KNOW WHAT TO DO.
    #===============================================================================
    
    # Bitmap export v 3.0 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 export(filename)
        jet_file_type = JetScreenshotTaker::SAVE_AS_PNG ? ".png" : ".bmp"
        Dir.mkdir("Highscore") unless File.directory?("Highscore")
        filename = "Highscore/Highscore #{Dir.entries("Highscore").size - 1}#{jet_file_type}"
        file = File.open(filename, 'wb')
        case format=File.extname(filename)
        when '.bmp'
          data, size = String.new, width*height*4
          RtlMoveMemory_ip.call(data.__id__*2+8, [size,address].pack('L2'), 8)
          file.write(['BM',size+54,0,54,40,width,height,1,32,0,size,0,0,0,0].pack('a2L6S2L6'))
          file.write(data)
          RtlMoveMemory_ip.call(data.__id__*2+8, "\0"*8, 8)
        when '.png'
          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')
        when ''; print("Export format missing for '#{filename}'.")
        else     print("Export format '#{format}' not supported.")
        end
        file.close
      end
    end
    
    class << Graphics
      
      alias jet9991_update update unless $@
      def update(*args)
        jet9991_update(*args)
        if Input.trigger?(JetScreenshotTaker::SCREENSHOT_BUTTON) && (JetScreenshotTaker::SCREENSHOT_SWITCH < 0 || ($game_switches[JetScreenshotTaker::SCREENSHOT_SWITCH]))
          old_time = Time.now
          f = Graphics.snap_to_bitmap
          if JetScreenshotTaker::WATERMARK
            a = Cache.picture(JetScreenshotTaker::WATERMARK_IMAGE)
            f.blt(0, 0, a, a.rect)
          end
          f.export("Image")
          if JetScreenshotTaker::SCREENSHOT_SE
            RPG::SE.new(JetScreenshotTaker::SCREENSHOT_SE_FILE, 100, 100).play
          end
          if JetScreenshotTaker::POPUP_SCREENSHOT_WINDOW
            time = Time.now
            real_time = (time - old_time)
            elapsed_time = (real_time * 1000.0).to_i / 1000.0
            p "Screenshot taken: #{elapsed_time} seconds"
          end
        end
      end
    end
    .

  8. #8
    Brauche da immer noch Hilfe

    Wie kann ich in einem Script eine Variable angeben die sich +1 erhöht?
    Siehe ein Post höher....

  9. #9
    Wenn du von einer Variablen redest, meinst du dann die "Variablen" wie man sie im GUI des RPG-Makers verwendet, oder meinst du eine normale Ruby variable?
    Ich kenne die genaue Syntax für die Maker Variablen im Ace nicht auswendig. Falls es so wie im RPG-Maker XP ist sollte es in etwa die folgende Form haben:
    Code:
    $game_variables[varID] += 1
    Damit wird die Variable mit der ID "varID" um 1 erhöht. Das könnte natürlich im Ace ein klein wenig anders aussehen, versuch es einmal aus.

    Diese Zeile müsstest du dann nurnoch an die richtige Stelle in deinem Script packen und eine passende ID für die Variable aussuchen.

  10. #10
    Und der Button wird in dieser Zeile festgelegt:

    Code:
    SCREENSHOT_BUTTON = Input::F5
    Musst mal probieren, ob es reicht, das F5 gegen P auszutauschen.

  11. #11
    @Cornix:
    Ähhmmm..., also wie man Variablen im Maker per se einsetzt weiß ich.
    Das was du mir als Ruby variable geschrieben hast scheint dem auch schon recht nah zu kommen was ich brauche.
    Funktioniert nur so leider nicht oder ich habe die falsche Stelle ausgewählt??

    Ich denke ja auch das sowas wie $game_variables[5] += 1 ausreichen müsste, aber irgendwie reicht das nicht...

    Benutze übrigens den oldscoolen VX


    @Kelven:
    Hatte ich schon ausprobiert.
    Ich kann nur auf andere Funktionstasten umstellen würde es aber mit einem Buchstaben bevorzugen...
    Muss man da noch was im Script erweitern??

  12. #12
    Ich glaube das standard Input Script der RPG-Maker erlaubt dir nicht beliebige Tasten zu verwenden. Dafür benötigst du schon ein erweitertes Input Script, welches es im Internet zu finden gibt.

    Zitat Zitat
    Ich denke ja auch das sowas wie $game_variables[5] += 1 ausreichen müsste, aber irgendwie reicht das nicht...
    Falls du einen Fehler erhälst dann schreibe uns doch bitte genau welche Art von Fehlermeldung du gezeigt bekommst. Oder ändert sich einfach nur der Wert der Variable nicht?

  13. #13

  14. #14
    Du sprichst vermutlich eine Variable an, die nicht definiert wurde, d. h. die Zahl in den Klammern liegt über dem Maximalwert der Variablen. Es könnte aber auch sein, dass du dich bei $game_variables verschrieben hast.

  15. #15
    Im RPG-Maker XP und im Ace ist es jeweils:
    Code:
    $game_variables[id] = value
    es würde mich sehr wundern, falls es im VX anders wäre.

    Vielleicht hast du dich wirklich verschrieben, oder aber die Zeile wird zu früh ausgeführt, bevor das Spiel vollständig initialisiert wurde, vielleicht kannst du ja einmal das geänderte Script zeigen damit wir drüber schauen können.

  16. #16
    Hier der Code - Variable unter der Switch-Angabe, ziemlich weit oben!

    Code:
    #===============================================================================
    # Screenshot Taker
    # By Jet10985 (Jet)
    # PNG and BMP saving code by: Zeus81
    # Modified by Cornix
    #===============================================================================
    # This script will allow you to take screenshots of the current gamescreen
    # with the push of a button
    # This script has: 7 customization options.
    #===============================================================================
    # Overwritten Methods:
    # None
    #-------------------------------------------------------------------------------
    # Aliased methods:
    # Graphics: update
    #===============================================================================
    =begin
    Notes:
    
    All screenshots are saved in a folder in the game directory called "Screenshots"
    and they are named sequentially, depending on how many screenshots are in
    the folder already.
    =end
    
    module JetScreenshotTaker
      
      # Do you want to save the screenshot as a .bmp, or a .png?
      # .bmp is basically instant, and is 32-bit but the alpha channel is not
      # compatible with every image editing program.
      # .png is slightly slower but it is usually smaller than the .bmp
      # true is for .png, false if for .bmp
      SAVE_AS_PNG = true
      
      # Which button do you have to press to take a screenshot?
      SCREENSHOT_BUTTON = Input:: F5
      
      # Which switch must be active to be able to make a screenshot?
      # If this value is negative then you can always make screenshots.
      SCREENSHOT_SWITCH = 35
        
        #Variable - TEST - TEST - TEST - TEST - TEST
      $game_variables[1] +=1
      
      # Do you want a pop-up window to appear when a screenshot has been taken?
      # The popup window will display how many seconds it took for the screenshot
      POPUP_SCREENSHOT_WINDOW = false
      
      # Would you like a sound effect played when a screenshot is taken?
      SCREENSHOT_SE = true
      
      # What SE would you like played?
      SCREENSHOT_SE_FILE = "Highscore-Foto"
      
      # Do you want to add a "Watermark" or some other image ontop of screenshots?
      WATERMARK = false
      
      # What is the name of the watermark image name?
      # This should be in the Pictures folder
      # Watermark image starts at (0, 0) which is top left, so make the image
      # screen-sized and place the contents accordingly.
      WATERMARK_IMAGE = "Watermark"
      
    end
    
    #===============================================================================
    # DON'T EDIT FURTHER UNLESS YOU KNOW WHAT TO DO.
    #===============================================================================
    
    # Bitmap export v 3.0 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 export(filename)
        jet_file_type = JetScreenshotTaker::SAVE_AS_PNG ? ".png" : ".bmp"
        Dir.mkdir("Highscore") unless File.directory?("Highscore")
        filename = "Highscore/Highscore #{Dir.entries("Highscore").size - 1}#{jet_file_type}"
        file = File.open(filename, 'wb')
        case format=File.extname(filename)
        when '.bmp'
          data, size = String.new, width*height*4
          RtlMoveMemory_ip.call(data.__id__*2+8, [size,address].pack('L2'), 8)
          file.write(['BM',size+54,0,54,40,width,height,1,32,0,size,0,0,0,0].pack('a2L6S2L6'))
          file.write(data)
          RtlMoveMemory_ip.call(data.__id__*2+8, "\0"*8, 8)
        when '.png'
          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')
        when ''; print("Export format missing for '#{filename}'.")
        else     print("Export format '#{format}' not supported.")
        end
        file.close
      end
    end
    
    class << Graphics
      
      alias jet9991_update update unless $@
      def update(*args)
        jet9991_update(*args)
        if Input.trigger?(JetScreenshotTaker::SCREENSHOT_BUTTON) && (JetScreenshotTaker::SCREENSHOT_SWITCH < 0 || ($game_switches[JetScreenshotTaker::SCREENSHOT_SWITCH]))
          old_time = Time.now
          f = Graphics.snap_to_bitmap
          if JetScreenshotTaker::WATERMARK
            a = Cache.picture(JetScreenshotTaker::WATERMARK_IMAGE)
            f.blt(0, 0, a, a.rect)
          end
          f.export("Image")
          if JetScreenshotTaker::SCREENSHOT_SE
            RPG::SE.new(JetScreenshotTaker::SCREENSHOT_SE_FILE, 100, 100).play
          end
          if JetScreenshotTaker::POPUP_SCREENSHOT_WINDOW
            time = Time.now
            real_time = (time - old_time)
            elapsed_time = (real_time * 1000.0).to_i / 1000.0
            p "Screenshot taken: #{elapsed_time} seconds"
          end
        end
      end
    end

  17. #17
    Ja, das ist an der falschen Stelle.
    Das Problem ist, dass dieser Code ausgeführt wird sobald das Spiel gestartet wird, noch bevor soetwas wie Variablen (die Spielvariablen) überhaupt existieren.

    Wenn du willst, dass die Variable erhöht wird bei jedem Mal, dass ein Screenshot gemacht wird, dann solltest du diese Zeile in die Methode "export" oder, gegebenenfalls, in die "update" Methode der Klasse Graphics schreiben.

  18. #18
    Habe die Variable unter export eingefügt und es funktioniert prima.
    Danke Cornix, hast mich wieder gerettet

    Was die Tastezuordnung betrifft:
    Die F5-Taste werde ich dann erstmal beibehalten, nur ist mir doch noch etwas aufgefallen:
    Man kann ja unter F1 die Einstellungen für verschiedene Tasten ändern (Im aktiven Spiel).
    Wie es scheint wird diese Einstellung nur beim Exportieren des Spiels nicht übernommen!!

    Heißt die Tastenbelegung die z.B. mein Betatester hatte stimmte nicht mit meiner überein.
    Gibt es dazu vielleicht auch ein Script? Weiß nicht ob dieses Problem überhaupt bekannt ist.

    Habe auch schon nach Scripts gesucht, aber durch den aktuellen Ace ist das ziemlich hoffnungslos...

  19. #19
    Ich meine, die Einstellungen über F1 sind quasi die persönlichen Einstellungen des Spielers, nicht die des Entwicklers.

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •