RPGXP 스크립트
2013.10.01 06:15

Initial Switches and Variables

조회 수 602 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
=begin

 Initial Switches and Variables (aka Autoswitcher 3)
 by PK8
 Created: 5/8/2012
 Modified: -
 ──────────────────────────────────────────────────────────────────────────────
 ■ Table of Contents
   o Author's Notes                                - Line 16-19
   o Introduction                                  - Line 21-22
   o Features                                      - Line 24-26
   o Methods Aliased                               - Line 28-30
   o Changelog                                     - Line 32-45
   o Usage                                         - Line 47-69
 ──────────────────────────────────────────────────────────────────────────────
 ■ Author's Notes
   This version's a major improvement over my last two versions as they offer
   shortcuts in an effort to streamline the process of setting up certain
   variables and switches.
 ──────────────────────────────────────────────────────────────────────────────
 ■ Introduction
   This script allows users to set the initial values of switches and variables.
 ──────────────────────────────────────────────────────────────────────────────
 ■ Features
   Set which switches can turn on / off at the start of your game.
   Set the initial values of any or all variables.
 ──────────────────────────────────────────────────────────────────────────────
 ■ Methods Aliased
   Game_Switches.initialize
   Game_Variables.initialize
 ──────────────────────────────────────────────────────────────────────────────
 ■ Changelog
   v1p  (2/28/2008): My first time making this. It involved creating a scene
                     which users had to edit in which switches and variables
                     to adjust, and a direct edit to Scene_Title. I'm not too
                     proud of it. (I didn't have much knowledge then.)
   v1z  (?/??/????): This came about when I was looking for a better way to
                     do it in SephirothSpawn's old forums. Both Seph and
                     Zeriab provided answers, but Seph's answer appeared
                     a little too complex for me at the time so I chose
                     Zeriab's. Known as "Zeriab's Autoswitcher"
   v2   (7/12/2009): Improves upon the original by adding new switch/variable
                     settings to the script.
   v3   (5/8/2012) : Improves upon v2 by adding new shortcuts to streamline the
                     process of setting up initial switches and variables.
 ──────────────────────────────────────────────────────────────────────────────
 ■ Usage
   Data[key] = value
   * Data represents Switch or Variable
   * key represents the ID of the switch or variable
   * value represents the value of the Switch/Variable ID.
   
   In this version, there are 3 shortcuts you can use besides specifying an ID
   for a variable or switch. That would mean there are 4 ways to set the
   initial values for your switches and variables.
   
     Type      Code Example         Description
     ─────────┬────────────────────────┬───────────────────────────────────────
      Integer │ Data[1] = value        │ Sets new value to a single switch or
              │                        │ variable ID. Example: 1
      Range   │ Data[1..5] = value     │ Sets new value to a range of switch
              │                        │ or variable IDs. Example: 1,2,3,4,5
      Array   │ Data[1,4..6,8] = value │ Sets new value to a group of switch
              │                        │ or variable IDs. Item can be an Integer
              │                        │ or a range. Example: 1,4,5,6,8
      Nil     │ Data[nil] = value      │ Sets new value to all switch or
              │                        │ variable IDs.
     ─────────┴────────────────────────┴───────────────────────────────────────
                                         
=end

module PK8
  class Initial
    #--------------------------------------------------------------------------
    # * Do not modify
    #--------------------------------------------------------------------------
    Switch, Variable = {}, {}
    
    #--------------------------------------------------------------------------
    # * Switch/Variable[id] = value
    # id can be an integer, a range, an array, or nil.
    #--------------------------------------------------------------------------
    Switch[1]     = true
    Variable[1]   = 50

    #--------------------------------------------------------------------------
    # * Do not modify
    #--------------------------------------------------------------------------
    file_ext = "rxdata" # It's just there to make porting easier (I'm lazy).
    
    if Switch.has_key?(nil)
      for i in 1...load_data("Data/System.#{file_ext}").switches.size
        Switch[i] = Switch[nil]
      end
      Switch.delete(nil)
    end
    Switch.each { |k, v|
      if k.is_a?(Range); for i in k; Switch[i] = v; end; Switch.delete(k)
      elsif k.is_a?(Array)
        k.each { | i |
          if i.is_a?(Integer); Switch[i] = v
          elsif i.is_a?(Range); for i2 in i; Switch[i2] = v; end
          end }
        Switch.delete(k)
      end
    }
    if Variable.has_key?(nil)
      for i in 1...load_data("Data/System.#{file_ext}").variables.size
        Variable[i] = Variable[nil]
      end
      Variable.delete(nil)
    end
    Variable.each { |k, v|
      if k.is_a?(Range); for i in k; Variable[i] = v; end; Variable.delete(k)
      elsif k.is_a?(Array)
        k.each { | i |
          if i.is_a?(Integer); Variable[i] = v
          elsif i.is_a?(Range); for i2 in i; Variable[i2] = v; end
          end }
        Variable.delete(k)
      end
    }
  end
end

#==============================================================================
# ** Game_Switches
#------------------------------------------------------------------------------
#  This class handles switches. It's a wrapper for the built-in class "Array."
#  Refer to "$game_switches" for the instance of this class.
#==============================================================================

class Game_Switches
  #--------------------------------------------------------------------------
  # * Do not modify
  #--------------------------------------------------------------------------
  unless method_defined?(:pk8_initialswitches_initialize)
    alias_method(:pk8_initialswitches_initialize, :initialize)
  end
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    pk8_initialswitches_initialize
    PK8::Initial::Switch.each { |k, v| @data[k] = v }
  end
end

#==============================================================================
# ** Game_Variables
#------------------------------------------------------------------------------
#  This class handles variables. It's a wrapper for the built-in class "Array."
#  Refer to "$game_variables" for the instance of this class.
#==============================================================================

class Game_Variables
  #--------------------------------------------------------------------------
  # * Do not modify
  #--------------------------------------------------------------------------
  unless method_defined?(:pk8_initialvariables_initialize)
    alias_method(:pk8_initialvariables_initialize, :initialize)
  end
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    pk8_initialvariables_initialize
    PK8::Initial::Variable.each { |k, v| @data[k] = v }
  end
end
 
게임 시작시 변수의 초기값과 스위치의 on/off 여부를 지정할 수 있는 스크립트입니다
?

  1. Random Dungeon Generator - Random Room

    Date2014.10.11 CategoryRPGVX Ace 스크립트 ByJunkMan Views930 Votes0
    Read More
  2. Random Dungeon Generator - Random Cave

    Date2014.10.08 CategoryRPGVX Ace 스크립트 ByJunkMan Views609 Votes0
    Read More
  3. Multiple HUD

    Date2016.01.12 CategoryRPGMV 플러그인 By러닝은빛 Views2851 Votes1
    Read More
  4. Mouse System Ex 마우스 입력 시스템

    Date2015.10.30 CategoryRPGMV 플러그인 By파란별빛 Views861 Votes0
    Read More
  5. Mog_Battle_hud(MZ버전도 있습니다)

    Date2021.03.05 CategoryRPGMV 플러그인 By스트레이보우 Views1412 Votes0
    Read More
  6. Mog Hunter 스페셜

    Date2015.03.26 CategoryRPGVX Ace 스크립트 By철창노틸 Views764 Votes1
    Read More
  7. MKMV_SaveManager (심플 세이브 & 세이브 슬롯 확장)

    Date2015.10.27 CategoryRPGMV 플러그인 By최빛빛 Views915 Votes1
    Read More
  8. Mirror Area - RPG Maker MV

    Date2017.01.03 CategoryRPGMV 플러그인 By러닝은빛 Views4751 Votes0
    Read More
  9. Menu Music MV (메뉴를 열때 음악을 콘트롤 하는 플러그인)

    Date2015.11.09 CategoryRPGMV 플러그인 By파란별빛 Views966 Votes0
    Read More
  10. MBS - Map Zoom plugin (맵을 확대,축소해주는 플러그인)

    Date2016.01.06 CategoryRPGMV 플러그인 ByHT9MAN Views902 Votes0
    Read More
  11. LuD Script Package

    Date2017.08.16 CategoryRPGVX Ace 스크립트 ByLuD Views1471 Votes0
    Read More
  12. Keyboard Event - RPG Maker MV

    Date2017.01.03 CategoryRPGMV 플러그인 By러닝은빛 Views2084 Votes0
    Read More
  13. Kaus Ultimate Overlay v1.03 (강력레이아웃추가! 빛/포그/파노라마/맵)

    Date2015.11.08 CategoryRPGMV 플러그인 By파란별빛 Views2027 Votes0
    Read More
  14. Item Stream

    Date2016.03.08 CategoryRPGMV 플러그인 By러닝은빛 Views3202 Votes0
    Read More
  15. Initial Switches and Variables

    Date2013.10.01 CategoryRPGXP 스크립트 By Views602 Votes0
    Read More
  16. Icon Inventory and Details Window (인벤토리 아이템을 아이콘으로 보이게)

    Date2016.01.06 CategoryRPGMV 플러그인 Byplam Views908 Votes0
    Read More
  17. Iavra Generic Popup (일정시간 팝업을 띄우는 플러그인)

    Date2015.10.30 CategoryRPGMV 플러그인 By파란별빛 Views825 Votes0
    Read More
  18. HUD (HP, MP, EXP, LEVEL 표시) 화면에 표시해주는 플러그인!

    Date2015.11.07 CategoryRPGMV 플러그인 Bywillmv Views1370 Votes2
    Read More
  19. Hidden Shop Goods (못사는 물건은 아예 숨겨지게 하는 플러그인)

    Date2015.11.09 CategoryRPGMV 플러그인 By파란별빛 Views1039 Votes0
    Read More
  20. HBGames.ORG::Motion Blur

    Date2013.09.27 CategoryRPGXP 스크립트 By죽은노예 Views772 Votes0
    Read More
Board Pagination Prev 1 ... 6 7 8 9 10 11 12 13 14 15 Next
/ 15






[개인정보취급방침] | [이용약관] | [제휴문의] | [후원창구] | [인디사이드연혁]

Copyright © 1999 - 2016 INdiSide.com/(주)씨엘쓰리디 All Rights Reserved.
인디사이드 운영자 : 천무(이지선) | kernys(김원배) | 사신지(김병국)