Adding "Show Picture" to menu

Hi again guys.

First, I want to tell you that I can't believe how fast people here come with solutions for people like me. I've never seen anything like that (I'm not a forum person). From now on, I'll try my best to help people in trouble, with the little I know.

Now the problem, I've been trying to make a new scene in my menu called "Controls" where it shows a picture of the size of the screen with the controls the game uses.

I use XS-Menu Deluxe but I'm not sure that matters.

I added this in "Scene_Menu"

#-------------------------------------------------------------------------- # * Create Command Window #-------------------------------------------------------------------------- def create_command_window @command_window = Window_MenuCommand.new @command_window.set_handler🙂item, method🙂command_item)) @command_window.set_handler🙂skill, method🙂command_personal)) @command_window.set_handler🙂equip, method🙂command_personal)) @command_window.set_handler🙂status, method🙂command_personal)) @command_window.set_handler🙂formation, method🙂command_formation)) @command_window.set_handler🙂save, method🙂command_save)) @command_window.set_handler🙂game_end, method🙂command_game_end)) @command_window.set_handler🙂controls, method🙂command_show_controls)) @command_window.set_handler🙂cancel, method🙂return_scene)) endand this under [End Game] Command.

#-------------------------------------------------------------------------- # * [Controls] Command #-------------------------------------------------------------------------- def command_show_controls screen.pictures[index].show(keys, center, 0, 0, 0, 0, 100, 0) end"keys" is the name of the file, I'm not sure if "index" should be "Pictures" (being the folder where the picture is located) but I also tried that so that's not the problem.

Whenever I click the new option in the game, the menu duplicates, and doesn't show the picture. Then I have to press Cancel as many times as I pressed Action. It seems to re-open the menu when I click it.

Any ideas?

EDIT: this is the code in XS - Menu Deluxe for the controls scene

Code:
        # symbol => [name, description, icon_index, enabled, personal, custom]    MENU_LIST = {      :item      => ["", "Browse through your acquired items.", 4148, true, false],      :equip     => ["Equipment", "Change your equipment.", 4145, true, true],      :skill     => ["Spells", "Manage your available skills.", 4147, true, true],      :status    => ["Stats", "See the current status of the hero.", 4136, true, true],      :formation => ["", "Change the formation of the party.", 4134, true, false],      :save      => ["", "Record your progress.", 4139, true, false],      :load      => ["", "Load your saved progress.", 4165, true, false, Scene_Load],      :game_end  => ["Settings", "Change settings...", 4162, true, false],      :controls  => ["Controls", "Show controls", 4162, true, false, Scene_Menu],      :shutdown  => ["Exit", "Close the game.", 4133, true, false, Scene_Title],      :com_event => ["Camping", "Run common event camping.", 0, true, false, 1]    } # Don't remove this line!   
Please provide a link to the script you're using, we can't know the thousands of scripts out there. Preferable a link to the page where the script is descibed, not a direct download link.


I've moved this thread to Script Support. Please be sure to post your threads in the correct forum next time. Thank you.
Link provided. XS - Menu Deluxe might be the only script involved. I'm editing Scene_Menu mostly.

Also, sorry for the misplace of the topic.
WoW I think I'm making my first mini-script (really basic though).

I created a new scene called "Scene_Controls" and linked everything to that script.

#==============================================================================# ** Scene_Status#------------------------------------------------------------------------------# This class performs the status screen processing.#==============================================================================class Scene_Controls < Scene_MenuBase #-------------------------------------------------------------------------- # * Start Processing #-------------------------------------------------------------------------- def start super @screen.pictures[Pictures].show(keys, 0, 0, 0, 0, 0, 100, 0) @status_window.set_handler🙂cancel, method🙂return_scene)) endendEverything works exept when I click Controls in game, it crashes and tells me that "pictures" in line 14 isn't a method.

What's wrong there?
Torqus, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.

Everything works exept when I click Controls in game, it crashes and tells me that "pictures" in line 14 isn't a method.


What's wrong there?
Please provide a screenshot of the exact error message - there are several parts where programming languages are case-sensitive, and since you mixed lower and upper cases we need to know which one really caused the problem...
isn't a method of what - Nil:nilclass?


It's possible that @screen is not a property of your new scene.
Maybe try to add this to beginning of start method

@screen = Game_Screen.newAnd if it crashes with something related to @status_window is not defined, then try to add to the beginning, also

@status_window = Window_Selectable.new(0, 0, 100, 100)@status_window.opacity = 0Although it's still not the proper way, but since you started with @status_window...

OR

I think that you don't need to make a new scene,

In XS Menu Delux, if you put a number in the place of "custom" (currently being used by Scene_Controls) it will start a common event with that number.

So just make a common event that shows the picture.
[IMG]http://i1135.photobucket.com/albums/m639/Torqus7/Untitlffed.png[/IMG]

It still doesn't work Kocka. I tried everything. It crashes with a practically similar error in the same line as before.

I don't really know the programming language, I'm just taking pieces from other scripts. I just duplicated Scene_Status and deleted things I thought were unnecessary.

If someone could test it and tell me the exact syntaxis of the line(s), that would be perfect.
Try the thing from the edited post above, I think I did something like that when I used to use XS Menu (and Nicke's scripts in general)
Oh god I'm so stupid, I didn't realize that. Thank you so much. I was so blinded by the idea of making a new Scene that I forgot the common event.

EDIT: While it works, and I could go with that, now the "Show Picture" isn't part of the menu so, when clicked, it waits for the menu closing animation and then shows up, also tinted by the Advanced Time I'm using. It is really ugly, I'll see if I can at least remove the tint from pictures, but it would be nice if I could implement the "Show Picture" in the menu as intended before.
You don't use 'show picture' command in coding. Leave that to the events.


If you want to show a picture, simply use a sprite and assign the image you want to show for it.


Position it where you want and you are done.


The most common error new scripters make is to try to use the built in event commands for everything (I did it too, so no shame in that 😛 ) even in their own scripts.


Most of the things (if not all) can be done much simpler by using simple built-in classes and methods (the Sprite class is just one example).


I suggest you look up the help files regarding the RGSS in the editor (press F1 to bring it up). Many useful things are there to get you started on the real coding way.
It's true what @Sixth said.

For example, if you wanted to use Show Picture in a script with the Game_Interpreter implementation, you would need to setup the whole Game_Screen (and that can be complicated)

But, if you use a Sprite (or a Window, but most likely a Sprite) in your Scene it should look somewhat like this

def start  @sprite = Sprite.new  @sprite.bitmap = Cache.picture("Your picture")enddef terminate  @sprite.bitmap.dispose  @sprite.disposeendAnd that should be about it (I'm not sure, I'm not very good with Sprites, however)

If you try both ways, you may notice the difference in length and readability.
Sixth, thanks for the tip. It'll save me a lot of time now that I wont be trying event commands in scripts. And I can see why everyone makes this mistake, we should read the manual when we start making a game.

Nice! It's practically done, the only problem now is that when the image shows up, I can't go back with escape or any "back" key. It's stuck there.

This is the Scene_Controls script

#==============================================================================# ** Scene_Controls#------------------------------------------------------------------------------# This class shows the controls picture.#==============================================================================class Scene_Controls < Scene_MenuBase #-------------------------------------------------------------------------- # * Start Processing #-------------------------------------------------------------------------- def start @sprite = Sprite.new @sprite.bitmap = Cache.picture("keys") end def terminate @sprite.bitmap.dispose @sprite.dispose endendI tried adding different codes but none worked. I don't get the what's the difference with other Scenes.

@status_window.set_handler🙂cancel, method🙂return_scene))andreturn_scene"return_scene" should be supposed to go back instantly, without action from the player, but it doesn't work.
Hmmm...

