[VX ACE] [SOLVED] Help Yami - Change Turn Battle

Hi guys !!!

I have a little problem in the battle interface with the Yami script that shows the order of battle, I found it here, but here it is to make it easier :

Spoiler
Code:
#==============================================================================
#
# ▼ Yami Engine Symphony - Charge Turn Battle Add-on
# -- Script: Order Gauge
# -- Last Updated: 2012.07.04
# -- Level: Normal
# -- Requires: n/a
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YES-CTBOrderGauge"] = true

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.07.04 - Started and Finished Script.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script provides a visual for Turn Order of CTB.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below YES - Battle CTB but above ▼ Main. Remember to save.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
# This script only works with YES - Battle CTB.
#
#==============================================================================

module YES
  module CTB
 
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Order Gauge Settings -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # These settings are adjusted for the Order Gauge of CTB.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    ORDER_GAUGE = { # Start.
      :pending        =>  10,  # Number of Pending Turns on Order Gauge.
      # Order Gauge Position.
      :x              =>  580,
      :y              =>  60,
      # Order Gauge Type.
      :type           =>  :vertical, # :horizontal for horizontal Gauge.
                                       # :vertical for vertical Gauge.
    } # End.
 
  end # CTB
end # YES

#==============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================

#==============================================================================
# ■ Cache
#==============================================================================

module Cache
 
  #--------------------------------------------------------------------------
  # new method: ctb
  #--------------------------------------------------------------------------
  def self.ctb(filename)
    begin
      load_bitmap("Graphics/CTB/", filename)
    rescue
      empty_bitmap
    end
  end
 
end # Cache

#==============================================================================
# ■ YES::CTB
#==============================================================================

module YES
  module CTB
    SPRITE_WIDTH = Cache.ctb("BGActor").width
    SPRITE_HEIGHT = Cache.ctb("BGEnemy").height
    RECT = Rect.new(0, 0, SPRITE_WIDTH, SPRITE_HEIGHT)
  end
end

#==============================================================================
# ■ BattleControl
#==============================================================================

module BattleControl
 
  #--------------------------------------------------------------------------
  # new method: ctb_ct
  #--------------------------------------------------------------------------
  def self.ctb_ct
    result = @ctb_ct.dup
    result
  end
 
  #--------------------------------------------------------------------------
  # new method: ctb_temp_ct
  #--------------------------------------------------------------------------
  def self.ctb_temp_ct
    result = @ctb_temp_ct.dup
    result
  end
 
  #--------------------------------------------------------------------------
  # new method: ctb_time
  #--------------------------------------------------------------------------
  def self.ctb_time(battler, real_ct)
    return 0 if real_ct >= @threshold
    return ((@threshold - real_ct) / battler.agi).ceil
  end
 
end # BattleControl

#==============================================================================
# ■ Window_OrderCTB
#==============================================================================

class Window_OrderCTB < Window_Base
 
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize
    x = YES::CTB::ORDER_GAUGE[:x]
    y = YES::CTB::ORDER_GAUGE[:y]
    super(x, y, Graphics.width, Graphics.height)
    self.opacity = 0
    @data = []
    @battlers = []
  end
 
  #--------------------------------------------------------------------------
  # item_rect
  #--------------------------------------------------------------------------
  def item_rect(index)
    width = YES::CTB::SPRITE_WIDTH
    height = YES::CTB::SPRITE_HEIGHT
    x = YES::CTB::ORDER_GAUGE[:type] == :horizontal ? (YES::CTB::ORDER_GAUGE[:pending] - index - 1) * width : 0
    y = YES::CTB::ORDER_GAUGE[:type] == :vertical ? index * height : 0
    x += (width.to_f / 4).floor if index == 0
    rect = Rect.new(x, y, width, height)
    rect
  end
 
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    filter_battlers
    get_data
    contents.clear
    #---
    for i in 0...YES::CTB::ORDER_GAUGE[:pending]
      draw_item(i)
    end
  end
 
  #--------------------------------------------------------------------------
  # draw_item
  #--------------------------------------------------------------------------
  def draw_item(index)
    contents.font.size = 16
    contents.font.color.set(Color.new(255,255,255))
    contents.font.out_color = Color.new(0,0,0)
    data = @data[index]
    rect = item_rect(index)
    #---
    border = data[0].actor? ? "BorderActor" : "BorderEnemy"
    #---
    if data[0].actor?
      bg = "BGActor"
      letter = ""
    else
      bg = "BGEnemy"
      letter = data[0].letter
    end
    #---
    face = data[0].actor? ? data[0].name : data[0].enemy.name
    #---
    contents.blt(rect.x, rect.y, Cache.ctb(bg), YES::CTB::RECT)
    contents.blt(rect.x, rect.y, Cache.ctb(face), YES::CTB::RECT)
    contents.blt(rect.x, rect.y, Cache.ctb(border), YES::CTB::RECT)
    #---
    rect.x += 2
    rect.y += 7
    draw_text(rect, letter, 2)
  end
 
  #--------------------------------------------------------------------------
  # filter_battlers
  #--------------------------------------------------------------------------
  def filter_battlers
    BattleControl.ctb_fix_ct
    @battlers.clear
    ($game_party.battle_members + $game_troop.members).each { |battler|
      next unless battler.movable?
      @battlers.push(battler)
    }
  end
 
  #--------------------------------------------------------------------------
  # filter_battlers
  #--------------------------------------------------------------------------
  def sort_battlers
    @battlers.sort! { |a, b|
      if BattleControl.ctb_time(a, @ct[a.name]) != BattleControl.ctb_time(b, @ct[b.name])
        BattleControl.ctb_time(a, @ct[a.name]) <=> BattleControl.ctb_time(b, @ct[b.name])
      elsif (@ct[a.name] + BattleControl.ctb_time(a, @ct[a.name]) * a.agi) != (@ct[b.name] + BattleControl.ctb_time(b, @ct[b.name]) * b.agi)
        (@ct[b.name] + BattleControl.ctb_time(b, @ct[b.name]) * b.agi) <=> (@ct[a.name] + BattleControl.ctb_time(a, @ct[a.name]) * a.agi)
      else
        a.screen_x <=> b.screen_x
      end
    }
  end
 
  #--------------------------------------------------------------------------
  # get_data
  #--------------------------------------------------------------------------
  def get_data
    @ct = BattleControl.ctb_ct
    @temp_ct = BattleControl.ctb_temp_ct
    @data.clear
    #---
    active_battler = BattleControl.ctb_active_battlers[0]
    if active_battler
      @data.push([active_battler, @ct[active_battler.name]])
      if @temp_ct.has_key?(active_battler.name)
        @ct[active_battler.name] -= @temp_ct[active_battler.name]
      else
        @ct[active_battler.name] -= BattleControl.ctb_evaluate_ct(active_battler, nil)
      end
    end
    #---
    while @data.size < YES::CTB::ORDER_GAUGE[:pending]
      sort_battlers
      battler = @battlers[0]
      @data.push([battler, @ct[battler.name]])
      @ct[battler.name] -= BattleControl.ctb_evaluate_ct(battler, nil)
    end
  end
 
