Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Computer Menu
#1
Computer Menu, in a script
by Sheol
Aug 26, 2005

This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


DERVV NOTE: Requires certain graphics hardwired in the script. Some sections commented out as written before the official English version of RPGMaker XP released.

Because my demo has a virus, I do a Code with images.

Code:
#-----------------------------------------------------------------
# Slipknot Computer Menu System
#      created by slipknot
#-----------------------------------------------------------------
class Scene_Menu
#-----------------------------------------------------------------
  def initialize(menu_index = 0)
     @menu_index = menu_index
  end
#-----------------------------------------------------------------
  def main
     @g = Gold.new
     @g.x = 320-@g.width/2
     @g.y = 240-@g.height/2
     @g.visible = false
     @g.active = false
     s1="Restart"
     s2="Shutdown"
     s3="About"
     s4="None"
     s5="Back 1"
     s6="Back 2"
     s7="Back 3"
     s8="Back 4"
     @back = Window_Command.new(100, [s4,s5,s6,s7,s8])
     @back.x = 320-@back.width/2
     @back.y = 240-@back.height/2
     if @backso = nil
        @backso = 1
     end
     @back.visible = false
     @back.active = false
     @imagen = Sprite.new
     @imagen.bitmap=RPG::Cache.picture("back1")
     @bar = Sprite.new
     @bar.bitmap=RPG::Cache.picture("bar")
     @bar.y=449
     @playtime = Playtime.new
     @stname = Startname.new
     @start = Window_Command.new(126, [s3,s1,s2])
     @start.y=480-@start.height-31
     @start.z = 160
     @start.visible=false
     @start.active=false
     @about = About.new
     @about.x = 320-@about.width/2
     @about.y = 240-@about.height/2
     @about.active=false
     @about.visible=false
    
     @command = Computer.new
     @command.index = @menu_index
     if $game_party.actors.size == 0
        @command.disable_item(0)
        @command.disable_item(1)
        @command.disable_item(2)
        @command.disable_item(3)
     end
     @command.z = 100
     if $game_system.save_disabled
        @command.disable_item(4)
     end
     @status = Window_MenuStatus.new
     @status.x = 640-@status.width
     @status.z = 150
     @status.back_opacity=150
     @status.visible = false

     Graphics.transition
     loop do
        Graphics.update
        Input.update
        update
        if $scene != self
           break
        end
     end
     Graphics.freeze
     @command.dispose
     @status.dispose
     @playtime.dispose
     @start.dispose
     @about.dispose
     @stname.dispose
     @g.dispose
     @bar.dispose
     @imagen.dispose
  end
#-----------------------------------------------------------------
  def update
     @command.update
     @bar.update
     @stname.update
     @start.update
     @playtime.update
     @imagen.update
     if @start.active
        update_start
        return
     end
     if @backso==0
        @imagen.bitmap=RPG::Cache.picture("")
     elsif @backso==1
        @imagen.bitmap=RPG::Cache.picture("back1")
     elsif @backso==2
        @imagen.bitmap=RPG::Cache.picture("back2")
     elsif @backso==3
        @imagen.bitmap=RPG::Cache.picture("back3")
     elsif @backso==4
        @imagen.bitmap=RPG::Cache.picture("back4")
     end
     @g.update
     @back.update
     if @back.active
        update_back
        return
     end
     if @g.active
        update_g
        return
     end
     @status.update
     if @command.active
        update_command
        return
     end
     if @status.active
        update_status
        return
     end
     if @about.active
        update_about
     end
  end
#-----------------------------------------------------------------
  def delay(seconds)
     for i in 0...(seconds * 1)
        sleep 0.01
        Graphics.update
     end
  end
#-----------------------------------------------------------------
  def update_about
     if Input.trigger?(Input::B) or Input.trigger?(Input::C)
        @about.visible = false
        @about.active = false
        @command.active = true
        return
     end
  end
