Status
Not open for further replies.

Drakkonis

Veteran
Veteran
Joined
Mar 5, 2021
Messages
199
Reaction score
154
First Language
English
Primarily Uses
RMMZ
Hi all, back again for another "I'm tired of banging my head on the wall" question.

I'm working on a custom scene that heavily uses definable common events. To this end, I've stuck a Game_Interpreter object in the scene. Every scene update, I load a common event to run using $gameTemp.reserveCommonEvent, then update the interpreter so that it runs the event. So far, so good(though it was a major PITA just getting THAT far. Proper documentation on how to do some of this stuff seems to be sorely lacking).

The problem is apparently with one or more commands in the event. In this instance, as a test, I have it checking a variable calculation for a specific result, and displaying a message using the show text event when the result is achieved. I've confirmed that the event IS properly executing, including when the result I want is detected. However the message never actually appears. The script for the event takes the provided text and adds it to $gameMessage.... and that's it. Nothing else seems to be done after that, the interpreter simply continues with any remaining event commands. My scene doesn't display a message and certainly doesn't pause for acknowledgment of that message.

So what am I missing? Does my scene need something to handle/interact with $gameMessage? Am I perhaps missing something with the Game_Interpreter object?

Strictly speaking I don't NEED the $gameMessage and could finagle a workaround, but I would prefer common events used in my scene to function like they're SUPPOSED to.

In case it's needed, this is all the code involved:
Code:
if (this.scene.update > 0 && !this.interpreter.isRunning()) {
    $gameTemp.reserveCommonEvent(this.scene.update);
    this.interpreter.setup($dataCommonEvents[this.scene.update].list)
};
this.interpreter.update();

As I said, getting to run the common event seems to work just fine. Show text just isn't doing what it's supposed to. I haven't tried any other commands that could have a similar "impact" on the scene, I just tossed in something quick and dirty to try to get the general concept working.
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
2,028
Reaction score
1,504
First Language
Portuguese - Br
Primarily Uses
RMMZ
Hi there!

I never tried to do something like that, create the game interpreter on another scene. I will probably create something inside the map/battle scene if I want to use the game interpreter.

But custom scene extends the Scene_Base or the Scene_Message?
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,580
Reaction score
1,956
First Language
EN
Primarily Uses
RMMZ
Like Eli implies, if you want your scene to be able to show messages then by far the easiest way is to make it inherit (directly or indirectly) from Scene_Message.

A Game_Interpreter instance basically turns event commands into code. So yes, you'll need one of those to run a common event. By default interpreters are defined on $gameMap, $gameTroop, and any active parallel events.

Show Text manifests through an instance of Window_Message, which updates itself according to the status of $gameMessage. Scene_Message sets up this window as well as all the associated windows (name box, choices, number input, etc). By default, both the map and battle scenes inherit from Scene_Message.

If you have additional windows/flow control on your scene then you may also need some code to disable those inputs during Show Text etc.
 

Drakkonis

Veteran
Veteran
Joined
Mar 5, 2021
Messages
199
Reaction score
154
First Language
English
Primarily Uses
RMMZ
Hi there!

I never tried to do something like that, create the game interpreter on another scene. I will probably create something inside the map/battle scene if I want to use the game interpreter.

But custom scene extends the Scene_Base or the Scene_Message?
It's based off Scene_MenuBase. I don't have a plugin on hand that allows common event usage to peruse for inspiration, so I've had to cobble it together myself. I wouldn't be surprised if my current solution was very inefficient.

Like Eli implies, if you want your scene to be able to show messages then by far the easiest way is to make it inherit (directly or indirectly) from Scene_Message.

A Game_Interpreter instance basically turns event commands into code. So yes, you'll need one of those to run a common event. By default interpreters are defined on $gameMap, $gameTroop, and any active parallel events.

Show Text manifests through an instance of Window_Message, which updates itself according to the status of $gameMessage. Scene_Message sets up this window as well as all the associated windows (name box, choices, number input, etc). By default, both the map and battle scenes inherit from Scene_Message.

If you have additional windows/flow control on your scene then you may also need some code to disable those inputs during Show Text etc.
I do indeed have other stuff happening in the scene, including command buttons also linked to common events(though I haven't set those up yet, I only have them drawn, not functional. Still learning everything I need and I'm taking it one step at a time). I saw the map scene basically pausing if a common event was running, so I figured I might have to do the same, hence why the interpreter running check is in the update code(in that case, thinking it was related to my problem).

Sounds like I need to create a message window and its associated accessories then. I'll tinker with that and see if that does the trick.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,699
Reaction score
2,800
First Language
English
Primarily Uses
RMMZ
It's based off Scene_MenuBase. I don't have a plugin on hand that allows common event usage to peruse for inspiration, so I've had to cobble it together myself. I wouldn't be surprised if my current solution was very inefficient.


I do indeed have other stuff happening in the scene, including command buttons also linked to common events(though I haven't set those up yet, I only have them drawn, not functional. Still learning everything I need and I'm taking it one step at a time). I saw the map scene basically pausing if a common event was running, so I figured I might have to do the same, hence why the interpreter running check is in the update code(in that case, thinking it was related to my problem).

Sounds like I need to create a message window and its associated accessories then. I'll tinker with that and see if that does the trick.
Yeah, as has already been pointed out, the reason it doesn't do anything is that Scene_MenuBase doesn't create a message window, so even though the text is there in the buffer it has nowhere to display it yet.
 

Drakkonis

Veteran
Veteran
Joined
Mar 5, 2021
Messages
199
Reaction score
154
First Language
English
Primarily Uses
RMMZ
I do believe I have solved the problem. Still setting it up, but the basics are working.

I assigned all functions for Scene_Message to my custom scene using Object.assign, since Scene_Message doesn't have any common functions that would overwrite, then I call its initialize immediately after. I have to manually update all the windows that scene creates, but that's not much of a problem, and I already have something planned for that.

All my other stuff still runs, but I haven't added in anything that will pause that while the window's up yet. If I have an issue with that, it's a separate problem, but I'm sure I'll be able to figure it out on my own, since half of that is my own setup.

Thanks for all the help and insights! VERY much appreciated!
 

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
16,075
Reaction score
8,912
First Language
English
Primarily Uses
RMMV

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

We're playing one of the Touch the Stars game jam entries, come join us!
Wait wait wait. Is watermelon a fruit?
Huh, 7k downloads of my ****ty icons. That's more then I ever expected xD
User of Mv3d/ Mz3d and Rosse engine. New Resource Pack on development "Halloween Stones" . Leave ideas about what you want to see on this package. :)
SetPreview.jpg
Looking at Code abd knowing that it made sense at one time. Ugh..why did I ever stop? Well I guess it will come back to me.

Forum statistics

Threads
113,550
Messages
1,075,778
Members
147,545
Latest member
milongajr
Top