Jump to content
Sign in to follow this  
LucidK

Scripting a GUI

Recommended Posts

I have not once coded in RGSS3. I have coded in other languages, howeve, and I have a slightly above beginner level understanding of what I see when I read RGSS3 scripts. That being said, I'm looking for somebody to help me, in as much detail as possible, set up the following:

I am looking to write a couple of scripts that basically call up a separate menu with a series of pictures. I would like the pictures to change or highlight when the player is selecting that item, and can use the arrow keys to change to the next picture. I would then like for a value to be written to a switch or variable when the player selects one of the pictures and close out. 

I didn't go into specific detail because there are a couple of instances where I want to make this happen. they are described below (though there may definitely be more).

1. I am looking to give the player a cell phone. In the cell phone, there will be a "contacts" sub menu where the player can call any NPC that they have the number for.

2. The game is going to start with a VERY large character select screen. First the player will choose a race, then they will choose a character within the race I would like for the race menu to show a lineup of 1 generic character from each race, then when the player selects one, the scene changes to a specific lineup of each character available in that race.

If somebody can make these scripts for me, that would be so amazing I have no words to describe it; however, all I am asking for is information on how to write a script that will:

1. Call up a scene with a background image and several smaller, selectable images
2. Highlight the chosen images and allow the player to use the arrow keys to move their selection
3. Upon the player choosing a selection, write a value to a variable
4. Close the scene
5. Possibly (Depending on the choice made above) call a whole new scene (could even be a separate script if I have to.

Thanks in advance for your help in this.

Edited by LucidK

Share this post


Link to post
Share on other sites

You can call a scene with

SceneManager.call(Scene_name)

 

Look the create background method in scene_menubase to find how to create a background ( basically just load a sprite )

same for smaller images

@new_sprite = Sprite.new

@new_sprite.x = 50 (set up coordinates)

@new_sprite.y =50 (set up coordinates)

@new_sprite.z = 2 (determine if a sprite is above or below other sprite)

@new_sprite.bitmap = ... (must be a bitmap object, can be an image loaded via the Cache.load_bitmap method)

 

I advise you too look for info on the Bitmap and Sprite classes in the help

 

For highlighting said images,the simplest way would be to make a child class of Window Selectable and put your images in this window ( then make the background and border of window invisble if you want) , this let you reuse all the existing code for cursor movement , selecting ok and selecting cancel

 

In your scene define your window

@window  = Window_test.new

and create handlers for ok and cancel

@window.set_handler(:ok    method(:test))
 @window.set_handler(:cancel,   method(:return_scene))

 

thus the method test will be executed when the player valiadates a choice

 

You can use @window.index to determine what was the choice of the player

 

You must modify the size of your items to fit your images and eventually change what happens when an item is highlighted

 

If you use SceneManager.call(scene_name) then SceneManager.return will take you back to the previous scene,you can also use SceneManager.goto(scene_name) but it is unadvised for menus

 

This is a very quick explanation , you should look into the code of the scenes and windows and try to start from there , if you have a lot of ver varied choices using achild class of window_command (or horiz command) instead of window_selectable for each item to have its own command/method may be more practical.

 

I'm busy with Indie in a week so I can't spend too much time helping you but I hope this was useful

Share this post


Link to post
Share on other sites

Thanks for the advice. I would be lying if I said I wasn't still quite lost, but I'm sure betewen what you told me and similar scripts on here, I might hopefully be able to get somewhere. Thanks again!

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted