The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: Xelrog T. Apocalypse on June 07, 2013, 10:42:15 PM

Title: Press Any Key Script (Quickie Fix)
Post by: Xelrog T. Apocalypse on June 07, 2013, 10:42:15 PM
I've been browsing around for a script that will allow me to hide the "New Game/Continue/Shut Down" box on the title screen until a key is pressed, and thus far this one (http://pastebin.com/raw.php?i=H50rxxKA) is the only one I've come across.

Unfortunately, there seems to be an argument error occurring in line 30, stating "wrong number of arguments (2 for 4)." While I'm no scripter myself, I usually understand enough of the logic to troubleshoot these kinds of errors, but this one has me stumped as to the arguments it's referring to. The original scripter, LiTTleDRAgo, doesn't seem to have been a very active member of the community, so I can't really contact him. Hence why I'm posting here.

I'm using virtually no other scripts on this project, and the one or two I am using aren't related to the title generation, so the chance that it's a conflict between scripts is slim to none. Does anyone have any idea what the problem might be?

For reference, line 30 is the fourth line in the following block:

Code: [Select]
  alias init_drgprs_btn initialize unless method_defined?(:init_drgprs_btn)
  def initialize *args
    press_any_button if scene.is_a? Scene_Title
    init_drgprs_btn *args
  end
Title: Re: Press Any Key Script (Quickie Fix)
Post by: LoganF on June 09, 2013, 06:24:33 PM
Whilst it might not affect the title screen directly, this script does modify Window_Command which may be implicitly affecting the title screen process.

The script works fine with my project in VXAce. I haven't tested it with the other two platforms.

I would suggest making a brand new project with no additional scripts and see if you still get the problem. If you get the problem with no scripts, it is likely an issue with the version you have. If you don't get the problem, it is likely a conflict with the other scripts you are using.

A good troubleshooting tip is to not assume that one script doesn't interfere with another on the principle that they have different themes. Their code may contain parts which do interact in some way, which may be the root of the issue.
Title: Re: Press Any Key Script (Quickie Fix)
Post by: Xelrog T. Apocalypse on June 10, 2013, 04:47:31 PM
I tried the script in a brand new project with no other scripts and encountered the same error. The script was designed to work in RMXP, so it's not just a matter of the script being written for the wrong program. I'm not sure what's causing that line 30 error, though.
Title: Re: Press Any Key Script (Quickie Fix)
Post by: Xelrog T. Apocalypse on June 15, 2013, 04:41:31 PM
No suggestions on how to resolve this error?
Title: Re: Press Any Key Script (Quickie Fix)
Post by: modern algebra on June 15, 2013, 11:23:49 PM
It's difficult to see how that line, by itself, could cause an arguments error (though perhaps this is a failure of imagination on my part). Essentially, the script is only aliasing and redefining the initialize method of Window_Command. It doesn't do anything to the arguments; it takes them as they are passed and then passes them to the original method exactly as they came to it. As such, the error is technically not in that method. Rather it has to do with something creating a new Window_Command object and passing 4 arguments instead of 2.

Since nothing in this script creates a Window_Command, it has to be something external to the script, and it ought to happen whether or not this script is in your game. Assuming you haven't altered anything in the linked script, I would predict that the error would occur even if you removed this script from your project, and then the error would at least lead you to the right place.

If you share the new project where you are getting the error, then I might be able to take a look. As it is, inserting the clean script into a clean project does not create any error.
Title: Re: Press Any Key Script (Quickie Fix)
Post by: Xelrog T. Apocalypse on June 16, 2013, 12:47:52 AM
It is creating an error in a clean project for me. Here's (http://www.newgrounds.com/dump/item/c9adbe594abb3fc36f96d3105d2f7613) a new, clean project with the script replacing Window_Command.

It might be worth noting that I'm apparently using an "old version" of RMXP. I sent a friend of mine some of our old projects we started years ago after he recently re-installed RMXP, and they wouldn't work for him without him resolving a bunch of DLL/compatibility issues first. He got the error message that the projects were made in an old version of RMXP.
Title: Re: Press Any Key Script (Quickie Fix)
Post by: modern algebra on June 16, 2013, 01:01:15 AM
Oh, it's not the version; it's the fact that you're deleting the original Window_Command. This script isn't meant to replace Window_Command. For it to work, the original Window_Command still needs to be in your project.

All you need to do is create a new slot right above Main and paste the new script into that.

See D&P3's guide for inserting scripts: How to Insert & Utilize a script (http://rmrk.net/index.php/topic,46709.0.html)
Title: Re: Press Any Key Script (Quickie Fix)
Post by: Xelrog T. Apocalypse on June 16, 2013, 01:13:30 AM
...well, that's misleading. I know how most scripts are inserted, but there are plenty made to replace existing RMXP scripts, too, and considering that this one started with the exact same title and formatting as Window_Command, and it didn't contain any instructions implying otherwise, I had just assumed this was one of those scripts.

It's working now, though. Don't I feel like a goof. Thanks.
Title: Re: Press Any Key Script (Quickie Fix)
Post by: modern algebra on June 16, 2013, 12:12:35 PM
Yeah, that's alright. I kind of forgot that in RMXP, there were a lot of scripts that directly modified the default scripts.

That practice is strongly discouraged and very rare in RMVX and RMVX Ace (for good reasons), so LiTTleDraGo probably didn't even realize it was something that needed to be instructed not to do.