[RESOLVED] Font Help!

Started by jcsnider, July 10, 2008, 04:06:32 pm

Previous topic - Next topic

jcsnider

July 10, 2008, 04:06:32 pm Last Edit: July 25, 2008, 04:56:30 pm by Starrodkirby86
I am using this font script...

Spoiler: ShowHide
#==============================================================================
# ¦ Bitmap.draw_text
#------------------------------------------------------------------------------
# Aliases and redefines draw_text so that a shadow is drawn
# Made by Ultimate Jesus
#==============================================================================
class Bitmap
  unless @ja_ta_feito == 1
    alias draw_text_plain draw_text
    @ja_ta_feito = 1
  end
  def draw_text(arg1 = 0, arg2 = 0, arg3 = 0, arg4 = 0, arg5 = 0, arg6 = 0, color=false)
    if arg1.is_a?(Rect)
      x = arg1.x
      y = arg1.y
      width = arg1.width
      height = arg1.height
      string = arg2
      align = arg3
    else
      x = arg1
      y = arg2
      width = arg3
      height = arg4
      string = arg5
      align = arg6
    end
   
    if color == false
      color1 = Color.new(96, 96, 96, 255)
      color2 = Color.new(208, 208, 200, 255)
    else
      color1 = Color.new(255, 255, 255, 255)
      color2 = Color.new(96,96,96,255)
    end
   
    #Outline Text
    self.font.color = color2
    draw_text_plain(x+1, y, width, height, string, align)
    draw_text_plain(x, y+1, width, height, string, align)
    draw_text_plain(x+1, y+1, width, height, string, align)
    draw_text_plain(x+2, y, width, height, string, align)
    draw_text_plain(x, y+2, width, height, string, align)
    draw_text_plain(x+2, y+2, width, height, string, align)
    #Normal Text
    self.font.color = color1
    draw_text_plain(x, y, width, height, string, align)
    draw_text_plain(x, y, width, height, string, align)
  end
end


And ti works fine with everything until I try to make a Battle Process in which you can not escape in... then it gives me an error saying cannot convert nil into string... My only idea is that im using this script

Spoiler: ShowHide
#==============================================================================
# ** Laura's Escape Bar Removal Code (DBS version)
#    by DerVVulfman
#    Version 1.5
#    04-11-07
#
#------------------------------------------------------------------------------
#
#  INTRODUCTION AND BASIC USAGE:
#
#  This script effectively 'replaces' key sections of Scene_Battle that involve
#  the display and use of the Escape bar that appears at the top of the window
#  when combat begins.
#
#  As such, this script should be placed above any other custom script in your
#  system that relates to or edits the battle system in your game, preferrably
#  just below Scene_Debug.
#
#  This, of course, assumes that no 'DIRECT' editing of Scene_Battle's code has
#  been initiated.
#
#
#------------------------------------------------------------------------------
#
#  REGARDING ELADIA'S BATTLE EQUIPMENT MENU:
#  This system  is compatible  with said system.   Both IT and this system uses
#  a modified version of XRXS's Window Module, and the placement of the scripts
#  influences the options position.   If this script is placed 'BELOW' Eladia's
#  script,  then the 'Escape' option  will be below  the 'Equip' option...  and
#  visa versa.
#
#------------------------------------------------------------------------------
#
#  EDITABLES:
#
#  The script alters the command window to accept a fifth command option to re-
#  place the Escape Bar  at the start of each turn.   Also,  it repositions the
#  command window accordingly for the additional option.
#
#  ESCAPE_TEXT:
#     The text that is shown in the fifth option can be altered  by editing the
#     ESCAPE_TEXT constant, right below these instructions.   Most people would
#     probably leave it as 'Escape', but have some fun with it. :)
#
#==============================================================================

# Command Window size controls
$command_height = 160   # Sets how many options are visible (nil auto-resizes)
$command_y_pos  = 160   # Sets the height position (160 is default, nil is auto)

