RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Wat is wrong with this

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 89
Quote
#==============================================================================
# ** Triple Triad (Part 4 - The Default Modifications)
#==============================================================================
# SephirothSpawn
# Version 1
# 2006-04-30
#------------------------------------------------------------------------------
# * Outline:
#  ~ Triple Triad 1 : Triple Triad Data Structure
#  ~ Triple Triad 2 : Triple Triad Windows
#  ~ Triple Triad 3 : Triple Triad Scenes
#  ~ Triple Triad 4 : Default Class Modification
#  ~ Expansions : Players, Booster Packs & Decks Expansion Packs
#------------------------------------------------------------------------------
# * Part 4
#
#  ~ Input             Adds Keyboard Keys To Constants
#  ~ Bitmap            Adds Scale Blt Function
#  ~ Game_Player       Adds Battle Start Processing
#  ~ Window_Base       Adds Draw Animated Actor Function
#  ~ Scene_Title       Adds Triple Triad Data & Session Data
#  ~ Scene_Save        Saves Triple Triad Session Data
#  ~ Scene_Load        Loads Triple Triad Session Data
#  ~ RPG::Cache        Adds Triple Triad Graphics Folder
#  ~ Array             Adds Sum Function
#  ~ Hash              Adds Max Function
#  ~ String            Adds Pop Function
#==============================================================================

#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log('Triple Triad', 'SephirothSpawn', 1, '2006-04-30')

#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.state('Triple Triad') == true
 
#==============================================================================
# ** Input Module Expansion
#------------------------------------------------------------------------------
# Created By Near Fantastica & Wachunga
#==============================================================================

module Input
  #--------------------------------------------------------------------------
  Back = 8
  Shift = 16
  Ctrl = 17
  Alt = 18
  Esc = 27
  Space = 32
  Numberpad = (33..40).to_a + [12, 45]
  Numbers = (48..57).to_a
  Letters = (65..90).to_a
  FKeys = (112..123).to_a
  Collon = 186
  Equal = 187
  Comma = 188
  Underscore = 189
  Dot = 190
  Backslash = 191
  LB = 219
  RB = 221
  Enter = 13
  Quote = 222
  #--------------------------------------------------------------------------
  def Input.getstate(key)
    unless Win32API.new("user32","GetKeyState",['i'],'i').call(key).between?(0, 1)
      return true
    end
    return false
  end
  #--------------------------------------------------------------------------
  def Input.get_direction
    for key in Numberpad
      if Input.getstate(key)
        case key
        when 45 ; return "0" # Same As Insert
        when 33 ; return "9" # Same As Page Up
        when 34 ; return "3" # Same As Page Down
        when 35 ; return "1" # Same As Page End
        when 36 ; return "7" # Same As Page Home
        when 37 ; return "4" # Same As Left
        when 38 ; return "8" # Same As Up
        when 39 ; return "6" # Same As Right
        when 40 ; return "2" # Same As Down
        when 12 ; return "5"
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  def Input.get_function
    if Input.getstate(Back)
      return 'Back'
    elsif Input.getstate(Backslash)
      return '/'
    elsif Input.getstate(Esc)
      return 'Esc'
    elsif Input.getstate(Ctrl)
      return 'Ctrl'
    elsif Input.getstate(Alt)
      return 'Alt'
    end
    for key in FKeys
      if Input.getstate(key)
        num = key - 111
        return 'F' + num.to_s
      end
    end
    return nil
  end
  #--------------------------------------------------------------------------
  def Input.get_letters
    for key in Letters
      if Input.getstate(key)
        return (Input.getstate(Shift) ? key.chr.upcase : key.chr.downcase)
      end
    end
    return nil
  end
  #--------------------------------------------------------------------------
  def Input.get_numbers
    return nil if Input.getstate(Shift)
    for key in Numbers
      if Input.getstate(key)
        return key.chr
      end
    end
    return nil
  end
  #--------------------------------------------------------------------------
  def Input.get_key
    if Input.getstate(Space)
      return ' '
    elsif Input.getstate(Backslash) and Input.getstate(Shift)
      return '?'
    elsif Input.getstate(LB)
      return (Input.getstate(Shift) ? '{' : '[')
    elsif Input.getstate(RB)
      return (Input.getstate(Shift) ? '}' : ']')
    elsif Input.getstate(Comma)
      return (Input.getstate(Shift) ? '<' : ',')
    elsif Input.getstate(Dot)
      return (Input.getstate(Shift) ? '>' : '.')
    elsif Input.getstate(Collon)
      return (Input.getstate(Shift) ? ':' : ';')
    elsif Input.getstate(Equal)
      return (Input.getstate(Shift) ? '+' : '=')
    elsif Input.getstate(Underscore)
      return (Input.getstate(Shift) ? '_' : '-')
    elsif Input.getstate(Quote)
      return (Input.getstate(Shift) ? "\"" : "'")
    end
    for key in Numbers
      if Input.getstate(key) and Input.getstate(Shift)
        case key
        when 48 ; return ')'
        when 49 ; return '!'
        when 50 ; return '@'
        when 51 ; return '#'
        when 52 ; return '$'
        when 53 ; return '%'
        when 54 ; return '^'
        when 55 ; return '&'
        when 56 ; return '*'
        when 57 ; return '('
        end
      end
    end
    return nil
  end
