Chaos Project

RPG Maker => RPG Maker Scripts => Script Troubleshooting => Topic started by: chaucer on April 01, 2015, 12:09:08 am

Title: [Resolved]Skipping an Event
Post by: chaucer on April 01, 2015, 12:09:08 am
Hey all, I'm trying to create a way to skip certain events processing, I've created a small add on inside of interpreter class to exit the event processing, I can't seem to get it to work though and it's sort of begun to annoy me haha, so thought I'd ask for some advice here. So far what I have will close out any chat box that is opened, however your character remains frozen and I'm not quite sure how to unfreeze him at this point. I'm using default message systems, I'll post everything I've coded so far.

this is inside Window_Message Class

#skip if movie
     if $game_switches[8] && Input.trigger?(Input::Key['Esc'])
       terminate_scene
     end


which leads to terminate scene(exact same as terminate_message except 1 change)
Spoiler: ShowHide

def terminate_scene
   self.active = false
   self.pause = false
   self.index = -1
   self.contents.clear
   # Clear showing flag
   @contents_showing = false
   # Call message callback
   if $game_temp.message_proc != nil
    # $game_temp.message_proc <<<<
     @intr = Interpreter.new      <<<< Only Changes Made
     @intr.command_exit(15)     <<<<
   end
   # Clear variables related to text, choices, and number input
   $game_temp.message_text = nil
   $game_temp.message_proc = nil
   $game_temp.choice_start = 99
   $game_temp.choice_max = 0
   $game_temp.choice_cancel_type = 0
   $game_temp.choice_proc = nil
   $game_temp.num_input_start = 99
   $game_temp.num_input_variable_id = 0
   $game_temp.num_input_digits_max = 0
   # Open gold window
   if @gold_window != nil
     @gold_window.dispose
     @gold_window = nil
   end
 end


which then calls exit event command(everything commented out is what I've tried to this point)

#--------------------------------------------------------------------------
 # * Exit Event
 #--------------------------------------------------------------------------
 def command_exit(event_id)
   # Clear list of event command
     $game_map.events[event_id].list = nil #List is set to accessor & not reader
   # If main map event and event ID are valid
  # if $game_map.events[event_id].id > 0
     # Unlock event
     #$game_map.events[event_id].unlock
     # erase event
     $game_map.events[event_id].erase
   #end
 end


so... any thoughts? I've also tried just using the event loop command, that's what I had orginally planned, however it don't seem to work for some reason, so kinda stumped on that one too.
Title: Re: Skipping an Event
Post by: KK20 on April 01, 2015, 12:37:02 am
Placed below the check for C is triggered if-block.

      if $game_switches[8] && Input.trigger?(Input::Key['Esc'])
        terminate_message
        $game_system.map_interpreter.command_end
      end


Line of Reasoning: ShowHide

Game Player input is ignored when any of the following are true:

    unless moving? or $game_system.map_interpreter.running? or
           @move_route_forcing or $game_temp.message_window_showing

Because we're dealing with message events, $game_system.map_interpreter.running? and $game_temp.message_window_showing are our biggest concerns. $game_temp.message_window_showing is already handled with in Window_Message by calling terminate_message. As for $game_system.map_interpreter.running?, this returns true if @list is not nil.

Digging into the Interpreter classes a bit (using CTRL + SHIFT + F for @list), I found where it gets set to nil by the method command_end. This same method is called when an event's commands have all been played out so this seemed like the logical solution to use.
Title: Re: Skipping an Event
Post by: chaucer on April 01, 2015, 12:56:50 am
ah man, I was looking where it was freezing the input but couldnt seem to find it, also I knew there was a way to call interpreter already!(just couldnt figure it out) :( I feel I overcomplicated this, big thanks for the help though, much appreciated, I've been struggling with this for quite a while lol.