#-----------------------------------------------------------------
  def update_start
     if Input.trigger?(Input::A) or Input.trigger?(Input::B)
        @start.visible = false
        @start.active = false
        @command.active = true
        return
     end
     if Input.trigger?(Input::C)
        case @start.index
        when 0
           $game_system.se_play($data_system.decision_se)
           @start.active=false
           @start.visible=false
           @about.visible=true
           @about.active=true
        when 1
           $game_system.se_play($data_system.decision_se)
           audiofade
           $scene = Scene_Title.new
        when 2
           $game_system.se_play($data_system.decision_se)
           audiofade
           $scene = nil
        end
        return
     end
  end
#-----------------------------------------------------------------
  def audiofade
     Audio.bgm_fade(800)
     Audio.bgs_fade(800)
     Audio.me_fade(800)
  end
#-----------------------------------------------------------------
  def update_g
     if Input.trigger?(Input::B) or Input.trigger?(Input::C)
        @g.visible = false
        @g.active = false
        @command.active = true
        return
     end
  end
#-----------------------------------------------------------------
  def update_back
     if Input.trigger?(Input::B)
        acceptback
        @back.index = -1
        return
     end
     if Input.trigger?(Input::C)
        case @back.index
        when 0
           @backso = 0
           acceptback
        when 1
           @backso = 1
           acceptback
        when 2
           @backso = 2
           acceptback
        when 3
           @backso = 3
           acceptback
        when 4
           @backso = 4
           acceptback
        end
        return
     end
  end
#-----------------------------------------------------------------
  def acceptback
     @back.active = false
     @back.visible = false
     @command.active = true
  end
#-----------------------------------------------------------------
  def update_command
     if Input.trigger?(Input::A)
        @command.active=false
        @start.active=true
        @start.visible=true
        return
     end
     if Input.trigger?(Input::B)
        $game_system.se_play($data_system.cancel_se)
        $scene = Scene_Map.new
        return
     end
     if Input.trigger?(Input::C)
        if $game_party.actors.size == 0 and @command.index < 4
           $game_system.se_play($data_system.buzzer_se)
           return
        end
        case @command.index
        when 0
           $game_system.se_play($data_system.decision_se)
           $scene = Scene_Item.new
        when 1
           commandaccept
        when 2
           commandaccept
        when 3
           commandaccept
        when 4
           if $game_system.save_disabled
              $game_system.se_play($data_system.buzzer_se)
              return
           end
           $game_system.se_play($data_system.decision_se)
           $scene = Scene_Save.new
        when 5
           $game_system.se_play($data_system.decision_se)
           @command.active=false
           @g.active=true
           @g.visible=true
           return
        when 6
           $game_system.se_play($data_system.decision_se)
           @command.active=false
           @back.active=true
           @back.visible=true
           @back.index = 0
           return
        end
        return
     end
     if Input.press?(Input::DOWN) or Input.press?(Input::RIGHT)
        delay(2)
        $game_system.se_play($data_system.cursor_se)
        @command.setup_move(Computer::M_L)
        delay(2)
        return
     end
     if Input.press?(Input::UP) or Input.press?(Input::LEFT)
        delay(2)
        $game_system.se_play($data_system.cursor_se)
        @command.setup_move(Computer::M_R)
        delay(2)
        return
     end
  end
#-----------------------------------------------------------------
  def commandaccept
     $game_system.se_play($data_system.decision_se)
     @command.active = false
     @status.active = true
     @status.visible = true
     @status.index = 0
  end
#-----------------------------------------------------------------
  def update_status
     if Input.trigger?(Input::B)
        $game_system.se_play($data_system.cancel_se)
        @status.active = false
        @status.visible = false
        @status.index = -1
        @command.active = true
        return
     end
     if Input.trigger?(Input::C)
        case @command.index
        when 1
           if $game_party.actors[@status.index].restriction >= 2
              $game_system.se_play($data_system.buzzer_se)
              return
           end
           $game_system.se_play($data_system.decision_se)
           $scene = Scene_Skill.new(@status.index)
        when 2
           $game_system.se_play($data_system.decision_se)
           $scene = Scene_Equip.new(@status.index)
        when 3
           $game_system.se_play($data_system.decision_se)
           $scene = Scene_Status.new(@status.index)
        end
        return
     end
  end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class Computer < Window_Base