end

#==============================================================================
# ** Bitmap
#==============================================================================

class Bitmap
  #--------------------------------------------------------------------------
  # * Scale Blt
  #--------------------------------------------------------------------------
  def scale_blt(dest_rect, src_bitmap, src_rect =
    Rect.new(0, 0, src_bitmap.width, src_bitmap.height), opacity = 255)
    w, h = src_rect.width, src_rect.height
    scale = [w / dest_rect.width.to_f, h / dest_rect.height.to_f].max
    ow, oh = (w / scale).to_i, (h / scale).to_i
    ox, oy = (dest_rect.width - ow) / 2, (dest_rect.height - oh) / 2
    stretch_blt(Rect.new(ox + dest_rect.x, oy + dest_rect.y, ow, oh),
      src_bitmap, src_rect )
  end
end

#===========================================================================
# ** Game_Player
#===========================================================================
class Game_Player < Game_Character
  #-------------------------------------------------------------------------
  # * Alias Listings
  #-------------------------------------------------------------------------
  alias seph_tripletriad_gmplyr_uat update_action_trigger
  #--------------------------------------------------------------------------
  # * Update Action Trigger
  #--------------------------------------------------------------------------
  def update_action_trigger
    # If Battle Start Button Pressed
    if Input.trigger?(TripleTriad::Constants::Battle_Button)
      return if check_triad_player
    end
    # Original Update Action Trigger
    seph_tripletriad_gmplyr_uat
  end
  #--------------------------------------------------------------------------
  # * Check Triad Player
  #--------------------------------------------------------------------------
  def check_triad_player
    # Calculate front event coordinates
    new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
    new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
    # Check Each Event
    for event in $game_map.events.values
      if event.x == new_x && event.y == new_y
        for i in 0...event.list.size
          # Checks Event Command Code
          if event.list.code == 108
            # Checks For 'Triple Triad Player'
            if event.list.parameters[0].include?('Triple Triad Player')
              # Stores Player ID
              event.list.parameters[0].dup.gsub!(/(\d+)/, '')
              # Opens Triad Profile Window In Map Scene
              $scene.start_triad_battle($1.to_i)
              return true
            end
          end
        end
      end
    end
    return false
  end
end

