[Vx Ace] msgbox_p left out focus on Ubuntu

EDIT: There is nothing wrong in my code... The problem I actually encountered is explained in my second reply.


-----------------------------------------------------------------------------------------------------


Original question (when I thought that the problem was on my script code):


-----------------------------------------------------------------------------------------------------


Hi. I'm trying to learning how to script with a direct approach ('try, debug, fix').
I started pasting this script code in the script editor ("Materials" directory):

Spoiler
module Unqou; module Translator
 
  dictionary = nil
 
  # todo
  def self.initialize()
    @dictionary="test"
  end
 
  def self.debug()
    msgbox_p( @dictionary )
  end


end; end # end of Unqou::Translator

I created a "key press" event in my map, and I added those 3 script commands

Spoiler
@>Script:  Unqou::Translator::debug()
@>Script:  Unqou::Translator::initialize()
@>Script:  Unqou::Translator::debug()

When I try to talk to my event, it displays, as expected two messages:
1) nil
2) "test"


But, after that, the game freezes like the event was still running (you cannot control your character nor you can access to menu using ESC).
I also tryed to add a "text" command after the last debug() script call... well the message is displayed, but the game freezes the same (the message stay displayed and you cannot gain back controls).


Any idea why I am encountering this problem?


EDIT: I saw I posted in the wrong section... (it is a 'learning ruby on vx ace' question)... very sorry (a mod is welcomed to move this topic)... sorry again
I've moved this thread to learning Ruby. Please be sure to post your threads in the correct forum next time. Thank you.



If the script freezes the game, then most probably you made a loop outside the main game loop, or broke that loop (preventing it from continuing).


I didn't check your script and I might be wrong about that, but that would be my first guess if everything else still works.


You might want to follow the link "Bughunting" in my signature to learn a bit more about the game loop - but that's the main reason why parallel processes in eventing are better than scripting for some types of tasks - the engine is programmed in a way that the game loop is easier maintained with parallel processes than with scripts that add to the game loop.
Thank a lot for your bug-hunting link. It is a very nice article for beginners, very well written 🙂


When you discussed about "looping" you allowed me to discover the problem, even if the problem has nothing to do with the code I used, but happened for a very different reason.


To explain better: neither the script in script editor, nor the script commands inserted in the game freezed the game. More in detail the game actually wasn't freezed at all... but "losing all the controls" was a downside effect of using msgbox_p for debug purposes, since it creates a new window, so the game windows loses its focus status (so you have to switch to another windows, and come back to game window to focus it again).


This probably happens becouse I'm not using RpgMaker VX Ace on Windows, but I am using it on Ubuntu (using steam wine client launched with PlayOnLinux, since I buyed vx ace from steam).


Probably, next time, I will check the "script equivalent" for the textbox instead of using msgbox_p, so I will not lose focus again 😉


Thank a lot for your help, your hint allowed me to "switch on" a light in my mind 🙂

Original thread: https://forums.rpgmakerweb.com/threads/vx-ace-msgbox_p-left-out-focus-on-ubuntu.59494/