Edit of Mog´s scene_file script [resolved]

Started by Holyrapid, December 25, 2009, 07:50:16 am

Previous topic - Next topic

Holyrapid

December 25, 2009, 07:50:16 am Last Edit: January 03, 2010, 05:32:33 am by Pyhankoski
So, i want a minor edit of this. Or propably it´s an adjustment, but i suck at scripting so...
Anyway, i want it to not make the files transparent. Here´s the demo of it (script inside. i give demo because it uses pictures, and thus it´s simpler that way...)
MOG´s scene_file

Subsonic_Noise

I think You'll just Need to add transparency to the pictures.

Holyrapid

I don´t want to add transparency. The script makes the pictures move from left to right and back, while changing their transparency, by first increasing it,  and then lowering it, so that the pic isn´t transparent at all.
What i want to do is to disable that feature, so that the pics stay fully untransparent all the time. Download the demo, and go to load screen and you´ll understand what i mean.

Subsonic_Noise

Oh, I'm sorry then, lol. Perhaps I shouldn't post here when I'm this confused. xD

Holyrapid

I´m just bad at explaining things... It was my fault, because i wasn´t clear enough >.<

Holyrapid

Isn´t anyone going to do this? This should be easy (i think so...) Like i said in my second post, i want to have the picturues/files to keep moving, but so the their opacity doesn´t change at all.

Zare

January 02, 2010, 05:53:37 am #6 Last Edit: January 03, 2010, 07:05:07 am by Zare
try this, changed it and seems to work^^

#_______________________________________________________________________________
# MOG Scene File Ayumi V1.2           
#_______________________________________________________________________________
# By Moghunter 
# http://www.atelier-rgss.com
#_______________________________________________________________________________
module MOG
#Transition Time.
MSVT = 30
#Transition Type.
MSVTT = "006-Stripe02"
end
$mogscript = {} if $mogscript == nil
$mogscript["menu_ayumi"] = true
###############
# Window_Base #
###############
class Window_Base < Window
def drw_win_file(x,y)
dwf = RPG::Cache.picture("Win_File")
cw = dwf.width
ch = dwf.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, dwf, src_rect)   
end   
def nada
face = RPG::Cache.picture("")
end 
def draw_heroface3(actor,x,y)
face = RPG::Cache.picture(actor.name + "_fc3") rescue nada
cw = face.width
ch = face.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, face, src_rect)   
end 
def draw_actor_level6(actor, x, y)
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 1, y + 1, 32, 32, "Lv") 
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, "Lv")
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 17, y + 1, 24, 32, actor.level.to_s, 2)
self.contents.font.color = Color.new(255,255,255,255)
self.contents.draw_text(x + 16, y, 24, 32, actor.level.to_s, 2)
end
def draw_actor_name6(actor, x, y)
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 1, y + 1, 100, 32, actor.name,1) 
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 100, 32, actor.name,1)
end
end
############
# Game_Map #
############
class Game_Map
def map_name
@mapinfo = load_data("Data/MapInfos.rxdata") if @mapinfo == nil
return @mapinfo[@map_id].name
end
end
###################
# Window_SaveFile #
###################
class Window_SaveFile < Window_Base
  attr_reader   :filename               
  attr_reader   :selected               
  def initialize(file_index, filename)
    super(0, 64 + file_index * 138, 640, 240)   
    self.contents = Bitmap.new(width - 32, height - 32) 
    self.opacity = 0
    @file_index = file_index
    @filename = "Save#{@file_index + 1}.rxdata"
    @time_stamp = Time.at(0)
    @file_exist = FileTest.exist?(@filename)
    if @file_exist
      file = File.open(@filename, "r")
      @time_stamp = file.mtime
      @characters = Marshal.load(file)
      @frame_count = Marshal.load(file)
      @game_system = Marshal.load(file)
      @game_switches = Marshal.load(file)
      @game_variables = Marshal.load(file)
      @game_self_switches = Marshal.load(file)
      @game_screen = Marshal.load(file)
      @game_actors = Marshal.load(file)
      @game_party = Marshal.load(file)
      @game_troop = Marshal.load(file)
      @game_map = Marshal.load(file)
      @total_sec = @frame_count / Graphics.frame_rate
      file.close
    end
    @wiref = 0
    refresh
    @selected = false
  end 
  def refresh
    self.contents.clear
    self.contents.font.name = "Georgia"
    drw_win_file(0,190)
    name = "#{@file_index + 1}"
    self.contents.font.color = Color.new(0,0,0,255)
    self.contents.draw_text(161, 41, 600, 32, name)
    self.contents.font.color = Color.new(255,255,255,255)
    self.contents.draw_text(160, 40, 600, 32, name)   
    @name_width = contents.text_size(name).width
    if @file_exist
      for i in 0...@characters.size
        bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
        cw = bitmap.rect.width / 4
        ch = bitmap.rect.height / 4
        src_rect = Rect.new(cw * @wiref + 1 , 0, cw, ch)
        x = 300 - @characters.size + i * 64 - cw / 4
        self.contents.blt(x - 10, 150 - ch, bitmap, src_rect)
        x = 116
        actors = @game_party.actors
        for i in 0...[actors.size, 4].min
        x     = i * 60
        actor = actors[i]       
        self.contents.font.size = 20
        draw_actor_level6(actor, x + 280, 140)
        actor = actors[0]     
        draw_heroface3(actor,160,180)   
        draw_actor_name6(actor, 160, 155)
        self.contents.font.size = 22
        end         
      end     
      hour = @total_sec / 60 / 60
      min = @total_sec / 60 % 60
      sec = @total_sec % 60
      time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
      self.contents.font.color = Color.new(0,0,0,255)
      self.contents.draw_text(5, 41, 450, 32, time_string, 2)
      self.contents.draw_text(41 , 141, 120 , 32, @game_map.map_name.to_s)
      self.contents.font.color = Color.new(255,255,255,255)
      self.contents.draw_text(40 , 140, 120 , 32, @game_map.map_name.to_s) 
      self.contents.draw_text(4, 40, 450, 32, time_string, 2)   
   end
  end
  def selected=(selected)
    @selected = selected
  end