#-----------------------------------------------------------------
  M_R=1
  M_L=2
  attr_accessor :index
#-----------------------------------------------------------------
  def initialize
     super(0, 0, 640, 480)
     self.contents = Bitmap.new(width-32, height-32)
     #self.contents.font.name = $defaultfonttype
     self.contents.font.color = text_color(0)
     self.contents.font.size = 22
     self.opacity = 0
     s1 = $data_system.words.item
     s2 = $data_system.words.skill
     s3 = $data_system.words.equip
     s4 = "Status"
     s5 = "Save"
     s6 = "Gold"
     s7 = "Background"
     @commands = [s1, s2, s3, s4, s5, s6]
     @item_max = 7
     @index = 0
     ic_itm = RPG::Cache.icon("034-Item03")
     ic_skl = RPG::Cache.icon("044-Skill01")
     ic_eqp = RPG::Cache.icon("001-Weapon01")
     ic_stt = RPG::Cache.icon("050-Skill07")
     ic_sav = RPG::Cache.icon("saveicon")
     ic_gld = RPG::Cache.icon("gold")
     ic_bck = RPG::Cache.icon("backicon")
     @items = [ic_itm, ic_skl, ic_eqp, ic_stt, ic_sav, ic_gld, ic_bck]
     @disabled = [false, false, false, false, false, false, false]
     refresh
  end
#-----------------------------------------------------------------
  def update
     super
     refresh
  end
#-----------------------------------------------------------------
  def refresh
     self.contents.clear
     x=4
     y=50
     o=25
     for i in 0...@item_max
        ic_disable = RPG::Cache.icon("")
        rect = Rect.new(0, 0, @items[i].width, @items[i].height)
        if @index == i
           self.contents.blt( x, y*i+1, @items[i], rect)
           if @disabled[@index]
              self.contents.blt( x, y*i+1, ic_disable, rect)
           end
        else
           self.contents.blt( x, y*i+1, @items[i], rect, 128)
           if @disabled[@index]
              self.contents.blt( x, y*i+1, ic_disable, rect, 128)
           end
        end
     end
     self.contents.font.size = 18
     self.contents.draw_text(4, o, 100, 24,"Items")
     self.contents.draw_text(4, o+y, 100, 24,"Skills")
     self.contents.draw_text(4, o+y*2, 100, 24,"Equip")
     self.contents.draw_text(4, o+y*3, 100, 24,"Status")
     self.contents.draw_text(4, o+y*4, 100, 24,"Save")
     self.contents.draw_text(4, o+y*5, 100, 24,"Gold")
     self.contents.draw_text(4, o+y*6, 150, 24,"Background")
  end
#-----------------------------------------------------------------
  def disable_item(index)
     @disabled[index] = true
  end
#-----------------------------------------------------------------
  def setup_move(mode)
     if mode == M_R
        @index -= 1
        @index = @items.size - 1 if @index < 0
     elsif mode == M_L
        @index += 1
        @index = 0 if @index >= @items.size
     else
        return
     end
  end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class Window_MenuStatus < Window_Selectable
#-----------------------------------------------------------------
  def initialize
     super(0,0,232, 352)
     self.contents = Bitmap.new(width - 32, height - 32)
     self.contents.font.size = 22
     refresh
     self.active = false
     self.index = -1
  end
#-----------------------------------------------------------------
  def refresh
     self.contents.clear
     #self.contents.font.name = $defaultfonttype
     @item_max = $game_party.actors.size
     for i in 0...$game_party.actors.size
        x = 80
        y = 80 * i
        actor = $game_party.actors[i]
        draw_actor_graphic(actor, x - 40, y + 75)
        draw_actor_name(actor, x, y + 24)
     end
  end
#-----------------------------------------------------------------
  def update_cursor_rect
     if @index < 0
        self.cursor_rect.empty
     else
        self.cursor_rect.set(0, @index * 80, self.width - 32, 80)
     end
  end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class About < Window_Selectable