end # Window_OrderCTB

#==============================================================================
# ■ Scene_Battle
#==============================================================================

class Scene_Battle < Scene_Base
 
  #--------------------------------------------------------------------------
  # alias method: update_basic
  #--------------------------------------------------------------------------
  alias order_ctb_update_basic update_basic
  def update_basic
    order_ctb_update_basic
    return unless BattleControl.battle_type == :ctb
    if $game_party.all_dead? || $game_troop.all_dead?
      @ctb_order_gauge.contents_opacity -= 25
    end
  end
 
  #--------------------------------------------------------------------------
  # alias method: update
  #--------------------------------------------------------------------------
  alias order_ctb_update update
  def update
    order_ctb_update
    #---
    return unless BattleControl.battle_type == :ctb
    return unless @subject
    return unless @subject.actor?
    if @actor_command_window.active
      if @actor_command_window.current_symbol == :attack
        skill = $data_skills[1]
      end
      if @actor_command_window.current_symbol == :guard
        skill = $data_skills[2]
      end
      if $imported["YEA-BattleCommandList"]
      if @actor_command_window.current_symbol == :use_skill
        skill = $data_skills[@actor_command_window.current_ext]
      end
      end   
    end
    if @skill_window.active && BattleManager.actor
      skill = @skill_window.item
    end
    if @item_window.active && BattleManager.actor
      skill = @item_window.item
    end
    #---
    temp_ct = BattleControl.ctb_evaluate_ct(@subject, skill)
    unless BattleControl.ctb_check_temp((@subject), temp_ct)
      BattleControl.ctb_temp_evaluate(@subject, skill)
      @ctb_order_gauge.refresh
    end
  end
 
end # Scene_Battle

#==============================================================================
#
# ▼ End of File
#
#==============================================================================

The script is working correctly, but ...

Spoiler
Exemplo.PNG

When it's the actor's or enemy's turn the image is redirected a little to the right and I wanted it to be redirected to the left. Checking the script, I found that the "problem" is on line 155, I tried to change the values, but the most I got was to leave all the images on the same line and when I tried to put negative numbers the image even went to the left, however it was cut. If anyone can help me with this, I appreciate it ! And sorry for my english ...
I'm curious how you got the icons to show up. I can't see that option in the scripts.

For your question, the window starts at that position based on the x value in the settings at the top.
No matter what you set this to it will always be at the edge of the window, so...
We simply need to push the icons to the right.
As you surmised, line 155 works for moving the index position. Keep that with a -= for the x value.
the line below it is where all the boxes get placed. Add to the Rect.new an addition to the x value.
Rect.new(x + 10, y, width, height)
Hello Roninator !!!

For some reason the script doesn't show the options, but I followed the instructions of a post here in the forum, this one. And thank you very much for your help, it worked perfectly !

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/vx-ace-solved-help-yami-change-turn-battle.141959/