# EDITABLE CONSTANT:
ESCAPE_TEXT     = "Run"  # Text that shows in the command window.

 
#==============================================================================
# ** Scene_Battle (part 1)
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # * Add Escape
  #--------------------------------------------------------------------------
  alias escape_sp1 start_phase1
  def start_phase1
    # Original Call
    escape_sp1
    # Get index of Equip Command
    @escape_actor_command_index = @actor_command_window.height / 32 - 1
    # Add the Equip Command
    @actor_command_window.add_command(ESCAPE_TEXT)
    if $game_temp.battle_can_escape == false
      @actor_command_window.disable_item(@actor_command_window.height / 32 - 1)
    end
  end 
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # If battle event is running
    if $game_system.battle_interpreter.running?
      # Update interpreter
      $game_system.battle_interpreter.update
      # If a battler which is forcing actions doesn't exist
      if $game_temp.forcing_battler == nil
        # If battle event has finished running
        unless $game_system.battle_interpreter.running?
          # Rerun battle event set up if battle continues
          unless judge
          setup_battle_event
          end
        end
        # If not after battle phase
        if @phase != 5
          # Refresh status window
          @status_window.refresh
        end
      end
    end
    # Update system (timer) and screen
    $game_system.update
    $game_screen.update
    # If timer has reached 0
    if $game_system.timer_working and $game_system.timer == 0
      # Abort battle
      $game_temp.battle_abort = true
    end
    # Update windows
    @help_window.update

    @status_window.update
    @message_window.update
    # Update sprite set

    # If transition is processing
    if $game_temp.transition_processing
      # Clear transition processing flag
      $game_temp.transition_processing = false
      # Execute transition
      if $game_temp.transition_name == ""
        Graphics.transition(20)
      else
        Graphics.transition(40, "Graphics/Transitions/" +
        $game_temp.transition_name)
      end
    end
    # If message window is showing
    if $game_temp.message_window_showing
      return
    end
    # If effect is showing
    if @spriteset.effect?
      return
    end
    # If game over
    if $game_temp.gameover
      # Switch to game over screen
      $scene = Scene_Gameover.new
      return
    end
    # If returning to title screen
    if $game_temp.to_title
      # Switch to title screen
      $scene = Scene_Title.new
      return
    end
    # If battle is aborted
    if $game_temp.battle_abort
      # Return to BGM used before battle started
      $game_system.bgm_play($game_temp.map_bgm)
      # Battle ends
      battle_end(1)
      return
    end
    # If waiting
    if @wait_count > 0
      # Decrease wait count
      @wait_count -= 1
      return
    end
    # If battler forcing an action doesn't exist,
    # and battle event is running
    if $game_temp.forcing_battler == nil and
      $game_system.battle_interpreter.running?
      return
    end
    # Branch according to phase
    case @phase
    when 1  # pre-battle phase
      update_phase1
    when 2  # party command phase
      update_phase2
    when 3  # actor command phase
      update_phase3
    when 4  # main phase
      update_phase4
    when 5  # after battle phase
      update_phase5
    end
  end
  #--------------------------------------------------------------------------
  # * Start Party Command Phase
  #--------------------------------------------------------------------------
  def start_phase2
    # Shift to phase 2
    @phase = 2
    # Set actor to non-selecting
    @actor_index = -1
    @active_battler = nil
    # Disable actor command window
    @actor_command_window.active = false
    @actor_command_window.visible = false
    # Clear main phase flag
    $game_temp.battle_main_phase = false
    # Clear all party member actions
    $game_party.clear_actions
    # If impossible to input command
    unless $game_party.inputable?
      # Start main phase
     phase3_next_actor
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (party command phase)
  #--------------------------------------------------------------------------
  def update_phase2
    start_phase3
  end
  #--------------------------------------------------------------------------
  # * Actor Command Window Setup
  #--------------------------------------------------------------------------
  def phase3_setup_command_window
    # Enable actor command window
    @actor_command_window.active = true
    @actor_command_window.visible = true
    # Set actor command window position
    @actor_command_window.x = @actor_index * 160
    # Set index to 0
    @actor_command_window.index = 0
  end
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase : basic command)
  #--------------------------------------------------------------------------
  alias escape_update_phase3_basic_command update_phase3_basic_command
  def update_phase3_basic_command
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Branch by actor command window cursor position
      case @actor_command_window.index
      when @escape_actor_command_index # Escape
        # Play Decision SE
        $game_system.se_play($data_system.decision_se)
        if $game_temp.battle_can_escape == false
          # Play Buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Set action
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 2
        phase3_next_actor   
        return
      end
    end
    # Original Call
    escape_update_phase3_basic_command
  end 
  #--------------------------------------------------------------------------
  # * Start Main Phase
  #--------------------------------------------------------------------------
  def start_phase4
    # Shift to phase 4
    @phase = 4
    # Turn count
    $game_temp.battle_turn += 1
    # Search all battle event pages
    for index in 0...$data_troops[@troop_id].pages.size
      # Get event page
      page = $data_troops[@troop_id].pages[index]
      # If this page span is [turn]
      if page.span == 1
        # Clear action completed flags
        $game_temp.battle_event_flags[index] = false
      end
    end
    # Set actor as unselectable
    @actor_index = -1
    @active_battler = nil
    # Disable actor command window
    @actor_command_window.active = false
    @actor_command_window.visible = false
    # Set main phase flag
    $game_temp.battle_main_phase = true
    # Make enemy action
    for enemy in $game_troop.enemies
      enemy.make_action
    end
    # Make action orders
    make_action_orders
    # Shift to step 1
    @phase4_step = 1
  end
  #--------------------------------------------------------------------------
  # * Make Basic Action Results
  #--------------------------------------------------------------------------
  def make_basic_action_result
    # If attack
    if @active_battler.current_action.basic == 0
      # Set anaimation ID
      @animation1_id = @active_battler.animation1_id
      @animation2_id = @active_battler.animation2_id
      # If action battler is enemy
      if @active_battler.is_a?(Game_Enemy)
      if @active_battler.restriction == 3
        target = $game_troop.random_target_enemy
      elsif @active_battler.restriction == 2
        target = $game_party.random_target_actor
      else
        index = @active_battler.current_action.target_index
        target = $game_party.smooth_target_actor(index)
      end
      end
      # If action battler is actor
      if @active_battler.is_a?(Game_Actor)
      if @active_battler.restriction == 3
        target = $game_party.random_target_actor
      elsif @active_battler.restriction == 2
        target = $game_troop.random_target_enemy
      else
        index = @active_battler.current_action.target_index
        target = $game_troop.smooth_target_enemy(index)
      end
      end
      # Set array of targeted battlers
      @target_battlers = [target]
      # Apply normal attack results
      for target in @target_battlers
      target.attack_effect(@active_battler)
      end
      return
    end
    # If guard
    if @active_battler.current_action.basic == 1
      # Display "Guard" in help window
      @help_window.set_text($data_system.words.guard, 1)
      return
    end
    # If escape
    if @active_battler.is_a?(Game_Enemy) and
       @active_battler.current_action.basic == 2
      # Display "Escape" in help window
      @help_window.set_text("Escape", 1)
      # Escape
      @active_battler.escape
      return
    end
    # If escape (Actor)
    if @active_battler.is_a?(Game_Actor) and
       @active_battler.current_action.basic == 2
      # Escape
      update_phase2_escape
      return
    end   
    # If doing nothing
    if @active_battler.current_action.basic == 3
      # Clear battler being forced into action
      $game_temp.forcing_battler = nil
      # Shift to step 1
      @phase4_step = 1
      return
    end
  end