end
##############
# Scene_File #
##############
class Scene_File
  def initialize(help_text)
    @help_text = help_text
  end
  def main
    @mnback = Plane.new
    @mnback.bitmap = RPG::Cache.picture("MN_BK")
    @mnback.z = 1
    @mnlay = Sprite.new
    @mnlay.bitmap = RPG::Cache.picture("Lay_File.PNG")
    @mnlay.z = 2
    @help_window = Window_Help.new
    @help_window.set_text(@help_text)
    @help_window.opacity = 0
    @savefile_windows = []
    for i in 0..2
      @savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
    end
    @savefile_windows[0]
    @file_index = $game_temp.last_file_index
    @savefile_windows[@file_index].selected = true
    @savefile_windows[0].y = 40   
    @savefile_windows[1].y= 140
    @savefile_windows[2].y= 240   
    @win_move_time = 0
    @win_move = 0
    @win_dire = 0
    @win_opac = 255
    @win1_y = 0
    @win2_y = 0
    @win3_y = 0
    Graphics.transition(MOG::MSVT, "Graphics/Transitions/" + MOG::MSVTT)
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    for i in 0..50
    @mnback.ox += 1
    @savefile_windows[0].x += 10   
    @savefile_windows[1].x -= 10
    @savefile_windows[2].x += 10
    for i in @savefile_windows
    i.contents_opacity -= 5
    end 
    Graphics.update 
    end     
    Graphics.freeze
    @help_window.dispose
    @mnback.dispose
    @mnlay.dispose
    for i in @savefile_windows
      i.dispose
    end
  end
  def update
    @mnback.ox += 1
   # @win_opac += 3

    @win_move_time += 1   
    if @win_opac > 254
       @win_opac = 255
    end         
    if @win_move_time > 60
    @win_dire += 1
    @win_move_time = 0   
    end
    if @win_dire > 1
       @win_dire = 0
    end
    if @win_dire == 0
       @win_move += 1
    else   
       @win_move -= 1
    end         
    if @file_index == 0
    @savefile_windows[0].z = 2 
    @savefile_windows[1].z = 1
    @savefile_windows[2].z = 0   
    @savefile_windows[0].x = @win_move
    @savefile_windows[1].x = 0
    @savefile_windows[1].x= 0
    @savefile_windows[2].x = 0   
    @savefile_windows[0].contents_opacity = @win_opac
    @savefile_windows[1].contents_opacity = 130
    @savefile_windows[2].contents_opacity =  130   
    elsif @file_index == 1
    @savefile_windows[0].z = 1 
    @savefile_windows[1].z = 2
    @savefile_windows[2].z = 1   
    @savefile_windows[0].x = 0
    @savefile_windows[1].x = @win_move
    @savefile_windows[2].x = 0     
    @savefile_windows[0].contents_opacity =  130
    @savefile_windows[1].contents_opacity = @win_opac
    @savefile_windows[2].contents_opacity =  130
    else
    @savefile_windows[0].z = 0 
    @savefile_windows[1].z = 1
    @savefile_windows[2].z = 2       
    @savefile_windows[0].x = 0
    @savefile_windows[1].x = 0
    @savefile_windows[2].x = @win_move 
    @savefile_windows[0].contents_opacity = 130
    @savefile_windows[1].contents_opacity = 130
    @savefile_windows[2].contents_opacity = @win_opac   
    end   
    @help_window.update   
    for i in @savefile_windows
      i.update
    end
    if Input.trigger?(Input::C)
      on_decision(make_filename(@file_index))
      $game_temp.last_file_index = @file_index
      return
    end
    if Input.trigger?(Input::B)
      on_cancel
      return
    end
    if Input.repeat?(Input::DOWN)
      if Input.trigger?(Input::DOWN) or @file_index < 3
        $game_system.se_play($data_system.cursor_se)
        @savefile_windows[@file_index].selected = false
        @file_index = (@file_index + 1) % 3
        @savefile_windows[@file_index].selected = true
        return
      end
    end
    if Input.repeat?(Input::UP)
      if Input.trigger?(Input::UP) or @file_index > 0
        $game_system.se_play($data_system.cursor_se)
        @savefile_windows[@file_index].selected = false
        @file_index = (@file_index - 1) % 3
        @savefile_windows[@file_index].selected = true
        return
      end
    end
  end
  def make_filename(file_index)
    return "Save#{file_index + 1}.rxdata"
  end
