Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

2 Pages V  < 1 2  
Reply to this topicStart new topic
> [Series][Scripting]Selectable Windows, A tutorial from the Script Builders
Redd
post Dec 10 2009, 09:38 AM
Post #21


:<
Group Icon

Group: Revolutionary
Posts: 2,314
Type: Developer
RM Skill: Advanced




CODE
#==============================================================================
# ** Window_Pet.
#------------------------------------------------------------------------------
#  Based on the Script Builder's Guide, this is a selectable window :)
#==============================================================================

class Window_Pet < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(200, 200, 640-200, 480-200)
    self.index = 0 # This is what item is selected when the window is first made
    @item_max = 4
    self.contents = Bitmap.new(width-32,height-32)
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    #self.contents.draw_text(x_position_from_edge , y_position_from_edge,
    #                         width, height, "Text", alignment)
    self.contents.font.color = system_color
    self.contents.draw_text(0,0,150,32,"Dieeee!")
    self.contents.font.color = green_color
    self.contents.draw_text(0,32,150,32,"What? I kill you!")
    self.contents.font.color = knockout_color
    self.contents.draw_text(0,64,150,32,"This is getting boring...")
    self.contents.font.color = normal_color    
    self.contents.draw_text(0,96,150,32,"METALLICA ROCKS!")
  end
  #--------------------------------------------------------------------------
  # * Check_Input
  #--------------------------------------------------------------------------
  def check_input
    if Input.trigger?(Input::C)
      $window.dispose
      if self.index == 0
        print "You want to dieeee?"
      elsif self.index == 1
        print "C'mon man I just asked you a simple question!"
      elsif self.index == 2
        print "I know.... this is really boring huh"
      elsif self.index == 3
        print "METALLICA IS THE BOMB!"
      end
    end
  end
end


Is there anything wrong with it?

EDIT: I fixed THAT problem. It was because I accidentally added a period after is inside the call script conditional branch thingy. But now I have a different problem:


in Interpreter 7 line 274, this is what is says (and a while after that)
CODE
    if result == false
      # End
      return false
    end
    # Continue
    return true
  end
end


Any help?

This post has been edited by Redd: Dec 10 2009, 09:45 AM


__________________________
Go to the top of the page
 
+Quote Post
   
Redd
post Dec 13 2009, 06:26 PM
Post #22


:<
Group Icon

Group: Revolutionary
Posts: 2,314
Type: Developer
RM Skill: Advanced




Ummm... bump?


__________________________
Go to the top of the page
 
+Quote Post
   
Night_Runner
post Dec 20 2009, 01:31 AM
Post #23


Level 50
Group Icon

Group: +Gold Member
Posts: 1,525
Type: Scripter
RM Skill: Undisclosed




Sorry about that Redd.

I got the script working without running into that particular error, I think it may have something to do with your event...

Have your event run this bit of code, if it fixes your problem, let me know
CODE
$window = Window_Pet.new
loop do
Graphics.update; Input.update
$window.update
$window.check_input
break if $window.disposed?
end


And you should only run into the problem of trying to call green_color tongue.gif
All those system_color, knockout_color, normal_color etc do is try to enforce a consistent colour scheme, so there's no such thing as red_color or green_color.
Change that green_color to Color.new(0, 255, 0)
where the formatting is Color.new(red, green, blue)
so if you wanted to make a purple, it'd be
Color.new(255, 0, 255)

But otherwise it should work fine, if it isn't, please send a screen shot of your event.


__________________________
K.I.S.S.
Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.

Most important guide ever: Newbie's Guide to Switches
Go to the top of the page
 
+Quote Post
   

2 Pages V  < 1 2
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 24th May 2013 - 04:25 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker