Gump::Core Script [Version 1.07]

Gump

War Veteran
Veteran
Joined
Mar 14, 2013
Messages
43
Reaction score
10
First Language
English
Primarily Uses
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:

#===============================================================================# * 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[:pos] = 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[:pos]) 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 #---------------------- :Default_Outline => Color.new(0, 0, 0, 128), :Default_Text => Color.new(255, 255, 255, 255), :phys_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), :profile => 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), :Dark => 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), :pURPLE => Color.new(128,0,255,255), :oRANGE => 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), :pINK => 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[:Default_Outline] when 1; return Color[:Default_Text] when 2; return Color[:phys_Outline] when 3; return Color[:Items_Outline] when 4; return Color[:Exp_Outline] when 5; return Color[:Money_Outline] when 6; return Color[:profile] 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[:Dark] 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[:pURPLE] when 30; return Color[:oRANGE] when 31; return Color[:BROWN] when 32; return Color[:BLACK] when 33; return Color[:WHITE] when 34; return Color[:pINK] when 35; return Color[:TAN] else; return Color[:Default_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[:phase] = calculate_starting_phase end def self.current_phase return @gametime[:phase] 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[:phase] = data[:phase] 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::Daily_Hours timedata[:hr] += 1; timedata[:min] = 0 phasechk = true else if timedata[:day] < Gump::Time::DAY_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[:phase] = 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]
 
Last edited by a moderator:

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,042
First Language
French
Primarily Uses
RMMV
Ha pretty cool system But I don't know the utility of the color I am pretty curious is suposed to do what ?
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
It's for use in scripts mostly... basically it just gives you color presets to choose from instead of you having to define your own
 

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,042
First Language
French
Primarily Uses
RMMV
Ho okai thanks Yup I also think is a usefull way for save time in presets
 

Gump

War Veteran
Veteran
Joined
Mar 14, 2013
Messages
43
Reaction score
10
First Language
English
Primarily Uses
Thanks. :) yeah the color dictionary gives you a quick reference for retriving colors instead of having to define your own.

After looking over the script quickly I realized a couple things:

  •  Gump::Time::Thread.flow is incomplete. It adds time properly across all fields but does not save the new time values. This is a simple fix, I just forgot to call a method is all. Core script will be patched for this soon.
  •  The color module is nested too deep and doesn't feel effcient right now. To pull a defined color in the current setup you need to do Gump::Core::CB.get(id). I'm going to nest the CB module directly in the Gump module for the next version so we'll be able to pull colors by using Gump::CB.get(id) which should be a lot easier on the ol' brain.

So a couple minor things to workout before I use this for any of my future scripts.
 
Last edited by a moderator:

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,042
First Language
French
Primarily Uses
RMMV
I have question your core where you play with the time can be set for exemple a graphical clock and calendar? because I working on a special world map script who use Sprite and I wanted to created a nigth  and day system with a special clock who indicated

the time and the day , If nigth or morning e.c.t...

I wonder if  your built in time system can be a good base for my system...
 

Gump

War Veteran
Veteran
Joined
Mar 14, 2013
Messages
43
Reaction score
10
First Language
English
Primarily Uses
I have question your core where you play with the time can be set for exemple a graphical clock and calendar? because I working on a special world map script who use Sprite and I wanted to created a nigth  and day system with a special clock who indicated

the time and the day , If nigth or morning e.c.t...

I wonder if  your built in time system can be a good base for my system...
Yes, its a good base for this idea. All the handling is there. If you want to use this core script to build a nice calendar system wait for me to release 1.07 because the thread function is incomplete. It was unintentional, a release bug. My idea of time handling within the core script is to provide time processing. So its the "core" functions of a time system if you will. I'm planning to use this to create an enviromental time + climate system which will require the core script. So yeah. You can make a script using the built in time functions. I just recommend you wait for 1.07 version, which I will have up today. :)

Edit: The method Gump.time will return the full current time data. Time ticks via frame updates from scene_map. Every 60 idle frames = 1 second. The thread method is broken in 1.06 though, as I mentioned above.

Edit2: I should also mention (and I will include this in script comments soon) that the provided Time system backend in this core script is very flexable. You can add or remove months, weekdays, month lengths (via day_index), all that stuff. You can manipulate the data avaialble in the time system pretty much any way concievable and it will work. :) Its programmed to be as open ended as possible.
 
Last edited by a moderator:

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,042
First Language
French
Primarily Uses
RMMV
Ho thanks I waiting with impatience the next version!
 

Gump

War Veteran
Veteran
Joined
Mar 14, 2013
Messages
43
Reaction score
10
First Language
English
Primarily Uses
New version is up. Origonal Post has been updated and now has the new version. :)

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.[/mod]
 
Last edited by a moderator:

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,660
Reaction score
563
First Language
English
Primarily Uses
RMVXA
Formatting fixed
Works but I'm not 100% sure all is good.
Code:
#===============================================================================
# * 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[:pos] = 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[:pos]) 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
    #---------------------- 
    :Default_Outline => Color.new(0, 0, 0, 128), 
    :Default_Text => Color.new(255, 255, 255, 255), 
    :phys_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), 
    :profile => 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), 
    :Dark => 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), 
    :pURPLE => Color.new(128,0,255,255), 
    :oRANGE => 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), 
    :pINK => 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[:Default_Outline]
        when 1; return Color[:Default_Text]
        when 2; return Color[:phys_Outline]
        when 3; return Color[:Items_Outline]
        when 4; return Color[:Exp_Outline]
        when 5; return Color[:Money_Outline]
        when 6; return Color[:profile]
        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[:Dark]
        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[:pURPLE]
        when 30; return Color[:oRANGE]
        when 31; return Color[:BROWN]
        when 32; return Color[:BLACK]
        when 33; return Color[:WHITE]
        when 34; return Color[:pINK]
        when 35; return Color[:TAN]
        else; return Color[:Default_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)
  end
end
# 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[:phase] = calculate_starting_phase
  end
  def self.current_phase
    return @gametime[:phase]
  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[:phase] = data[:phase]
  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::Daily_Hours
        timedata[:hr] += 1;
        timedata[:min] = 0
        phasechk = true
      else
      if timedata[:day] < Gump::Time::DAY_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[:phase] = 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
  end
end
#===============================================================================
# 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]
  end
end
#===============================================================================
# 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
  end
end
#===============================================================================
# * 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
  end
end
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,847
Messages
1,016,972
Members
137,561
Latest member
JaCrispy85
Top