Clayton 0 Posted May 19, 2012 I'm working on a project that I'm very serious about completing and doing a commercial quality job on. I've got artists, I know the RPG Maker engine very well, but I have no one to do the scripting. I started learning Ruby, and it seems pretty easy, but I'm having dificulty with RGSS3. I don't want someone else to write these scripts for me (unless they want to join my team) and I don't want to give away all my (cool) ideas by requesting them anyway. So I'd really like to learn by doing. That is, my asking how to script something, and you guys guiding me. I know basic Ruby now, and am beginning to understand how RGSS works, but I really learn best through demonstration and discussion. Hopefully as I add features I'll learn enough to stop asking for help. So, anyone want to help? So let's start small. How about a simple script to pull up a small square window in the center of the screen with a picture in it? I'd first make a script like Window_picture with a < Window_Base, right? I'd set the super tag, then set x and y to the center, (which is where?) and make it a decent size, like 400 by 400. I'd like to set the picture when I call the script, so that'll be done with a command like Window_Picture.new (Picture name here). But beyond that... no idea. Share this post Link to post Share on other sites
shaz 77 Posted May 19, 2012 Best way is to find something that almost does what you want, then duplicate and modify it. If you want a window with a picture in it, the message system would be a good place to look for an example. It shows pictures in windows already, along with other stuff - so you want to duplicate that, remove the text if you don't want text, change the way it's called, then tweak it for your specific needs. Share this post Link to post Share on other sites
Clayton 0 Posted May 20, 2012 I'd really like to avoid modifying existing scripts as much as possible so to avoid my scripts from seeming familiar. With a script this simple, I doubt it'll be a problem, but later on down the road I'd like to do it all from the ground up. In this case, I need two things. How do I refer to files and how do I link it to the call script command in the event editor? (If i add a file to the graphics folder with the name "sword" how do i set the script up to work with Window_Picture.new (sword) as opposed to Window_Picture.new (staff) or something like this) I should add that while I've read Why's Poingnant Guide to Ruby as well as the RGSS3 help file, scripting isn't my strong suit. Specific answers are great. Thanks in advance. Share this post Link to post Share on other sites
Tsukihime 1,489 Posted May 20, 2012 (edited) Specific answers are great. There is nothing wrong with writing scripts that "seem familiar" In fact you should copy as much as possible. In literature that may be frowned upon but there is no rule that says you cannot re-use other people's code in programming. How do I refer to files and how do I link it to the call script command in the event editor? Call script uses the game interpreter. You can instantiate a Game Interpreter on demand if you really need it, but you probably won't need to unless the methods you're calling are defined in the interpreter. (If i add a file to the graphics folder with the name "sword" how do i set the script up to work with Window_Picture.new (sword) as opposed to Window_Picture.new (staff) or something like this) If you're working with names, you would store the name as an instance variable for the window. You would also provide a way to change the value referenced by the variable so that there is a way to tell the window "show me a sword, show me a staff" The scene will handle all of the user input and if the user decided to pick a sword, it'll tell your picture window to show a sword. All interfaces in ruby are the same: 1 - the scene, which handles input and processing 2 - the window, which handles the display I think eventually you will end up writing code that looks like what RGSS3 comes with. Edited May 20, 2012 by Tsukihime Share this post Link to post Share on other sites
Clayton 0 Posted May 20, 2012 I appriciate the patience guys, I'm not asking correctly. These images are gonna be just an image in a folder. not imported into VXA (unless it would be better to do it that way). I'm digging through the scripts but the only thing I've found that's close is load_data("Data/BT_Actors.rvdata2") etc. So will I have to load_data("Graphics/Image1.bmp") for every image? Share this post Link to post Share on other sites
Tsukihime 1,489 Posted May 20, 2012 If you put it in your graphics/picture folder, you can load it using Cache.picture('name') Share this post Link to post Share on other sites
Clayton 0 Posted May 20, 2012 Okay, so that makes life a little easier. Two things, now that I have a window and a picture, how do I use that Cache command? I want to draw said picture in the window. Second, I want to pass the name of the picture when I call the script from the editor. So how do I set that up? A quick example for clairity's sake. The script contains just a variable for the picture name, and when I create an event with the script command Window_Picture.new (Picture name here). Do you get what I'm trying to do? A side note, what's the screen size in VXA? Share this post Link to post Share on other sites
Tsukihime 1,489 Posted May 20, 2012 I can't think of a solution on the spot. You should look at how the Skill scene is implemented, since it passes the currently selected skill type to the skill list to draw a new list of skills. Screen size 544x416. Share this post Link to post Share on other sites
shaz 77 Posted May 20, 2012 Again, this is all done in the scripts already. Just find a script for anything that displays an image (like the message window) and see how they put a picture to the screen from the cache. I understand your wanting to do it all by yourself, but honestly, imitation is the best way to learn. Do that for now, then when you've got a handle on things, go be adventurous and do it all yourself. If you ask us how to do something because you don't want to look at what the scripts already do, WE are going to look at what the scripts already do in order to give you an answer. So you may as well just cut out the middlemen. You can make an exact duplicate of one of the existing windows, and once you understand how it all hangs together you can modify it to your heart's desire so it looks nothing like it originally did. You still have to use the same functions and calling method, so why not start with something that already works and go from there? Share this post Link to post Share on other sites
Clayton 0 Posted May 20, 2012 A fair point. I'm not good at looking at them and understanding, no matter how many tutorials I read, which is why I chose to ask. But you're right, I do need to stand on my own two feet... Someone should start a chatroom for disscusion of how things work, that'd be my ideal way to learn this, but for now I'll focus on just screwing with things until I get it. Share this post Link to post Share on other sites
shaz 77 Posted May 20, 2012 I also find it easier learning when someone explains things, than by reading, so I know where you're coming from. There's no reason you can't ask WHY questions as you're looking through it, to help understand. But if you ask HOW questions, most of us would just head straight to the scripts to find you an answer Share this post Link to post Share on other sites
IceDragon 26 Posted May 20, 2012 Just glanced over it a bit: Don't simply just copy code and use it, if you want to learn, dissect it and learn what makes it tick. Getting something to work is only the start of the fight, understanding what it does is a completely different ballgame. Yeah that's my 2 cent on learning to script. Anyway if you want to display an image, take a look at Sprite_Picture. Just remember, Bitmap - What you want to display Sprite - Means of displaying it >.> /me goes back to life Share this post Link to post Share on other sites
Kaelan 25 Posted May 21, 2012 CTRL+SHIFT+F in the script editor is your friend, by the way. Anytime you need to find something, spend 5 minutes searching for it. For example, if you're looking for how the engine draws pictures, search "draw", "picture" or "draw_picture". If you want to know how icons are displayed, CTRL+SHIFT+F "icon". etc. Share this post Link to post Share on other sites