Jump to content
Sign in to follow this  
Lamsah

Cancelling Dialogue or Message Box?

Recommended Posts

Hi.

 

Anyone know how to cancel a message box along with the event when player doesnt push any buttons when talking to an event? Basically, to force the message box to cancel, exit, or go away along with the event associated with it when player doesnt do anything so that other events can process.

 

I tried the $game_message.clear thats parallel processed by another event however, this does not clear the current message box displayed. All it does is it stops the next line from processing but does not exit the current message thats displayed or exit the entire event.  

 

 

Share this post


Link to post
Share on other sites

I can make a script for you if you'd prefer. I doubt it can be done with eventing alone.

Share this post


Link to post
Share on other sites

 


#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

# Idle Dialogue Exit

# Version: 1.0

# Author: DiamondandPlatinum3

# Date: July 23, 2013

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# Description:

#

# This script creates allows you to set an automatic continuation when your

# player is not being responsive.

# Basically if your player has not read the text in the textbox before a

# specified amount of time, you can allow it so that the NPC talking to them

# can do one of two things.

# 1) Move on to the Next Event Command (this is just the next command

# in the list; so it may be another text box or a battle)

# 2) Exit event processing entirely. This NPC will start doing all the

# things they were doing before you bothered them and act like you

# never spoke to them

#

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#------------------------------------------------------------------------------

# Instructions:

#

# ~ Just before a Textbox you wish Idle Dialogue Rules to apply, you must

# insert the following script call:

# begin_idle_dialogue_exit(seconds)

# Replacing 'seconds' with the time you will allow. This is done with decimals

# ie: Five seconds would be inputted as 5.0, or you can have it wait for 5.3

# seconds, etc.

#

#

# ~ By default the NPCs will just skip to their next event command when being

# ignored. If you'd like them to quit event processing, you must add 'true'

# inside that script call:

# begin_idle_dialogue_exit(seconds, true)

# Now whenever you ignore an NPC, they will quit event processing.

#

#

# ~ Example Screenshot of above can be found here:

# http://img4host.net/upload/2305412051edfb60675d9.png

#

#------------------------------------------------------------------------------

#

# THERE IS NO EDITABLE REGION TO THIS SCRIPT

#

#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

 

 

 

#==============================================================================

# ** Game_Temp

#------------------------------------------------------------------------------

# This class handles temporary data that is not included with save data.

# The instance of this class is referenced by $game_temp.

#==============================================================================

 

class Game_Temp

#--------------------------------------------------------------------------

# * Struct.new

#--------------------------------------------------------------------------

DialogueIdleCancel = Struct.new(:active, :event_id, :start_time, :idle_time, :exit_event_processing) do

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# * New Method: Start

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

def start(seconds, evnt_id, exit_processing)

self.event_id = evnt_id

self.exit_event_processing = exit_processing

self.idle_time = seconds

enable()

reset_start_timer()

end

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# * New Method: Total Game Time

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

def total_game_time()

return (Graphics.frame_count.to_f / Graphics.frame_rate)

end

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# * New Method: Current Time

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

def current_time()

return (total_game_time() - self.start_time)

end

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# * New Method: Time is Up?

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

def time_up?()

return (active?() && (current_time() > self.idle_time))

end

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# * New Method: Enable

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

def enable()

self.active = true

end

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# * New Method: Disable

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

def disable()

self.active = false

end

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# * New Method: Reset Event

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

def reset_event()

$game_message.clear()

$game_map.events[self.event_id].dp3_get_local_interpreter_instance().dp3_cleareventcommandslist() if self.exit_event_processing

end

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# * New Method: Reset All

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

def reset()

reset_event()

disable()

end

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# * New Method: Reset Start Timer

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

def reset_start_timer()

self.start_time = total_game_time()

end

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# * New Method: Am I Active?

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

def active?()

return self.active

end

end

#--------------------------------------------------------------------------

# * Public Instance Variables

#--------------------------------------------------------------------------

attr_reader :dp3_idledialoguecancel_instance # Instance of DialogueIdleCancel

#--------------------------------------------------------------------------

# * Object Initialization

#--------------------------------------------------------------------------

alias dp3_dialogueidlecancel_gametemp_init_qpf7 initialize

def initialize(*args)

@dp3_idledialoguecancel_instance = DialogueIdleCancel.new(false, 0, 0.0, 0.0, false)

dp3_dialogueidlecancel_gametemp_init_qpf7(*args) # Call Original Method

end

end

 

 

 

#==============================================================================

# ** Window_Message

#------------------------------------------------------------------------------

# This message window is used to display text.

#==============================================================================

 

class Window_Message < Window_Base

#--------------------------------------------------------------------------

# * Input Pause Processing

#--------------------------------------------------------------------------

def input_pause

$game_temp.dp3_idledialoguecancel_instance.reset_start_timer()

 

#-------------Overwritten Area----------------#

# Needed to overwrite Fiber.Yield

self.pause = true

wait(10)

Fiber.yield until Input.trigger?(:B) || Input.trigger?(:C) || $game_temp.dp3_idledialoguecancel_instance.time_up?()

Input.update

self.pause = false

#-------------Overwritten Area----------------#

 

if $game_temp.dp3_idledialoguecancel_instance.time_up?()

$game_temp.dp3_idledialoguecancel_instance.reset()

end

end

end

 

 

 

#==============================================================================

# ** Game_Event

#------------------------------------------------------------------------------

# This class handles events. Functions include event page switching via

# condition determinants and running parallel process events. Used within the

# Game_Map class.

#==============================================================================

 

class Game_Event < Game_Character

#--------------------------------------------------------------------------

# * Get Local Interpreter Instance

#--------------------------------------------------------------------------

def dp3_get_local_interpreter_instance

return @intepreter if @interpreter

return $game_map.interpreter

end

end

 

 

 

 

#==============================================================================

# ** Game_Interpreter

#------------------------------------------------------------------------------

# An interpreter for executing event commands. This class is used within the

# Game_Map, Game_Troop, and Game_Event classes.

#==============================================================================

 

class Game_Interpreter

#--------------------------------------------------------------------------

# * Begin Idle Dialogue Cancel

#--------------------------------------------------------------------------

def begin_idle_dialogue_exit(seconds, exit_event_processing = false)

$game_temp.dp3_idledialoguecancel_instance.start(seconds.to_f, @event_id, exit_event_processing)

end

#--------------------------------------------------------------------------

# * Clear Event Commands List

#--------------------------------------------------------------------------

def dp3_cleareventcommandslist()

@list = []

end

end

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×