Chaos Project

RPG Maker => RPG Maker Scripts => Script Troubleshooting => Topic started by: diagostimo on March 06, 2012, 08:44:21 pm

Title: how to stop a window from showing???
Post by: diagostimo on March 06, 2012, 08:44:21 pm
hey, i have a problem when trying to bypass a window from showing, ill show u what i mean,
so the config is like this:

#beging config
$map_name = "examplename.png"
$index0_name = "examplename.png"
$index1_name = ""
$index2_name = ""

then i have the C button to open a window depending where in the idex you are as so:

  # if enter is being pressed
    if Input.trigger?(Input::C)
       if @index == 1
         # Play decision SE
         $game_system.se_play($data_system.decision_se)
         # Switch to item screen
         $scene = Scene_Index1.new
       end
     end
   end


what i want is say $index1_name = "", i want it to not show the scene that its set up to show, so you have the option of showing a window, or not showing a window if theres no name there, iv tried multiple ways using:
  # if enter is being pressed
if Input.trigger?(Input::C)
  if $index1_name = ""
   $scene = Scene_MapMenu.new (1)  
  else
     if @index == 1
       # Play decision SE
       $game_system.se_play($data_system.decision_se)
       # Switch to item screen
       $scene = Scene_Index1.new
     end
  end
end

but no luck, iv tried mixing it up abit but cant find a solution :(
Title: Re: how to stop a window from showing???
Post by: G_G on March 06, 2012, 08:59:13 pm
This
if $index1_name = ""

Should read
if $index1_name == ""
Title: Re: how to stop a window from showing???
Post by: diagostimo on March 06, 2012, 09:37:36 pm
now i get the error "undefined local variable or method"
iv rearanged the script order as i want it to check the map index first to this:
def update
   super
   # if enter is being pressed
   if Input.trigger?(Input::C)
     if @index == 1
       if index1_name == ""
         $scene = Scene_MapMenu.new (1)
       else
         # Play decision SE
         $game_system.se_play($data_system.decision_se)
         # Switch to item screen
         $scene = Scene_Index1.new
       end
     end
   end

will i have to define index1_name anywhere?
Title: Re: how to stop a window from showing???
Post by: G_G on March 06, 2012, 09:39:58 pm
Thats because you changed the variable.
if index1_name == ""

Shouldn't it be
if $index1_name == ""
Title: Re: how to stop a window from showing???
Post by: diagostimo on March 06, 2012, 09:43:03 pm
oops my bad, pesky little $ signs :P thanks man
Title: Re: how to stop a window from showing???
Post by: diagostimo on March 10, 2012, 03:47:23 am
bump, cba writing a new topic for summet small, is there a way to direct a super's settings as i did with the images, so its simply editable?
so my super is this:
super(112, 64, 416, 352)

i want it to be something like this
super == $window_size

then have this in my editables
$window_size = (112, 64, 416, 352)

is it possible to implement this into the editables so you can do it up top rather than scroll through the whole script?
Title: Re: how to stop a window from showing???
Post by: G_G on March 10, 2012, 09:23:28 am
Super doesn't work that way at all. Super calls the parent's class "initialize" method. Look at this for example.
class Person
  def initialize(name)
    @name = name
  end
end


class Billy < Person
  def initialize
    super("name")
  end
end


Notice how class "Person" requires the argument "name". Any class that inherits the "Person" class must pass the super and the proper arguments. However, you can achievement what you want. You've just got it a little out of order.
$window_size = [x, y, width, height]
# rest of script
class Window_YourWindow < Window_Base
  def initialize
    super($window_size[0], $window_size[1], $window_size[2], $window_size[3])
  end
end
Title: Re: how to stop a window from showing???
Post by: diagostimo on March 10, 2012, 11:24:46 pm
cool, i did understand how super worked, but thought it could be simply redirected into editables, and thanks, your help is always appreciated :D