#-----------------------------------------------------------------
  def initialize
     super(0,0,256,110)
     self.contents = Bitmap.new(width-32,height-32)
     #self.contents.font.name = $defaultfonttype
     self.contents.font.size = 18
     pic = RPG::Cache.picture("logo")
     self.contents.blt(-1,0,pic,Rect.new(0,0,31,77))
     self.contents.draw_text(20,0,204,26,"Slipknot Computer Menu System",2)
     self.contents.draw_text(30,26,194,26,"Created by slipknot 2005",2)
     self.contents.draw_text(30,52,194,26,"All rights reserved.",2)
  end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class Gold < Window_Selectable
#-----------------------------------------------------------------
  def initialize
     super(0,0,160,94)
     self.contents = Bitmap.new(width-32, height-32)
     self.opacity=225
     #self.contents.font.name = $defaultfonttype
     #self.contents.font.size = $defaultfontsize
     self.contents.draw_text(0,0,120,32,"You have:")
     icon = RPG::Cache.icon("gold")
     self.contents.draw_text (4,32,92,32,$game_party.gold.to_s,2)
     self.contents.blt(103,37,icon,Rect.new(0,0,24,24))
  end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class Playtime < Window_Base
#-----------------------------------------------------------------
  def initialize
     super(560,432,88,64)
     self.contents = Bitmap.new(width-32,height-32)
     self.opacity = 0
     #self.contents.font.name = $defaultfonttype
     self.contents.font.size = 18
     self.contents.font.color = Color.new(32,32,32,200)
     refresh
  end
#-----------------------------------------------------------------
  def refresh
     self.contents.clear
     @total_sec = Graphics.frame_count/Graphics.frame_rate
     hour = @total_sec / 60 / 60
     min = @total_sec / 60 % 60
     sec = @total_sec % 60
     text = sprintf("%02d:%02d:%02d",hour,min,sec)
     self.contents.draw_text(0,0,56,32,text,2)
  end
#-----------------------------------------------------------------
  def update
     super
     if Graphics.frame_count/Graphics.frame_rate != @total_sec
        refresh
     end
  end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class Startname < Window_Base
#-----------------------------------------------------------------
  def initialize
     super(6,432,82,64)
     self.contents = Bitmap.new(width-32,height-32)
     self.opacity = 0
     #self.contents.font.name = $defaultfonttype
     self.contents.font.size = 26
     self.contents.font.color = Color.new(255,255,255,200)
     self.contents.draw_text(0,0,50,32,"Start")
  end
#-----------------------------------------------------------------
end
}


Possibly Related Threads…
Thread Author Replies Views Last Post
  FF7 style menu system Narc the Jester 0 2,488 05-04-2010, 01:00 PM
Last Post: Narc the Jester
  L's Custom Menu Scenes Landarma 0 2,434 02-27-2009, 01:00 PM
Last Post: Landarma
  Advanced Menu Screen Kanon 1 3,150 11-21-2008, 01:00 PM
Last Post: Kanon
  Legend of dragoon type Equipment Menu Genshyu 0 2,353 09-02-2008, 01:00 PM
Last Post: Genshyu
  Final Fantasy III Menu Style DragonKnigth 0 2,428 09-07-2007, 01:00 PM
Last Post: DragonKnigth
  SilentSteps Menu System Silentwalker 0 1,973 06-17-2007, 01:00 PM
Last Post: Silentwalker
  Ring Menu for SDK2 Landarma 0 2,776 06-01-2007, 01:00 PM
Last Post: Landarma
  Variable Image Menu Chrono Cry 0 1,992 04-25-2007, 01:00 PM
Last Post: Chrono Cry
  Ztorm's Speed Menu ztorm 0 2,318 01-21-2007, 01:00 PM
Last Post: ztorm
  Kingdom Hearts Menu Leon Blade 0 2,361 12-29-2006, 01:00 PM
Last Post: Leon Blade



Users browsing this thread: