The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: Shudo on November 18, 2007, 06:00:48 PM

Title: Help me with "Styled Info"
Post by: Shudo on November 18, 2007, 06:00:48 PM
I have a problem. If someone would be nice enough to help me that would be great. I changed the code instead of saying Help_Window which was the default one. I wanted to change it to mine. Which is Destiny Window. When I did it didn't work. Please help the code is
#_________________________________________________
# MOG_STYLED_INFO V1.0           
#_________________________________________________
# By Moghunter     
# http://www.atelier-rgss.com
#_________________________________________________
# Em combate apresenta a janela de Help com
# movimento e layout.
# É necessário ter a imagem HELP_WINDOW.PNG dentro
# da pasta Graphics\Windowskin.
#_________________________________________________
module MOG
#Definição do tempo de exposição. 
DESTINY_TIME = 5
#Definição da cor do texto.
DESTINY_FONT_COLOR = Color.new(255,255,255,255)
#Definição do tamanho do texto.
DESTINY_FONT_SIZE = 24
#Definição do nome da fonte.
DESTINY_FONT_NAME = "Georgia"
end
#_________________________________________________
$mogscript = {} if $mogscript == nil
$mogscript["Styled Info"] = true
###############
# Window Base #
###############
class Window_Base < Window
def nd_helpic
Destiny_pic = RPG::Cache.picture("")     
end 
def draw_help_pic (x,y)
Destiny_pic = RPG::Cache.picture("Destiny_Window") rescue nd_Destinypic
cw = Destiny_pic.width 
ch = d=Destiny_pic.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, Destiny_pic, src_rect)
end
end
######################
# Window_Active_Destiny #
######################
class Window_Active_Destiny < Window_Base
  def initialize
    super(0, 0, 640, 100)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
  end
  def set_text(text, align = 0)
    if text != @text or align != @align
      self.contents.clear
      draw_destiny_pic(105,60) 
      self.contents.font.size = MOG::DESTINY_FONT_SIZE
      self.contents.font.name = MOG::DESTINY_FONT_NAME
      self.contents.font.color = MOG::DESTINY_FONT_COLOR
      self.contents.draw_text(4, 10, self.width - 40, 32, text, align)
      @text = text
      @align = align
    end
    self.visible = true
  end
end
################
# Scene_Battle #
################
class Scene_Battle
include MOG
  alias mog51_main main
  def main
    @active_window_Destiny = Window_Active_Destiny.new
    @active_window_Destiny.visible = false
    @active_window_Destiny.y = -100
    @active_window_Destiny.contents_opacity = 255
    @win_time_Destiny = 0
    mog51_main
    @active_window_Destiny.dispose
  end
  alias mog51_update update
  def update
  mog51_update
  if @win_time_Destiny > 0
  @win_time_Destiny -= 1
  end
  if @party_command_window != nil 
  @active_window_Destiny.visible = false if @party_command_window.visible == true
  end
  if @Destiny_Window.visible == true
  @active_window_Destiny.visible = false
  end
  if @active_window_Destiny.y < 0
     @active_window_Destiny.y += 10
  elsif @active_window_Destiny.y >= 0
     @active_window_Destiny.y = 0
  end     
  if @active_window_Destiny.contents_opacity > 0 and @win_time_Destiny <= 0
     @active_window_Destiny.contents_opacity -= 5
  elsif @active_window_Destiny.contents_opacity <= 0
     @active_window_Destiny.contents_opacity = 0
     @active_window_Destiny.visible = false
  end
  end
  alias mog51_make_basic_action_result make_basic_action_result
  def make_basic_action_result
    mog51_make_basic_action_result
    if @active_battler.current_action.basic == 1
    @destiny_window.visible = false
    @active_window_Destiny.visible = true
    @active_window_Destiny.y -= 100
    @win_time_Destiny = 10 * DESTINY_TIME
    @active_window_Destiny.contents_opacity = 255
    @active_window_Destiny.set_text($data_system.words.guard, 1)
    end
  end
  alias mog51_make_skill_action_result make_skill_action_result
  def make_skill_action_result
    mog51_make_skill_action_result
    if @phase4_step == 1
      return
    end
    @Destiny_Window.visible = false
    @active_window_Destiny.visible = true 
    @active_window_Destiny.y -= 100   
    @win_time_Destiny = 10 * DESTINY_TIME   
    @active_window_Destiny.contents_opacity = 255
    @active_window_Destiny.set_text(@skill.name, 1)
  end
  alias mog51_make_item_action_result make_item_action_result
  def make_item_action_result
    mog51_make_item_action_result
    if @phase4_step == 1
      return
    end
    @destiny_window.visible = false
    @active_window_Destiny.visible = true 
    @active_window_Destiny.y -= 100 
    @win_time_Destiny = 10 * DESTINY_TIME   
    @active_window_Destiny.contents_opacity = 255       
    @active_window_Destiny.set_text(@item.name, 1)
  end
  alias mog51_start_phase5 start_phase5 
  def start_phase5
  mog51_start_phase5 
  @active_window_Destiny.visible = false   
  end 
