how to stop a window from showing???

Started by diagostimo, March 06, 2012, 08:44:21 pm

Previous topic - Next topic

diagostimo

March 06, 2012, 08:44:21 pm Last Edit: March 06, 2012, 08:45:43 pm by diagostimo
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 :(

G_G

This
if $index1_name = ""

Should read
if $index1_name == ""

diagostimo

March 06, 2012, 09:37:36 pm #2 Last Edit: March 06, 2012, 09:40:05 pm by diagostimo
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?

G_G

Thats because you changed the variable.
if index1_name == ""

Shouldn't it be
if $index1_name == ""

diagostimo

oops my bad, pesky little $ signs :P thanks man

diagostimo

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?

G_G

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

diagostimo

cool, i did understand how super worked, but thought it could be simply redirected into editables, and thanks, your help is always appreciated :D