Jump to content

Recommended Posts

I'm very bad in getting what I need clarified, so I'll build this foundation for my problem.

I've looked at the following scripts already for my answers to no avail:

https://yanflychannel.wordpress.com/rmvxa/core-scripts/party-system/

https://yanflychannel.wordpress.com/rmvxa/menu-scripts/command-window-icons/

 

And I have a small project I'm dabbing with and what I'm looking for is how to use pictures as command option choices like these scripts apparently know how to do.

If this is still confusing, imagine this scenario where you wanted to, for example, change your party leader. So you go to some event that brings you to a window that has a list of the actor sprite graphics by themselves as selectable options. And you can go under selected actor and code blah blah to change the leader to the desired actor.

 

I'm "new" to scripting in that I've never made my own script, but I'm not too noob on RGSS3. I've been looking up and down websites to figure out a solution to this problem.

 

the thing is I know a bit about the draw_character and draw_icon methods, and I'm a bit confused on all the rect-based methods to the point where I don't know if rect has to do with making an item selectable, how to place multiple selectable items in a list stack for pushing, or if it has to do with the contents.blt methods.

 

Trial after trial, error after error, if anyone can help me for clarification.

post-73333-0-84409700-1495731272_thumb.jpg

post-73333-0-97705000-1495731275_thumb.jpg

Share this post


Link to post
Share on other sites

I guess the important thing to realize is that you aren't selecting between locations, you are selecting between indexes. Really the windows with selectable options (most or all of which are ultimately subclasses of Window_Selectable) are mostly pretty simple and all follow the same format, you have a set list of possible selections (the number of selections is controlled by the item_max method) and when you press a direction key and it changes what the current selection of the list is, also called the index. If you want to do anything like, say, make a grid or other two dimensional selection you are going to need to recode how the index selection works. There are also lots of reasons you might want to have up and down do something different from left and right or mess around with it in other ways. You can always mess with your windows's cursor_ methods if you need to.

 

It still needs to know where in the window each selection should be to be to draw it of course, and that's where item_rect comes in. Basically a rect is just a simple way of doing math with rectangles. They have an x and y starting location and a width and height. The way it's supposed to work is that the item_rect method returns a rectangle within the window for an index. You can code it to return any rectangle you want, but the default calculates one vertically based on item_width, item_height, col_max, spacing, and the index. But Window_HorzCommand for example switches it around to use a horizontal one. I have totally coded one where the selections are not in any real continuous order too.

 

Usually the window calls item_rect in draw_item to figure out where it should draw the images. You could use any of the built in draw_ methods or just draw whatever bitmap you want using contents.blt which draws stuff (basically the blt in contents.blt refers to a special way of drawing on a bitmap, though I have no idea if that is really appropriate terminology when using full alpha masks, but that's besides the point) on to the window's contents bitmap (the image for the inside of a window). In addition, item_rect is used to figure out where the box that surrounds what option you have selected is.

 

Over all not too complicated. In brief: Directional input to select the index of a list of selections, item_rect to help figure out where to draw the selections.

Edited by KilloZapit

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×