[XP] Show the Gold window without needing a Message Box?

Hello all!

I'd like to open the gold window during an event, without needing to open a message box. The shop in my game is a catalogue, you can only buy each item once, and I used ForeverZero's Show Choices so I could move the text box over to the side of the screen, like so:

Troubleshooting Catalogue 1.png


I'd like to add a window for the current gold somewhere in the bottom right corner, but I can't quite get it to work using the \g in a message box. Even if I hide the message box, I have to click through the text window before I can make a choice, which makes the gold window go away--which is not super-helpful as far as knowing how much money you're spending goes!

My event code, without any gold-showing commands in it (and without the guts that actually power the purchases) is this:

Troubleshooting Catalogue 2.png


Is there maybe a script call that can show the gold window, without needing to go via a message box? Is there some other obvious option that I'm missing? Since there's only a finite number of things you can buy and combinations you can buy them in, should I just make multiple versions of the shop image that have the possible outcomes of gold baked in? That might be the least fuss XD

Thank you!
There's no built-in script call, but you can do this:
Ruby:
@_gold_win = Window_Gold.new
@_gold_win.x = ...
@_gold_win.y = ...
@_gold_win.opacity = ...
# set whatever window properties you want ...
If you want the window to update after the purchase, make this call right after 'Change Gold':
Code:
@_gold_win.refresh
And when you're done looking at the window, do
Code:
@_gold_win.dispose
It worked like a charm! Thank you so much!
Or I thought it had worked like a charm, anyways--I have a question about an error I'm getting when I have the gold window commands in!

Upon saving after interacting with the catalogue, I get this error:

Gold Window Save Error.png


And then if I try to load from the file I tried to save to, I get this one:

Gold Window Load Error.png


Which is persistent, even if you start a new game and try to save over that slot. (Deleting the save and starting clean does work.)

These errors don't show up if you don't interact with the catalogue, and they don't show up if I remove the gold window from the catalogue interface. I've attached screenshots of my event--did I put the script bits in wrong? Is there something else I need to do? Please advise!



I don't think any of my scripts affect the gold window or the save file window (and since the error doesn't occur with them in place, I don't think they're related) but just in case, I'm using:

Lambchop's Super Simple Journal Script
Paradog's Custom Title Script
Rune and ModernAlgebra's One-Man CMS
Trihan's Message Script
ForeverZero's Message Choice Window.

I can dig up links to most of these as needed (the journal script was lost in the forum shuffle).


Thank you!
Whoops, forgot that you need to nil out the variable after the dispose.
Code:
@_gold_win = nil

If you want to make these script calls cleaner, you can add this script (and making modifications that fit your game):
Code:
class Interpreter
  def open_gold_window
    @_gold_window = Window_Gold.new
    @_gold_window.x = 640 - @_gold_window.width
  end
  def update_gold_window
    @_gold_window.refresh
  end
  def close_gold_window
    @_gold_window.dispose
    @_gold_window = nil
  end
end
Ah, thank you! That fixed it!

I'd love to use the script for cleaner script calls, but I'm not quite following how to tell it where to position the window. Do the window's coordinates and opacity go into the first script call with the "open_gold_window," or do they go into the script under the "open_gold_window" definition?

Thank you so much for all your help!
Add your cordinates and opacity changes to the open_gold_window method. That's why I had the change in X expressed there.
I tried it there, but it didn't show up on the screen--I'll keep playing with it, I must've gotten something mixed up. If all else fails, I can fall back on leaving it all in script calls.

Thank you so much!
Care to share what you did? If it's just what you have in your event screenshot, then it should just be
Code:
  def open_gold_window
    @_gold_window = Window_Gold.new
    @_gold_window.x = 374
    @_gold_window.y = 400
    @_gold_window.opacity = 255 #<== redundant BTW, it's already 255 by default
  end
That's what I thought, and that's what I filled in--adjusted to the correct coordinates once I realized they were not actually centered with the choice window above--and still no-show. I also realized that I had "gold_win" and not "gold_window," but fixing that didn't put the window in either.

It's entirely possible I put something (up to and including the entire script) in completely the wrong place, my knowledge of scripting is limited at best XD Thank you for taking the time to help me!
Methods don't have @ in front of them. @ are for instance variables.
The click as I figured out what I mixed up to to get to this point was audible XD

I added the @s because it was crashing and giving me errors without them, the first time--but in hindsight, I bet that was because of the gold_win/gold_window mix-up I had. It's working just as it's supposed to now!

Thank you so, so much for all your help!

Original thread: https://forums.rpgmakerweb.com/threads/xp-show-the-gold-window-without-needing-a-message-box.149596/