Main Menu
  • Welcome to The RPG Maker Resource Kit.

Help with scene script

Started by Shadow Eye, May 25, 2008, 07:45:47 PM

0 Members and 1 Guest are viewing this topic.

Shadow Eye

Okay, I'm new at scripting, so this is probably a stupid problem, but I seriously need help because I can't figure this out for the life of me. I made this script to show a list in the game of your skills, such as Fishing, Rune Reading, Smithing, etc. I got it to open and close correctly(opening bypressing a key through a Common Event and close though the typical scripting way), but if you try to open it again after already doing it once, the game gets an error. YOu know, one of those gay ones that say "(BLANK) has encountered an error and needs to close. We're sorry for the inconvienence" or something like that. So, what did I do wrong in this script?

#########################################################################
#Scene_SkillList
#####################################################################

class Scene_SkillList
  def main
    @skilllist_window = Window_SkillList.new
    @skilllist_window.x = 0
    @skilllist_window.y = 0
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @skilllist_window.dispose
  end

#Update
  def update
    @skilllist_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end
  end
end

#################################################################
#Window_SkillList
#################################################################
class Window_SkillList < Window_Base
  def initialize
    super(0, 0, 250, 480)
    @background = Spriteset_Map.new
    self.contents = Bitmap.new(width - 32, height - 32)
    add_contents
    refresh
  end
  #Refresh
  def refresh
    self.contents.clear
    add_contents
  end
  #Contents
  def add_contents
    contents.draw_text(0, 0, 80, 32, "Skill List")
    contents.draw_text(0, 30, 120, 32, "Rune Reading")
  end
end

Falcon

http://rmrk.net/index.php/topic,19774.0.html
Why don't you give us the fucking error? Maybe then someone will help you out.

Shadow Eye

Quote from: Shadow Eye on May 25, 2008, 07:45:47 PM"(BLANK) has encountered an error and needs to close. We're sorry for the inconvienence"

Just filll in the (BLANK) with Game.exe. That's the error I get. So, yeah, I did give the error. The thing that confuses me is, as I think you thought, it isn't a standard error for scripts, since normally the error tells you exactly whats wrong with the script. If it was a nromal error, I would just figure it out on my own, but this is a bit more confusing. And I know its the script because I've copied it into new projects, and the same error occurs.

Falcon

Is this a windows error, or an error that appears in the game.exe?

If it is a windows error, try not closing it, and see if you can get a game.exe error to apear.

Shadow Eye

I just tried leaving for a minute, but all it does is freeze up the game. You know, the kind of freeze that if you should drag the windows error box over the game window, the box kinds of pastes itself into it several times. Anyway, yeah, that's the only error I get. Maybe something in the script overloaded the engine when used twice? Just poking suggestions.

Falcon

#5
I don't know what's going on, I put the script in a new project and set an event to call the scene on an action button trigger, and it seems to work fine; I open it an close it multiple times with no errors.

You should put more info on how you're calling the scene or whatever.

Wait, I think I see your problem, you put the spriteset method in a weird place.

Try this:

#########################################################################
#Scene_SkillList
#####################################################################

class Scene_SkillList
  def main
    @skilllist_window = Window_SkillList.new
    @skilllist_window.x = 0
    @skilllist_window.y = 0
    @spriteset = Spriteset_Map.new
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @skilllist_window.dispose
    @spriteset.dispose
  end

#Update
  def update
    @skilllist_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end
  end
end

#################################################################
#Window_SkillList
#################################################################
class Window_SkillList < Window_Base
  def initialize
    super(0, 0, 250, 480)
    self.contents = Bitmap.new(width - 32, height - 32)
    add_contents
    refresh
  end
  #Refresh
  def refresh
    self.contents.clear
    add_contents
  end
  #Contents
  def add_contents
    contents.draw_text(0, 0, 80, 32, "Skill List")
    contents.draw_text(0, 30, 120, 32, "Rune Reading")
  end
end

Shadow Eye

#6
Yeah, I'm kind of a noob at scripting, so that's bound to happen.

Also, this just hit me, could it be conflicting with other scripts? I'm using that one, Leon's Shopping System, Synthesis' Point Based Level Up, and Charlie Lee's Weapon Enhancement Scripts, three of which are called by buttons. My script is called with 'X', the Leveling System is called with 'Y', and the Enhancement script is called with 'Z', in RMXP terms. Sorry if I'm being annoying, its just it really should be fine...

EDIT: Actually, nevermind, that works perfectly. And I see what you changed. Maybe it was that somehow? Either way, thanks man!

Falcon

Yeah, you called the spriteset_map but you never got rid of it, that was the problem. You hid that method in the window for some reason, so I missed it initially.