#==============================================================================
# ** Window_Base
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # * Draw Sprite
  #--------------------------------------------------------------------------
  def draw_sprite(x, y, w, h, name, hue, stance = 0)
    # Gets Frame
    frame = (Graphics.frame_count / (Graphics.frame_rate / 4)) % 4
    # Gets Bitmap
    bitmap = RPG::Cache.character(name, hue)
    # Bitmap Division
    cw, ch = bitmap.width / 4,  bitmap.height / 4
    # Gets Animation Offsets
    x_off, y_off = cw * frame, ch * stance
    # Clears Area
    self.contents.fill_rect(Rect.new(x, y, w, h), Color.new(0, 0, 0, 0))
    # Draws Bitmap
    self.contents.scale_blt(Rect.new(x, y, w, h), bitmap, Rect.new(x_off, y_off, cw, ch))
  end
end

#===========================================================================
# ** Scene Title
#===========================================================================
class Scene_Title
  #------------------------------------------------------------------------
  # * Alias Listing
  #------------------------------------------------------------------------
  alias seph_tripletriad_scenetitle_md main_database
  alias seph_tripletriad_scenetitle_cng command_new_game
  #------------------------------------------------------------------------
  # * Main Database Processing
  #------------------------------------------------------------------------
  def main_database
    # Orginal Main Database
     seph_tripletriad_scenetitle_md
    # Creates Triple Triad Data
    tripletriad_data_main
  end
  #------------------------------------------------------------------------
  # * Command : New Game
  #------------------------------------------------------------------------
  def command_new_game
    # Orginal Command : New Game
    seph_tripletriad_scenetitle_cng
    # Creates Triple Triad Information
    $game_tripletriad = TripleTriad::Game_TripleTriad.new
    # Creates Triple Triad Battle Information
    $game_tripletriad_battle = TripleTriad::Game_TriadBattle.new
    # Creates Opponent Information
    tripletriad_players_main
    # Gives All NPC Players Starting Cards
    for i in 1...$game_tripletriad.players.size
      5.times do
        $game_tripletriad.players.gain_earnable_cards
      end
    end
  end
  #------------------------------------------------------------------------
  # * Adds Triple Triad Data
  #------------------------------------------------------------------------
  def tripletriad_data_main
    # Creates Triple Triad Decks
    $data_tripletriad_decks = []
    tripletriad_decks_main
    # Creates Triple Triad Booster Packs
    $data_tripletriad_boosters = []
    tripletriad_boosters_main
  end
  #------------------------------------------------------------------------
  # * Triple Triad Data : Opponents
  #------------------------------------------------------------------------
  def tripletriad_players_main
    # See Expansion Packs
  end
  #--------------------------------------------------------------------------
  # * Triple Triad Data : Decks
  #--------------------------------------------------------------------------
  def tripletriad_decks_main
    # See Expansion Packs
  end
  #--------------------------------------------------------------------------
  # * Triple Triad Data : Boosters
  #--------------------------------------------------------------------------
  def tripletriad_boosters_main
    # See Expansion Packs
  end
end

#==============================================================================
# ** Scene_Save
#==============================================================================
class Scene_Save < Scene_File
  #--------------------------------------------------------------------------
  # * Alias Save Data
  #--------------------------------------------------------------------------
  alias seph_tripletriad_scenesave_wd write_data
  #--------------------------------------------------------------------------
  # * Write Save Data
  #--------------------------------------------------------------------------
  def write_data(file)
    # Orginal Write Save Data Method
    seph_tripletriad_scenesave_wd(file)
    # Dumps Triple Triad Information
    Marshal.dump($game_tripletriad, file)
    Marshal.dump($game_tripletriad_battle, file)
  end
end

#==============================================================================
# ** Scene_Load
#==============================================================================
class Scene_Load < Scene_File
  #--------------------------------------------------------------------------
  # * Alias Read Save Data
  #--------------------------------------------------------------------------
  alias seph_tripletriad_sceneload_rd read_data
  #--------------------------------------------------------------------------
  # * Read Save Data
  #--------------------------------------------------------------------------
  def read_data(file)
    # Orginal Read Save Data Method
    seph_tripletriad_sceneload_rd(file)
    # Loads Triple Triad Information
    $game_tripletriad = Marshal.load(file)
    $game_tripletriad_battle = Marshal.load(file)
  end
