Save-Point
How to make check if there's a message window? - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Games Development (https://www.save-point.org/forum-4.html)
+--- Forum: General Support (https://www.save-point.org/forum-18.html)
+--- Thread: How to make check if there's a message window? (/thread-7566.html)



How to make check if there's a message window? - Pelip - 10-26-2019

So basically, I have a little common event that runs commands depending on which number key you press, and I wanted to enable it only if there's not message windows, or maybe to make it to force to shut all the message windows, but how I do that?

 I tried to put the commands in a conditional branch with the script "$scene != Window_Message.new" but it didn't work. I mean, the game keeps doing the commands even if there's a message window, so it's like if the game ignored that code for some reason.


RE: How to make check if there's a message window? - kyonides - 10-27-2019

You could try something like...

$game_temp.message_window_showing = false

...or add a snippet...

Code:
class Window_Message
  alias :forum_request_win_mess_up :update
  def update
    forum_request_win_mess_up
    return unless @contents_showing and $game_temp.common_event_id > 0
    if Input.trigger?(Input::BUTTON) or Input.trigger?(Input::ANOTHER_BUTTON)
      terminate_message
    end
  end
end

There you need to replace BUTTON and ANOTHER_BUTTON with the actual names of the buttons you will use. You don't know what are their names!? Then Take a look at the window that opens whenever you press F1! There you can find all of them.


RE: How to make check if there's a message window? - Pelip - 10-27-2019

(10-27-2019, 12:06 AM)kyonides Wrote: You could try something like...

$game_temp.message_window_showing = false

...or add a snippet...

Code:
class Window_Message
 alias :forum_request_win_mess_up :update
 def update
   forum_request_win_mess_up
   return unless @contents_showing and $game_temp.common_event_id > 0
   if Input.trigger?(Input::BUTTON) or Input.trigger?(Input::ANOTHER_BUTTON)
     terminate_message
   end
 end
end

There you need to replace BUTTON and ANOTHER_BUTTON with the actual names of the buttons you will use. You don't know what are their names!? Then Take a look at the window that opens whenever you press F1! There you can find all of them.

I dunno if it's compatible with UMS and some other scripts I have, also the keys are from a keyboard script. So it's more simple if i simply check if there's a message window showing.


RE: How to make check if there's a message window? - kyonides - 10-27-2019

Then replace Input::BUTTON and Input::ANOTHER_BUTTON with those found in such script.


RE: How to make check if there's a message window? - Pelip - 11-01-2019

(10-27-2019, 10:33 PM)kyonides Wrote: Then replace Input::BUTTON and Input::ANOTHER_BUTTON with those found in such script.

I also said that i don't know if UMS it's compatible, and if I interrupt a message the event keeps going and it shows the other one that it's next it. Really, I'd prefer to use the other method instead, can someone tell me how to check if there's a message window then?

Or maybe to enable a switch everytime a message window is shown and disable it everytime it will be disposed.


RE: How to make check if there's a message window? - kyonides - 11-01-2019

I know you think that might be better for you, and probably it'd be... The issue here is that there are times where you can only rely on scripts to alter the default behavior of the engine. I should yell this at you to let you understand what it means, but I'll try to be nice here. Laughing + Tongue sticking out You or any if the scripters can make it compatible with any script if given the chance and enough data to work with. What I suggested some time ago isn't complicated... for a scripter at least.

If you plan to use such feature only once, perhaps it'd be better for you to use an event or common event. Otherwise a script should care of it to avoid getting a cluttered event that gets hard to get debugged. And nope, I don't focus on eventing. Laughing


RE: How to make check if there's a message window? - DerVVulfman - 11-04-2019

Let's not over-analyze this. If you just want to make some action work in an event, consider this bit of code....

Code:
@>Conditional Branch: Script: $game_temp.message_window_showing != true
    @> Play SE: '032-Switch01' 80, 100
    @> Wait 20 frame(s)
    @>
: Branch End
@>

This plays the Tick sound effect and throws up a 20frame delay afterwards, but it only runs IF the message window is not showing. This example SHOULD work with ccoa's UMS as it still uses the message_window_showing value in Game_Temp.