end

#==============================================================================
# --- XRXS.Command Window Add-On Module ---
#==============================================================================
module XRXS_Window_Command
  #--------------------------------------------------------------------------
  # * Add Command
  #     command  : command text string being added
  #-------------------------------------------------------------------------- 
  def add_command(command)
    #
    # Creates an empty @disabled array when first called.
    #
    @disabled = [] if @disabled.nil?
    if @commands.size != @disabled.size
      for i in 0...@commands.size
        @disabled[i] = false
      end
    end
    #
    # Add Command
    #
    @commands.push(command)
    @disabled.push(false)
    @item_max = @commands.size
    # Position the command window
    if $command_y_pos == nil
      self.y -= 32
    else
      self.y = $command_y_pos
    end
    # Set the command window height
    if $command_height == nil
      self.height += 32
    else
      self.height = $command_height
    end
    self.contents.dispose
    self.contents = nil
    self.contents = Bitmap.new(self.width - 32, @item_max * 32)
    refresh
    for i in 0...@commands.size
      if @disabled[i]
        disable_item(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Disable Item
  #     index : item number 
  #--------------------------------------------------------------------------
  def disable_item(index)
    @disabled = [] if @disabled.nil?
    @disabled[index] = true
    draw_item(index, disabled_color)
  end
  #--------------------------------------------------------------------------
  # * Enable Item
  #     index : item number 
  #--------------------------------------------------------------------------
  def enable_item(index)
    @disabled = [] if @disabled.nil?
    @disabled[index] = false
    draw_item(index, normal_color)
  end
end
class Window_Command < Window_Selectable
  #--------------------------------------------------------------------------
  # ** Include
  #--------------------------------------------------------------------------
  include XRXS_Window_Command
  #--------------------------------------------------------------------------
  # * Disable Item
  #     index : item number 
  #--------------------------------------------------------------------------
  def disable_item(index)
    super
  end
end
#==============================================================================
# --- Edited Copy of Include for SoulRage script ---
#==============================================================================
class Window_Command_Enhanced < Window_Selectable
  #--------------------------------------------------------------------------
  # ** Include
  #--------------------------------------------------------------------------
  include XRXS_Window_Command
  #--------------------------------------------------------------------------
  # * Disable Item
  #     index : item number 
  #--------------------------------------------------------------------------
  def disable_item(index)
    super
  end
end


And it maybe interfering with it.

Will anoyone please help?

Thanks

Aqua

Mmm you should put scripts in code tags.

Anyway!!!
One fix that I know should work is if you use the shadowed text addon from Tons XD
I'd help you with this script, but I'm not a scripter =/

jcsnider

ok ill keep that in mind next time and about the tons... I dont think it is oging ot help because I am already using it lol any other ideas?

Aqua

Wait... if you're using Tons, then why do you need that shadow text script?

jcsnider

Because Tons isnt helping...
Without all the font is white so you cant anything and it still gives me the same error in this line
self.contents.draw_text(rect, @commands[index])


in this section of Windows_Command
 #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #     color : text color
  #--------------------------------------------------------------------------
  def draw_item(index, color)
    self.contents.font.color = color
    rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rect, @commands[index])
  end