end



I'm not sure what to do now. I feel like I've tried everything.
Title: Re: Help me with "Styled Info"
Post by: tSwitch on November 18, 2007, 06:02:22 PM
ok, first please put your code in code tags

second, what exactly is not working?
what did the script do before you changed whatever you changed
and could you be more specific as to what you changed where?
Title: Re: Help me with "Styled Info"
Post by: Shudo on November 18, 2007, 06:10:05 PM
The thing is when I intialize it in playing mode it doesn't show up. What do you mean by code. I don't understand. Thanks. The code was this 
#_________________________________________________
# MOG_STYLED_INFO V1.0           
#_________________________________________________
# By Moghunter     
# http://www.atelier-rgss.com
#_________________________________________________
# Em combate apresenta a janela de Help com
# movimento e layout.
# É necessário ter a imagem HELP_WINDOW.PNG dentro
# da pasta Graphics\Windowskin.
#_________________________________________________
module MOG
#Definição do tempo de exposição. 
HELP_TIME = 5
#Definição da cor do texto.
HELP_FONT_COLOR = Color.new(255,255,255,255)
#Definição do tamanho do texto.
HELP_FONT_SIZE = 24
#Definição do nome da fonte.
HELP_FONT_NAME = "Georgia"
end
#_________________________________________________
$mogscript = {} if $mogscript == nil
$mogscript["Styled Info"] = true
###############
# Window Base #
###############
class Window_Base < Window
def nd_helpic
help_pic = RPG::Cache.picture("")     
end 
def draw_help_pic (x,y)
help_pic = RPG::Cache.picture("Help_Window") rescue nd_helpic
cw = help_pic.width 
ch = help_pic.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, help_pic, src_rect)
end
end
######################
# Window_Active_Help #
######################
class Window_Active_Help < Window_Base
  def initialize
    super(0, 0, 640, 100)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
  end
  def set_text(text, align = 0)
    if text != @text or align != @align
      self.contents.clear
      draw_help_pic(105,60) 
      self.contents.font.size = MOG::HELP_FONT_SIZE
      self.contents.font.name = MOG::HELP_FONT_NAME
      self.contents.font.color = MOG::HELP_FONT_COLOR
      self.contents.draw_text(4, 10, self.width - 40, 32, text, align)
      @text = text
      @align = align
    end
    self.visible = true
  end