Why don't you use Common Events?

It's a lot more easier.

I provided the code above just to demonstrate how easy will it be without the Game_Interpreter implementations, but when you can do it simply with Event Commands, why not?

But, if you really want to do it with a Scene then try to add this code below start method

Code:
def update  super  return_scene if Input.trigger?(:B)end
It doesn't seem to work, I even tried to modify Scene_Menu to duplicate the Status window and replacing every "status" word with "controls". Didn't work either.

I want it to be in the menu because with Common Events it waits until the menu is closed and THEN opens the picture, doing a weird looking transition. It doesn't fit the game, but it's a last alternative.

AAaa It's so close, I mean, the option works excellent, but it doesn't go back.
What does not work?

Try to add this code

#==============================================================================# ** Scene_Controls#------------------------------------------------------------------------------# This class shows the controls picture.#============================================================================== class Scene_Controls < Scene_MenuBase #-------------------------------------------------------------------------- # * Start Processing #-------------------------------------------------------------------------- def start @sprite = Sprite.new @sprite.bitmap = Cache.picture("keys") end   def terminate @sprite.bitmap.dispose @sprite.dispose end def update  super    return_scene if Input.trigger?🙂    p "A"  endendThen open the console.

If you see that "A" is being logged constantly (that means, if you see console spammed with A's) then it might be working.

Then try to click the Menu Back button (X)

If it does not work, then I don't know what's the problem.
Kocka you are a lifesaver, I love you.

I don't know what I did wrong before but it works now.

This is the final code for anyone having the same problem:

Code:
	#==============================================================================	# ** Scene_Controls	#------------------------------------------------------------------------------	# This class shows the controls picture.	#==============================================================================	 	class Scene_Controls < Scene_MenuBase	#--------------------------------------------------------------------------	# * Start Processing	#--------------------------------------------------------------------------	def start	@sprite = Sprite.new	@sprite.bitmap = Cache.picture("keys")	end	 	def terminate	@sprite.bitmap.dispose	@sprite.dispose  end   def update    super    return_scene if Input.trigger?(:  end	end
By the way do you know how to make the picture appear, and if the player presses Action again, it shows the next pic? I'm playing with "update" right now but I can't get it.

It's for a "Credits" scene. Even better if I can make an animation of scrolling picture. But if that's too hard I'll investigate it more or make a new thread later.

Original thread: https://forums.rpgmakerweb.com/threads/adding-show-picture-to-menu.43813/