end

Holyrapid

It gives me an error: Line 110: SyntaxError occured.
So, i got to line 110, and see what seems to me like a broken string (or something...) so i fix it by correcting the line breaking, and then it gives me another error when i try to load or save:
Line 109: TypeError occured. Cannot convert Array into String.

So, what´s the matter here? Anyway, thanks allready.

Zare

hm confusing...

try this demo

http://www.sendspace.com/file/aaxjsn

it works for me Oo no errors at all

Holyrapid

January 02, 2010, 02:19:17 pm #9 Last Edit: January 02, 2010, 02:32:30 pm by Pyhankoski
Maybe it´s colliding with some other script... I´ll try removing them, and come tell if it helps or not...
I moved other non RTP scripts below main, and that didn´t help. I´ll download the demo, and see if it can help me...
Ok, took the script from the demo, and copy pasted it over the old one, and it worked. Thanks Zare, you´re great.

Zare

hm but it worked before, didn't it? so it should work now as well, because i just edited 2 lines which have absolutely nothing to do with the savescript itself...

before:

       @win_opac += 3

    @win_move_time += 1   
    if @win_opac > 254
       @win_opac = 160
    end         

after:
   # @win_opac += 3

    @win_move_time += 1   
    if @win_opac > 254
       @win_opac = 255
    end         

Holyrapid

Found the bug. On the problem line 109, there was a missing piece. In the working version it´s like this:         bitmap = RPG::Cache.character(@characters
  • , @characters[1])
    when in the problematic one it and 110 (that should apparently be part of 109) it´s like: bitmap = RPG::Cache.character(@characters
    , @characters[1])
    Somehow the is missing from the unworking version.

Zare

yeah could be caused by my f***ing mouse xD but now it works like you wanted it?

Holyrapid

January 03, 2010, 05:28:48 am #13 Last Edit: January 03, 2010, 05:31:10 am by Pyhankoski
Yea. I recommend that you´d edit your post that had the script in, so that it´s fixed. (i mean that currently row 110 should be part of 109 and then there´s that missing
[i]
thing...)
So, it works properly now. Thanks. It annoyed the heck out of me that transparency thing >.<
So, big thanks and level++ to you. And it´s in code tag for a reason. if not, it´s trreated as forum code...