end
################
# Scene_Battle #
################
class Scene_Battle
include MOG
  alias mog51_main main
  def main
    @active_window_help = Window_Active_Help.new
    @active_window_help.visible = false
    @active_window_help.y = -100
    @active_window_help.contents_opacity = 255
    @win_time_help = 0
    mog51_main
    @active_window_help.dispose
  end
  alias mog51_update update
  def update
  mog51_update
  if @win_time_help > 0
  @win_time_help -= 1
  end
  if @party_command_window != nil 
  @active_window_help.visible = false if @party_command_window.visible == true
  end
  if @help_window.visible == true
  @active_window_help.visible = false
  end
  if @active_window_help.y < 0
     @active_window_help.y += 10
  elsif @active_window_help.y >= 0
     @active_window_help.y = 0
  end     
  if @active_window_help.contents_opacity > 0 and @win_time_help <= 0
     @active_window_help.contents_opacity -= 5
  elsif @active_window_help.contents_opacity <= 0
     @active_window_help.contents_opacity = 0
     @active_window_help.visible = false
  end
  end
  alias mog51_make_basic_action_result make_basic_action_result
  def make_basic_action_result
    mog51_make_basic_action_result
    if @active_battler.current_action.basic == 1
    @help_window.visible = false
    @active_window_help.visible = true
    @active_window_help.y -= 100
    @win_time_help = 10 * HELP_TIME
    @active_window_help.contents_opacity = 255
    @active_window_help.set_text($data_system.words.guard, 1)
    end
  end
  alias mog51_make_skill_action_result make_skill_action_result
  def make_skill_action_result
    mog51_make_skill_action_result
    if @phase4_step == 1
      return
    end
    @help_window.visible = false
    @active_window_help.visible = true 
    @active_window_help.y -= 100   
    @win_time_help = 10 * HELP_TIME   
    @active_window_help.contents_opacity = 255
    @active_window_help.set_text(@skill.name, 1)
  end
  alias mog51_make_item_action_result make_item_action_result
  def make_item_action_result
    mog51_make_item_action_result
    if @phase4_step == 1
      return
    end
    @help_window.visible = false
    @active_window_help.visible = true 
    @active_window_help.y -= 100 
    @win_time_help = 10 * HELP_TIME   
    @active_window_help.contents_opacity = 255       
    @active_window_help.set_text(@item.name, 1)
  end
  alias mog51_start_phase5 start_phase5 
  def start_phase5
  mog51_start_phase5 
  @active_window_help.visible = false   
  end 
end


and it worked just fine.
Title: Re: Help me with "Styled Info"
Post by: tSwitch on November 18, 2007, 06:16:18 PM
code tags, put it in code tags

['code][/'code]

without the ' in them

also, don't change the names of variables and stuff or the script most certainly won't work right
why would you change the name of things anyway?
to what end?
Title: Re: Help me with "Styled Info"
Post by: Shudo on November 18, 2007, 06:26:06 PM
Well, because when I was reading a tutorial about that it said type in the exact name of the file you want ot insert or something around there. You mean if I put those code tags in it should work and you every single line in the code i'm sure. The url to the file is here http://i184.photobucket.com/albums/x174/Misayokko/Destiny_Window.png
Title: Re: Help me with "Styled Info"
Post by: tSwitch on November 18, 2007, 07:13:53 PM
code tags when posting the script

['code]
here is your script
\\\\\\\\\
\
\
\
\
\
\
\
\
\\
\
\
\
\
\
\
\
\
\
\
\
\
[/'code]

(without the two ' ) will look like this

here is your script
\\\\\\\\\
\
\
\
\
\
\
\
\
\\
\
\
\
\
\
\
\
\
\
\
\
\


and it wont' stretch the page like I just did -_-

help_pic = RPG::Cache.picture("Help_Window") rescue nd_helpic
that blue text right there
is all you need to change
Title: Re: Help me with "Styled Info"
Post by: Shudo on November 18, 2007, 07:42:34 PM
I changed the blue highlightedn text you showed me in my game. I'm still confused about the code tag you mean on my game or when I posted it here. Oh my. ~_~
Title: Re: Help me with "Styled Info"
Post by: tSwitch on November 18, 2007, 07:45:22 PM
click the little button that looks like a # when posting a topic
whatever you post in between the [][] with the word code in it will be in a code box
meaning it'll scroll and not stretch the page
Title: Re: Help me with "Styled Info"
Post by: Shudo on November 18, 2007, 10:16:25 PM
Thanks ,but my problem is still occuring I changed the blue highlighted text in my game. When I did nothing happened.
Title: Re: Help me with "Styled Info"
Post by: tSwitch on November 18, 2007, 10:18:06 PM
use the original script, without destiny all over it
Title: Re: Help me with "Styled Info"
Post by: Shudo on November 19, 2007, 12:22:28 AM
I did. ^_^ I just want to use mine. I did it how you said to do it. Would it work if you tried it?
Title: Re: Help me with "Styled Info"
Post by: tSwitch on November 19, 2007, 06:12:23 AM
I'm not entirely sure, the one you messed with and threw destiny all over the place
that was really unneccessary and you'd need to re-write all kinds of things to use it

all you need to do is change the blue text to the name of your image