What should I do? (in script editor, about dispose window, rgss3)

I ask you again following the previous article.

Through a recent search, I learned how to remove certain windows.


For example, @window = Window_textbox.If you made a window with new,

@window.dispose has figured out how to delete that window.


However, I don't know how to apply this in the script editor.


First of all,

def deletebox
if Input trigger?( : B )
@window.dispose
end
end

I tried making it this way (if Input trigger?( : B ) in this line, ( and : and B are attachted.) but it didn't work.


How can I make it work?




* Below this is the full code.
[#spoiler]

class Window_Test < Window_Base
def initialize(x = 256,y = 192,width = 130, height = 50)

super(x,y,width,height)

end



def event_text(text)
return unless text.is_a?(String)
draw_text(text, 0, 0, 128, 25)
end






def draw_text(text, x, y, text_width, text_height, aligment = 0)
contents.draw_text(x, y, text_width, text_height, text, aligment)



end
end
[#/spoiler]
Send me a simple demo so I can take a look at it and leave some useful notes there on how to do it right and what's simple a terrible mistake or a bad design.
How can I send it to you?
Send me a simple demo so I can take a look at it and leave some useful notes there on how to do it right and what's simple a terrible mistake or a bad design.
You simply post a link here.

Here you are. The corresponding script was added after the project was created.
You simply post a link here.
This is weird. Your demo has no error except for the lack of a call for the window's dispose method. You know, you can't keep opening new windows every single time you talk to that lonely maid. That could be considered a very basic form of memory leak.
@kyonides ahem:
"Do you understand?" -> type mismatch, expected Boolean, got Nil.
This is weird. Your demo has no error except for the lack of a call for the window's dispose method. You know, you can't keep opening new windows every single time you talk to that lonely maid. That could be considered a very basic form of memory leak.
Yes, that's exactly what I want.

I want to make the window turn off when a particular key is pressed, such as a decision key or a cancel key, while the window is open.

But I don't know how.
@kyonides ahem:
"Do you understand?" -> type mismatch, expected Boolean, got Nil.
Does type mismatch mean that the types became out of sync while deleting the window?
I never got a type mismatch and I did dispose of the window. The only difference here might have been that I didn't add a push button condition. Even if I had, the event should close or exit right after the window gets disposed. If he didn't consider that ever before, he should start doing so from now on.
@kyonides my earlier post was a covert joke. 😉
@kyonides my earlier post was a covert joke. 😉
I never got a type mismatch and I did dispose of the window. The only difference here might have been that I didn't add a push button condition. Even if I had, the event should close or exit right after the window gets disposed. If he didn't consider that ever before, he should start doing so from now on.
I don't understand still...but I will try to find solution. And if I still don't find a solution, I'll ask you again. Thank you, everyone!

Original thread: https://forums.rpgmakerweb.com/threads/what-should-i-do-in-script-editor-about-dispose-window-rgss3.150290/