Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[Resolved]Help? Completely Unknown Error...

Anonymous

Guest

Code:
#==============================================================================
# ** Game_Time
#------------------------------------------------------------------------------
#  This class performs time processing.
#==============================================================================

class Time
  #--------------#
  #Global Methods#
  #--------------#
  attr_accessor   :update
  #---------#
  #Constants#
  #---------#
  # $game_variables   = Value
  Minute              = 1
  Hour                = 2
  Date                = 3
  Month               = 4
  Year                = 5
  Day                 = 6
  Weather_Duration    = 7
  Weather_Power       = 8
  Weather_Type        = 9
  Season              = 10
  # $game_switches    = Value
  Tone_Switch         = 1
  Weather_Switch      = 2
  # Arrays            = Array
  Month_Length        = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
  Spring              = [0, 0, 0, 0, 1, 2, 2, 5, 1,5]
  Summer              = [0, 0, 0, 0, 1, 1, 1, 0, 0,2]
  Fall                = [0, 8, 6, 1, 6, 7, 8, 8, 1,0]
  Winter              = [0, 4, 0, 0, 3, 4, 16, 14, 3]
  Weather_Patterns    = [Spring, Summer, Fall, Winter]
  #---------------------------#
  #Initialization of Variables#
  #---------------------------#
  def initialize
    @time_original = 0
    @time_modulus = 0
  end
  #-----------#
  #Time Update#
  #-----------#
  def update
    @time_original += 1
    if @time_original >= Graphics.framerate
      @time_original = 0
    end
    @time_modulus = @time_original % Graphics.framerate
    add_minutes
    update_tone    if $game_switches[Tone_Switch]    == true
    update_weather if $game_switches[Weather_Switch] == true
    case $game_variables[Month]
    when 0
      $game_variables[Season] = 3
    when 2
      $game_variables[Season] = 0
    when 6
      $game_variables[Season] = 1
    when 9
      $game_variables[Season] = 2
    when 11
      $game_variables[Season] = 3
    end
  end
  #--------#
  #Activity#
  #--------#
  def add_minutes
    if @time_modulus == 0
      $game_variables[Minute] += 1
    end
    correct
  end
  #----------#
  #Correction#
  #----------#
  def correct
    $game_variables[Hour]  += 1 if $game_variables[Minute] >= 60
    $game_variables[Minute] = 0 if $game_variables[Minute] >= 60
    $game_variables[Date]  += 1 if $game_variables[Hour]   >= 24
    $game_variables[Day]   += 1 if $game_variables[Hour]   >= 24
    $game_variables[Hour]   = 0 if $game_variables[Hour]   >= 24
    $game_variables[Day]    = 0 if $game_variables[Day]    >= 7
    $game_variables[Month] += 1 if $game_variables[Date]   >= Month_Length[$game_variables[Month]]
    $game_variables[Date]   = 0 if $game_variables[Date]   >= Month_Length[$game_variables[Month]]
    $game_variables[Year]  += 1 if $game_variables[Month]  >= 12
    $game_variables[Month]  = 0 if $game_variables[Month]  >= 12
  end
  #-----------#
  #Tone Update#
  #-----------#
  def update_tone
    case $game_variables[Hour]
    when 0
      $game_screen.start_tone_change(Tone.new(-187, -187, -136, 0), 10)
    when 1
      $game_screen.start_tone_change(Tone.new(-152, -152, -136, 0), 10)
    when 2
      $game_screen.start_tone_change(Tone.new(-122, -122, -122, 0), 10)
    when 3
      $game_screen.start_tone_change(Tone.new(-51, -85, -85, 0), 10)
    when 4
      $game_screen.start_tone_change(Tone.new(-32, -51, -51, 0), 10)
    when 5
      $game_screen.start_tone_change(Tone.new(-16, -32, -32, 0), 10)
    when 6
      $game_screen.start_tone_change(Tone.new(32, 0, 0, 0), 10)
    when 7
      $game_screen.start_tone_change(Tone.new(16, 0, 0, 0), 10)
    when 8
      $game_screen.start_tone_change(Tone.new(0, 0, 0, 0), 10)
    when 15
      $game_screen.start_tone_change(Tone.new(-32, -32, -32, 0), 10)
    when 16
      $game_screen.start_tone_change(Tone.new(-48, -48, -48, 0), 1)
    when 17
      $game_screen.start_tone_change(Tone.new(-64, -64, -64, 0), 1)
    when 18
      $game_screen.start_tone_change(Tone.new(-80, -80, -72, 0), 1)
    when 19
      $game_screen.start_tone_change(Tone.new(-95, -95, -80, 0), 1)
    when 20
      $game_screen.start_tone_change(Tone.new(-128, -128, -102, 0), 1)
    when 21
      $game_screen.start_tone_change(Tone.new(-152, -152, -128, 0), 1)
    when 22
      $game_screen.start_tone_change(Tone.new(-186, -186, -152, 0), 1)
    end
  end
  #--------------#
  #Weather Update#
  #--------------#
  def update_weather
    $game_variables[Weather_Duration] -= 1 unless $game_variables[Weather_Duration] == 0
    $game_variables[Weather_Power] = rand(50)
    if $game_variables[Weather_Duration] == 0
      $game_variables[Weather_Duration] = rand(64) + 64
      $game_variables[Weather_Type] = rand(@weather_patterns[$game_variables[Season]].size)
      type = Weather_Patterns[$game_variables[Season]][$game_variables[Weather_Type]
      #Comment!
      fifty = 50
      for i in 1...fifty
        case $game_variables[Weather_Power]
        when i
          pouvoir = i
        end
      end
      $game_screen.weather(type, pouvoir, 32)
    end
  end
end
I'm getting a syntax error on line 144, which is
Code:
fifty = 50
WHAT? I'm sorry, but this makes no sense WHATSOEVER to me. Please help me!
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top