end

#===========================================================================
# ** Scene_Map
#===========================================================================
class Scene_Map
  #------------------------------------------------------------------------
  # * Alias' Listing
  #------------------------------------------------------------------------
  alias seph_tripletriad_scnmap_update update
  #-------------------------------------------------------------------------
  # * Frame Update
  #-------------------------------------------------------------------------
  def update
    # If Triple Triad Encounter Window Exist
    unless @tt_encounter_window.nil?
      update_triple_triad_encounter
      return
    end
    # Original Update Method
    seph_tripletriad_scnmap_update
  end
  #-------------------------------------------------------------------------
  # * Frame Update : TT Encounter
  #-------------------------------------------------------------------------
  def update_triple_triad_encounter
    # Update Map, Interpreter, Spriteset & Screen
    $game_map.update
    $game_system.map_interpreter.update
    $game_system.update
    $game_screen.update
    @spriteset.update
    # Update Triple Triad Encounter Window
    @tt_encounter_window.update
    # If B Button Is Pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Delete Encounter Window
      @tt_encounter_window.dispose
      @tt_encounter_window = nil
      return
    end
    # If C Button is Pressed
    if Input.trigger?(Input::C)
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # If You Can't Play
      unless @tt_encounter_window.can_play
        # Delete Encounter Window
        @tt_encounter_window.dispose
        @tt_encounter_window = nil
        return
      end
      # Check Index
      case @tt_encounter_window.index
      when 0 # Start Battle
        # Memorize map BGM and stop BGM
        $game_temp.map_bgm = $game_system.playing_bgm
        $game_system.bgm_stop
        # Play card battle start SE
        $game_system.se_play(TripleTriad::Constants::BattleStart_SE)
        # Play card battle BGM
        $game_system.bgm_play(TripleTriad::Constants::BattleStart_BGM)
        # Proceed To Triple Triad Battle Scene
        $game_tripletriad_battle.setup(@tt_encounter_window.player_id)
        $scene = TripleTriad::Scenes::CardBattle.new
      when 1 # Return to Map
        # Delete Encounter Window
        @tt_encounter_window.dispose
        @tt_encounter_window = nil
      end
    end
  end
  #-------------------------------------------------------------------------
  # * Start Triad Battle
  #-------------------------------------------------------------------------
  def start_triad_battle(id)
    # Plays decision SE
    $game_system.se_play($data_system.decision_se)
    # Creates Triple Triad Encounter Window
    @tt_encounter_window = TripleTriad::Windows::BattleEncounter.new(id)
  end
end

#==============================================================================
# ** Interpreter
#==============================================================================

