设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 107|回复: 0

[转载发布] Gump::Core Script [Version 1.07]

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9071

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    58883
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    68848

    灌水之王

    发表于 2026-8-2 08:57:14 | 显示全部楼层 |阅读模式
    Script:Gump::Core Script

    Version: 1.07 / 1.02 (core/time)

    Author: Matt 'Gump' Sully

    Description: This is my core script which will be required for some of my script releases. It has some basic built in functions and methods including resolution change support, audio controls, a color dictionary and a built in time system. Some scripters may find this core script useful to use with their own scripts. Check the script header for more details.

    In the near future, this topic will contain a list of all scripts that require it. If you make a script that requires Gump::Core, PM me so I may add it to the list.

    Script:

    Spoiler#===============================================================================# * Gump::Core Script## * VERSION: #           Core / Time#           1.07 / 1.02## * AUTHOR: Matt 'Gump' Sully#-------------------------------------------------------------# Description:# > This is my core script, which will be required for some of my script releases.# > Pay attention to what version of the core script is required by other scripts.#-------------------------------------------------------------# Information:# > This script provides some essential functions.# > Support for game resolution setting (320x240 to 640x480)# > Built in simple Time system that comes with a full calculated Calendar # > Built in Color object dictionary with easy calling ability# > Various built in functions for playing, saving, handling audio bgm/se/etc#-------------------------------------------------------------# > Scripters may find some of the functions of this core script useful in their# own scripts. You are free to use Gump::Core with any of your own scripts. You# are not required to provide credit if you do so.# > Game developers with no scripting experience may find the resolution tweak# a little useful, but should only use this script if another script they are # using requires Gump::Core in order to work.#-------------------------------------------------------------# * LEGAL TERMS# > You may freely use this script in any free or commercial game# > You may freely use this script in conjunction with development of your own# scripts.# > You may freely re-link, re-upload this script if used in conjunction with# one of your own scripts.# > If you use this script in a game or otherwise release it, providing credit# is NEVER required!#===============================================================================    #---------------------------------------------------------------------------    # * Audio Functions    # > Gump::Core.BGM(filename)     #  - Gump::Core.BGM(nil, true, false, false)  = save the current bgm info    #  - Gump::Core.BGM(nil, false, true, false)  = play the last save bgm + pos    #  - Gump::Core.BGM(filename)          = play the bgm specified by filename    # > Gump::Core.SE(filename)    #---------------------------------------------------------------------------    # * Color Functions    # > Use Gump.color(id)    # > to see all the color_id's, scroll down to the dictionary (BELOW the color    # definitions) inside the CB module.    #---------------------------------------------------------------------------    # The script contains many other functions not listed here, such as methods    # for reading and manipulating data in Gump::Time module. Read through the    # script to find and utilize those.    #---------------------------------------------------------------------------#===============================================================================# Initialization of data and stuff, ignore the next two lines.$gumpindex ||= {}; $gumpindex[:core] = [true, 1.07]; $gumpindex[:time] = [true, 1.02]module Gump  #  #==============================================================================  # * SCRIPT MAIN SETTINGS  #===============================================================================  #  # * Enable Gump Time  # > Enables/Disables Gump Time system, time will tick on Scene_Map on every idle  # frame (every frame where the player CAN or is moving)  GUMP_TIME_ENABLED = true  #  # * Resolution resizing  # > changes the games window resolution and available pizels  # > Default VX ACE     : 544x416  # > Maximum Supported  : 640x480  GUMP_Resize_Resolution = true  GUMP_Resolution_Width = 640  GUMP_Resolution_Height = 480  #  #  #=============================================================================  # * END OF SCRIPT MAIN SETTINGS!  # > There are no more settings below this line, but you should probably check  # out whats below especially if you're using this core script to create your  # own scripts.  # > There are also lots of values and stuff that you can modify below.  #===============================================================================  module Core    #---------------------------------------------------------------------------    # *** Gump::Core module methods    #---------------------------------------------------------------------------    @protectorate = false #don't touch this line    #---------------------------------------------------------------------------    # * Initialize Core    # > Init. BGM History, Gump::Core version, window resolution    #---------------------------------------------------------------------------    def self.init_core      return if @protectorate      @bgm_history = {}      @version = $gumpindex[:core][1]      self.modify_window_resolution if Gump::GUMP_Resize_Resolution      @protectorate = true      p "Gump::Core initialized" if $TEST    end        def self.proc      return @protectorate    end    # * Check Script version (for any script/version)    # > For use with scripts that require core or other script functions    def self.check_version(required_version=0, script_symb=:core)      cur = $gumpindex[script_symb][1]      if cur >= required_version        p "$gumpindex #{script_symb} Version Requirement: PASS" if $TEST      else        p "$gumpindex #{script_symb} Version Requirement: FAIL (REQ:#{required_version},  FOUND:#{cur})" if $TEST      end    end        # * Modify Game Window Resolution    def self.modify_window_resolution      Graphics.resize_screen(Gump::GUMP_Resolution_Width, Gump::GUMP_Resolution_Height)    end        #---------------------------------------------------------------------------    # * Audio Functions    # > Gump::Core.BGM(filename)    #  - Gump::Core.BGM(nil, true, false, false)  = save the current bgm info    #  - Gump::Core.BGM(nil, false, true, false)  = play the last save bgm + pos    #  - Gump::Core.BGM(filename)          = play the bgm specified by filename    # > Gump::Core.SE(filename)    #---------------------------------------------------------------------------    def self.BGM(filename, save_last=false, play_last=false, play_new=true, folder='Audio/BGM/', volume=85, pitch=100)      p "Gump::Core.BGM [Error] Missing Filename" if filename == nil && !play_last && play_new      if save_last        lastbgm = RPG::BGM.last        @bgm_history[
    os] = lastbgm.pos        @bgm_history[:filename] = lastbgm.name      end      Audio.bgm_play(folder + filename, volume, pitch) if play_new unless play_last || filename == nil      Audio.bgm_play(folder + @bgm_history[:filename], volume, pitch, @bgm_history[
    os]) if play_last && filename == nil    end        def self.SE(filename, folder='Audio/SE/', volume=90, pitch=100)      p "Gump::Core.SE [Error] Missing Filename" if filename == nil      Audio.se_play(folder + filename, volume, pitch) unless filename == nil    end        #---------------------------------------------------------------------------    # * Time Function    # > Gump::Core.time (returns current full game time data)    #---------------------------------------------------------------------------    def self.time      return Gump::Time.read_time    end            #===========================================================================    # * CB: Color data module    # > readily returns color objects    # > Use Gump.color(id)    # > to see all the color_id's, scroll down to the dictionary (BELOW the color    # definitions).    #===========================================================================    module CB      Colors = {        #----------------------        # * Gump Colors from color base script        #----------------------        
    efault_Outline => Color.new(0, 0, 0, 128),        
    efault_Text => Color.new(255, 255, 255, 255),                 
    hys_Outline => Color.new(192, 192, 192, 158),         :Items_Outline => Color.new(132, 108, 8, 224),        :Exp_Outline => Color.new(4, 4, 116, 232),         :Money_Outline => Color.new(0, 116, 0, 232),        
    rofile => Color.new(216, 216, 255, 255),        :Active_Party => Color.new(216, 216, 255, 128),        :Quest => Color.new(232, 232, 232, 216),        :Emblem => Color.new(255, 226, 128, 152),        :QFeedback_Out => Color.new(192, 192, 192, 192),                :Fire => Color.new(255, 64, 64, 255),        :Ice => Color.new(178, 178, 255, 255),        :Thunder => Color.new(255, 216, 96, 255),        :Thunder2 => Color.new(255, 216, 96, 164),        :Water => Color.new(96, 96, 255, 255),        :Earth => Color.new(80, 255, 80, 255),        :Earth2 => Color.new(80, 255, 80, 164),        
    ark => Color.new(64, 64, 64, 255),                :FullRed => Color.new(255, 0, 0, 255),        :FullGreen => Color.new(0, 255, 0, 255),        :FullBlue => Color.new(0, 0, 255, 255),        :FullYellow => Color.new(255, 255, 0, 255),                :Yellow2 => Color.new(196, 196, 0, 226),        :Green2 => Color.new(0, 196, 0, 226),        #----------------------        # * GTBS Colors by GubiD        #----------------------        :RED => Color.new(255,0,0,255),        :BLUE => Color.new(0,0,255,255),        :GREEN => Color.new(0,255,0,255),        :YELLOW => Color.new(255,255,0,255),        
    URPLE => Color.new(128,0,255,255),        
    RANGE => Color.new(255,128,0,255),        :BROWN => Color.new(128,64,0,255),        :BLACK => Color.new(0,0,0,255),        :WHITE => Color.new(255,255,255,255),        
    INK => Color.new(255,128,255,255),        :TAN => Color.new(200,200,110,255),      }      #=========================================================================      # * COLOR DICTIONARY      # > Use these id's with the Gump::Core::CB.get command to fetch colors.      #=========================================================================      def self.dictionary(id)        case id        when 0; return Color[
    efault_Outline]        when 1; return Color[
    efault_Text]        when 2; return Color[
    hys_Outline]        when 3; return Color[:Items_Outline]        when 4; return Color[:Exp_Outline]        when 5; return Color[:Money_Outline]        when 6; return Color[
    rofile]        when 7; return Color[:Active_Party]        when 8; return Color[:Quest]        when 9; return Color[:Emblem]        when 10; return Color[:QFeedback_Out]        when 11; return Color[:Fire]        when 12; return Color[:Ice]        when 13; return Color[:Thunder]        when 14; return Color[:Thunder2]        when 15; return Color[:Water]        when 16; return Color[:Earth]        when 17; return Color[:Earth2]        when 18; return Color[
    ark]        when 19; return Color[:FullRed]        when 20; return Color[:FullGreen]        when 21; return Color[:FullBlue]        when 22; return Color[:FullYellow]        when 23; return Color[:Yellow2]        when 24; return Color[:Green2]        when 25; return Color[:RED]        when 26; return Color[:BLUE]        when 27; return Color[:GREEN]        when 28; return Color[:YELLOW]        when 29; return Color[
    URPLE]        when 30; return Color[
    RANGE]        when 31; return Color[:BROWN]        when 32; return Color[:BLACK]        when 33; return Color[:WHITE]        when 34; return Color[
    INK]        when 35; return Color[:TAN]        else; return Color[
    efault_Outline]        end      end      def self.get(id)        color = self.dictionary(id)        return color      end    end      end # End for Gump::Core module  #---------------------------------------------------------------------------  # * Color Function  # > Gump.color(id)  # > returns a color object specified by ID number.  #---------------------------------------------------------------------------  def self.color(id)    return Gump::Core::CB.get(id)  endend # End for Gump module #===============================================================================# * Gump::Time Module# > Contains data and functions for a basic time system#===============================================================================module Gump  module Time        # The ID and name of each Month    MONTHS = {        1   =>   "Jan.",        2   =>   "Feb.",        3   =>   "Mar.",        4   =>   "Apr.",        5   =>   "May.",        6   =>   "June",        7   =>   "July",        8   =>   "Aug.",        9   =>   "Sept",        10  =>   "Oct.",        11  =>   "Nov.",        12  =>   "Dec.",            }        # The total DayCount for Each Month    DAY_INDEX = {        1   =>   31,        2   =>   28,        3   =>   31,        4   =>   30,        5   =>   31,        6   =>   30,        7   =>   31,        8   =>   31,        9   =>   30,        10  =>   31,        11  =>   30,        12  =>   31,            }        # The Weekdays ids and names    WEEKDAYS = {        1   => "Sunday",        2   => "Monday",        3   => "Tuesday",        4   => "Wedesday",        5   => "Thursday",        6   => "Friday",        7   => "Saturday",            }        # 0 counts for hours. so if set to '24', daily hours will be '0 to 23'.    Daily_Hours = 24    Hourly_Minutes = 60        Start_Day = 1    Start_Month = 1    Start_Year = 1525    Start_Hour = 5    Start_Minute = 0                def self.initialize      @gametime = {};      self.set_time_phases      @gametime[:day] = Start_Day      @gametime[:month] = Start_Month      @gametime[:year] = Start_Year      @gametime[:hr] = Start_Hour      @gametime[:min] = Start_Minute      @gametime[
    hase] = calculate_starting_phase          end        def self.current_phase      return @gametime[
    hase]    end    def self.calculate_starting_phase      indexes = @phases.keys      values = @phases.values      start_hr = Start_Hour      phase_amount = indexes.size      counter = 0      while counter <= phase_amount        chkary = values[counter]        # rgss3 threw a fit when I tried to put this if statement into a single        # line 'if expr ? true expr : false expr' method. No idea why         if chkary.include?(start_hr)          return indexes[counter]        else          counter += 1        end      end      p "Gump::Time Error: calculate_starting_phase: 404: Phase not found!" if $TEST    end    # data still saves/loads with system disabled via forceread    def self.read_time(forceread=false)      return @gametime unless !Gump::GUMP_TIME_ENABLED      return nil if !Gump::GUMP_TIME_ENABLED unless forceread      return @gametime if forceread     end        def self.set_time_phases      @phases = {}      @phases[0] = [3, 4, 5, 6]      @phases[1] = [7, 8, 9, 10, 11]      @phases[2] = [12, 13, 14, 15, 16, 17, 18]      @phases[3] = [19, 20, 21, 22]      @phases[4] = [23, 0, 1, 2]    end        def self.read_all_phases      return @phases    end    # used by datamanager load and time flow methods    def self.load_time_data(data)      return if data == nil      @gametime = {} if @gametime == nil      @gametime[:day] = data[:day]      @gametime[:month] = data[:month]      @gametime[:year] = data[:year]      @gametime[:hr] = data[:hr]      @gametime[:min] = data[:min]      @gametime[
    hase] = data[
    hase]    end        def self.read_time_data(key)      return false if !@gametime.keys.include?(key)      return nil if !Gump::GUMP_TIME_ENABLED      return @gametime[key]    end        # included so other scripts may use this function if desired    def self.set_time_data(key, data)      return unless @gametime.keys.include?(key)      return nil if !Gump::GUMP_TIME_ENABLED      @gametime[key] = data    end        #===========================================================================    # * Gump::Time::Thread module    # > Used to tick the time forward, called in Scene_Map.    #===========================================================================    module Thread            # Gump::Time::Thread.flow      # - increment time by 1 minute in game world.      def self.flow        return if !Gump::GUMP_TIME_ENABLED        phasechk = false        timedata = Gump::Time.read_time        month = timedata[:month]        monthkeys = Gump::Time::MONTHS.keys        if timedata[:min] < Gump::Time::Hourly_Minutes          timedata[:min] += 1        else          if timedata[:hr] < Gump::Time:
    aily_Hours            timedata[:hr] += 1; timedata[:min] = 0            phasechk = true          else            if timedata[:day] < Gump::Time:
    AY_INDEX[month]              timedata[:day] += 1; timedata[:hr] = 0; timedata[:min] = 0              phasechk = true            else              if timedata[:month] < monthkeys[-1]                timedata[:month] += 1; timedata[:day] = 1; timedata[:hr] = 0; timedata[:min] = 0                phasechk = true              else                timedata[:year] += 1; timedata[:month] = 1; timedata[:day] = 1; timedata[:hr] = 0; timedata[:min] = 0                phasechk = true              end            end          end        end        phase = self.calculate_current_phase(timedata) if phasechk        timedata[
    hase] = phase if phasechk        Gump::Time.load_time_data(timedata)      end      def self.calculate_current_phase(timedata)        phs = Gump::Time.read_all_phases        indexes = phs.keys        values = phs.values        current_hr = timedata[:hr]        phase_amount = indexes.size        counter = 0        while counter <= phase_amount          chkary = values[counter]          if chkary.include?(current_hr)            return indexes[counter]          else            counter += 1          end        end        p "Gump::Time::Thread Error: calculate_current_phase: 404: Phase not found!" if $TEST      end    end # End for Gump::Time::Thread  end  end#==============================================================================## * MODIFIED DEFAULT (VXACE CORE) SCRIPTS                                      |# > DataManager              > Scene_Base                                      |# > Scene_Map                                                                  |# > Game_Party                                                                 |#==============================================================================##===============================================================================# * DataManager# > Aliased methods: 3#===============================================================================module DataManager  class << self    alias :gumpcore_create_game_objects_43fh80    :create_game_objects    alias :gumpcore_make_save_contents_784tyh0    :make_save_contents    alias :gumpcore_extract_save_contents_4389    :extract_save_contents  end    def self.create_game_objects    self.gumpcore_create_game_objects_43fh80    # Dont need this method yet but probably will soon.  end    def self.make_save_contents    $game_party.update_gumpcore_time_records    self.gumpcore_make_save_contents_784tyh0  end    def self.extract_save_contents(contents)    self.gumpcore_extract_save_contents_4389(contents)    Gump::Time.load_time_data($game_party.gumpcore_time)  end  end#===============================================================================# * Game_Party# > Added methods: 1#===============================================================================class Game_Party < Game_Unit  attr_accessor :gumpcore_time  #-------------------------------  # * New Method  #-------------------------------  def update_gumpcore_time_records    @gumpcore_time = Gump::Core.time  endend#===============================================================================# Gump.initialize_gamedata# * Put all relevant initalize commands in here, alias in other scripts#===============================================================================module Gump  def self.initialize_gamedata    Gump::Core.init_core if $gumpindex[:core][0]    Gump::Time.initialize if $gumpindex[:time][0]  endend#===============================================================================# Scene_Base# > Aliased methods: 1# > If you're wondering why I used scene base, its to ensure initialization when# the first scene runs, regardless of what the scene is in your game. Other option# was to modify first_scene_class but I think this works out to be more passive.#===============================================================================class Scene_Base  alias :gump_start_core_rfy0320y :start  def start(*args)    gump_start_core_rfy0320y    Gump.initialize_gamedata unless Gump::Core.proc  endend#===============================================================================# * Scene_Map# > Aliased methods: 1# > Added methods: 1#===============================================================================class Scene_Map < Scene_Base  alias :gumpcore_update_scene_43ty04     :update_scene  def update_scene(*args)    gumpcore_update_scene_43ty04    gump_time_count if Gump::GUMP_TIME_ENABLED  end  def gump_time_count    @framecount = 0 if @framecount.nil?; @framecount += 1    if @framecount >= 60      Gump::Time::Thread.flow      @framecount = 0    end  endend 



    Version Changelog:

    ===========================================

    Version 1.07: - KFC is really good build

    [NEW] - Added function Gump.color(id) which is a shortcut for Gump::Core::CB.get(id). This function returns a color object based on which id you feed it. Check the script for the full list of avaialble color id's.

    [NEW] - Added missing logic to Gump::Time::Thread.flow. It will now properly iterate the time based on script settings.

    [NEW] - Added logic for phase initialization, and logic for phase changing to Gump::Time. Phases are now properly handled automatically and very open ended.

    [MOD][/MOD][MOD] - Fixed a couple bugs I found along the way. This version is a lot more stable. Also added some error comments that will only print if your game is in test mode.

    ===========================================

    Legal Terms of Use:

    > You may freely use this script in any free or commercial game

    > You may freely use this script in conjunction with development of your ownscripts.

    > You may freely re-link, re-upload this script if used in conjunction with one of your own scripts.

    > If you use this script in a game or otherwise release it, providing credit is NEVER required![/mod]


    本贴来自国际rpgmaker官方论坛作者:Gump处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/gump-core-script-version-1-07.20575/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-17 12:42 , Processed in 0.155759 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表