Aqua

Ton's Shadowed text should work perfectly fine without error (as long as you don't have the other shadow text script and any other clashing scripts)

Soooo what scripts are you using?

jcsnider

Alot starting with Netplay 1.6.3 then comes A party resizer... then The easy party switcher... then comes Tons... after that there is Laura's Escape Bar Removal Code (DBS version)...  some more party size scripts... the hp and exp slant bars by seph.... and thats about all.

Aqua

Why do you have multiple party scripts?

Wish I could tell you what's wrong, but again, I'm not a scripter...
Hope your issue gets solved

Punn

Have you tried placing the tons of addon at the bottom of the script list?

jcsnider

yes and it still dosn't work

Punn

Then its gotta be SDK, they screw up other scripts.

jcsnider

well I can't take away SDK or else almost everything will stop working... is there any script that I can use to fix it?

Fantasist

Start with the exact error message, what does it say, and when does it happen?

And
QuoteBecause Tons isnt helping...
Without all the font is white so you cant anything and it still gives me the same error in this line


What do you mean Tons isn't helping? Is it not applying a shadow? How is it not working? Because the first script you're using is a shadow text script and you don't need it if you're using Tons.

Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




Blizzard

I think I know what the problem is. It's not with Tons, but with that other script. If it gives an error on the line you gave, the error was most probably caused by a nil value. Remove Tons (or comment it out with =begin and =end at the beginning and the end of the scripts) and try again. As mumerus said, if you are using SDK, it's possible that it messes it up since SDK defines a Horizontal Selection window which is not being fully overriden in that script. Of course those are only guesses. If you can't figure it out, upload your Scripts.rxdata and post a link, I'll check out what's wrong and fix it like the last time.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Nortos

ahh the woes of SDK :P

why using Sephs lagging bars?
Blizz's from Tons are faster and better looking

Blizzard

Lol, true. And with using my RTAB status window hack, you can get a very nice looking status window as well. I fixed jcsnider's problems, BTW. xD
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Nortos

lol Good job Blizz, i remember people always complaining about nil errors into strings
a lot of time was SDK screwing things making it harder, was't SDK or...

Blizzard

Not really. It was the "escape bar removal" script. It assumed that the escape command would always be the last in the actor command window which it wasn't.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.