class Interpreter
  #--------------------------------------------------------------------------
  # * Open Triad Main
  #--------------------------------------------------------------------------
  def open_triad_main(animation = true)
    $scene = TripleTriad::Scenes::Main.new(0, animation, $scene.class)
  end
  #--------------------------------------------------------------------------
  # * Open Triad Profile
  #--------------------------------------------------------------------------
  def open_triad_profile(animation = true)
    $scene = TripleTriad::Scenes::Profile.new(animation)
  end
  #--------------------------------------------------------------------------
  # * Open Triad View Cards
  #--------------------------------------------------------------------------
  def open_triad_viewcards(deck_index = 0)
    $scene = TripleTriad::Scenes::ViewCards.new(deck_index)
  end
  #--------------------------------------------------------------------------
  # * Open Triad Shop
  #--------------------------------------------------------------------------
  def open_triad_shop(animation = true)
    $scene = TripleTriad::Scenes::Shop.new(animation)
  end
  #--------------------------------------------------------------------------
  # * Open Triad Database
  #--------------------------------------------------------------------------
  def open_triad_database
    $scene = TripleTriad::Scenes::Database.new
  end
  #--------------------------------------------------------------------------
  # * Open Triad Tutorial
  #--------------------------------------------------------------------------
  def open_triad_tutorial
    $scene = TripleTriad::Scenes::Tutorial.new
  end
  #--------------------------------------------------------------------------
  # * Gain Triad Card
  #  ~ c_index : Card Index within Level
  #  ~ l_index : Level Index within Deck
  #  ~ d_index : Deck Index from Deck List
  #--------------------------------------------------------------------------
  def gain_triad_card(c_index, l_index = 0, d_index = 0)
    # Gets Deck
    deck = $data_tripletriad_decks[d_index]
    # Gets Card
    card = deck.cards[l_index][c_index]
    # Gains Card
    $game_tripletriad.gain_card(d_index, l_index, c_index)
    # Plays Capture SE
    $game_system.se_play(TripleTriad::Constants::Capture_SE)
    # Displays Message Window
    last_p = @parameters[0]
    @parameters[0]="#{TripleTriad::Constants::Gain_Card_Text} #{card.name}!"
    command_101
    @parameters[0] = last_p
  end
  #--------------------------------------------------------------------------
  # * Gain Triads
  #  ~ amount : amount of triads to earn
  #--------------------------------------------------------------------------
  def gain_triads(amount = 0)
    # Gains Triads
    $game_tripletriad.triads +=amount
    # Plays Capture SE
    $game_system.se_play(TripleTriad::Constants::Capture_SE)
    # Show Text
    # Displays Message Window
    last_p = @parameters[0]
    @parameters[0]="You Earned #{amount} #{TripleTriad::Constants::Triad_Currency}"
    command_101
    @parameters[0] = last_p
  end
end

#===========================================================================
# ** Cache
#---------------------------------------------------------------------------
# Adds New Graphics Folder (Graphics/Triple Triad)
#===========================================================================
module RPG::Cache
  #------------------------------------------------------------------------
  # * Triple Triad Images
  #------------------------------------------------------------------------
  def self.triple_triad(filename)
    self.load_bitmap('Graphics/Triple Triad/', filename)
  end
end

#==============================================================================
# ** Array
#==============================================================================
class Array
  #--------------------------------------------------------------------------
  # * Sum
  #--------------------------------------------------------------------------
  def sum
    n = 0
    for i in self
      n += i if i.is_a?(Fixnum)
    end
    return n
  end
end

#==============================================================================
# ** Hash
#==============================================================================
class Hash
  #--------------------------------------------------------------------------
  # * Max
  #--------------------------------------------------------------------------
  def max
    max = self.values.max
    return index(max), max
  end
end

#==============================================================================
# ** String
#==============================================================================
class String
  #--------------------------------------------------------------------------
  # * Removes Last Character
  #--------------------------------------------------------------------------
  def pop
    return unless self.size > 0
    self.slice!((self.size - 1)...self.size)
  end
end

#------------------------------------------------------------------------------
# * End SDK Enable Test
#------------------------------------------------------------------------------
end


this is part of SEPIROTH SPAWNS triple triad game
i have put all the neccersary scripts in and i get an ERROR saying ?????'Triple Triad 4' / 282 ??? SystemStackError ????????

stack level too deep
I thought i was being attacked by ninjas yesterday but then i realised it was angry muslim protestors so i stole there veils and strapped myself to a C4 and gave them a taste of there own curry flavoured medicine

********
EXA
Rep:
Level 92
Pikachu on a toilet
Project of the Month winner for April 2007
Either you have it twice or you have some methods twice in your entire scripts. Find all the lines in that script that say "alias SOMETHING" and use CTRL+SHIFT+F to find the methods in any script that have the same name. If you get two results of one of these you most probably have found the cause of the problem. Don't forget to backup your Scripts.rxdata before doing so (it's in the Data folder).
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.


Get DropBox, the best free file syncing service there is!