Extra Self Switches

0 Members and 1 Guest are viewing this topic.

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
Extra Self Switches
Version: 1.0
Author: modern algebra
Date: April 6, 2010

Version History


  • <Version 1.0> 04.06.2010 - Original Release

Description


This is just a wrapper to make it easy to create and control more than four self switches of an event.

Features

  • An easy way to create and check self switches.
  • Can use the symbols :on and :off for intuitive control

Instructions

To control the value of any special self switch, you can use this command:
     control_self_switch ("key", value)
       key : the object that you want to use to identify the self switch you are altering. For the sake of consistency, probably better to use capital letters ("E", "F"), but can be anything, even numbers (1, 2)
       value : The easiest way is to use the symbols, :on or :off. You can also use true, to turn ON, or false, to turn OFF.

To later check what the value of a self switch is, use the code:
     self_switch ("key")
       key : the identifier for that self-switch. See line 17.

That will evaluate as the expression Self Switch Key == ON. If you want to check if it is OFF, simply use the code:
     !self_switch ("key")

Script


Code: [Select]
#==============================================================================
#    Extra Self Switches Wrapper
#    Version: 1.0
#    Author: modern algebra (rmrk.net)
#    Date: April 6, 2010
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#    This is just a simple wrapper for making and checking self switches beyond
#   the default four. They will only be accessible through the script event
#   command and conditional branch Script field, however. They will not be able
#   to be controlled through the Control Self Switch event command, or as page
#   conditions
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#    To control the value of any special self switch, you can use this command:
#      control_self_switch ("key", value)
#        key : the object that you want to use to identify the self switch you
#          are altering. For the sake of consistency, probably better to use
#          capital letters ("E", "F"), but can be anything, even numbers (1, 2)
#        value : The easiest way is to use the symbols, :on or :off. You can
#          also use true, to turn ON, or false, to turn OFF.
#
#    To later check what the value of a self switch is, use the code:
#      self_switch ("key")
#        key : the identifier for that self-switch. See line 17.
#      That will evaluate as the expression Self Switch Key == ON. If you want
#     to check if it is OFF, simply use the code:
#      !self_switch ("key")
#==============================================================================

#==============================================================================
# ** Game Interpreter
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - control_self_switch
#==============================================================================

class Game_Interpreter
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Control Self Switch
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def control_self_switch (key, value)
    if value.is_a? (Symbol)
      value = value != :off ? 0 : 1
    elsif value
      value = 0
    end
    @params = [key, value]
    return command_123
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Check Self-Switch
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self_switch (key)
    return @original_event_id > 0 ? $game_self_switches[[@map_id, @original_event_id, key]] : false
  end
end

Credit


  • modern algebra

Thanks

  • Shiro, for the request

Support


Please post here at RMRK.net for support.

Known Compatibility Issues

I didn't take very much care in choosing unique names because I wanted it to be simple to use. Thus, there could potentially be an issue there, but I don't know of any scripts that use the same method names and I don't think it will likely become an issue.


Creative Commons License
This script by modern algebra is licensed under a Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.
« Last Edit: April 07, 2010, 10:11:57 PM by modern algebra »

**
Rep:
Level 81
?????????????
:dreamcast: Pretty cool... :dreamcast:
遠い銀河からのスーパー戦士。
本は、セバスチャンです。
これは強力で、手に負えない。
彼の物理レベルのスキルは驚嘆です。[/b]

**
Rep: +0/-0Level 81
You will die with honor...
May be the most useful script I've seen yet!
Ty modern.


:hammer:



:luigi: :m: