Staffy's Guide to RPGM1 (For Newbies) Chapter 2: "Basic Programming" -Article 1: Switches and Event Pages In the last article, I discussed proper game creation flow. In this article, I get into the meat and potatoes of programming using the RPGM1 engine. First and foremost I give you this piece of advice: RELAX! I understand the the system looks daunting and full of options, but all of the codes are quite self explanatory and once you get to know what they do, simple coding will be a breeze! (Before we begin, create a small dungeon with a two rooms separated by wall with an open door way in it. Then open this dungeon in the scenario data.) -SWITCHES This particular topic is usually the bane of the novice RPGM1 programmer. I know the feeling. It’s the fear that improper switching will cause pain and agony...well it will actually, but that is why you are reading this series of articles. Basically a "switch" in RPGM1 is just like it sounds; it either turns something ON or OFF. For the purposes of sanity, most things you will apply a switch to will only be affected if the switch is ON. (However there are circumstances where a switch may need to be OFF to produce the desired effect, more on that later, as it is more of an intermediate skill). RPGM1 has 500 switches to play with. Most people don't run out of switches. However, don't take that as carte blanche to waste them either. It really is important that you learn how to use switches, as they are where the power of RPGM1 lays. Ok. Here is a simple example: Suppose you have an NPC (Non-Player Character) that is guarding a doorway. He is going to block the player from accessing an area of some type. But at some point he needs to go, and STAY GONE. (This is the number one complaint I've seen, so don't feel bad, we've all gone through this) This is where you would apply a switch. First let me dispel a newbie misconception: Applying a switch to an event and then setting it to "OFF" does NOT turn off the event. By default, all the switches in RPGM1 are set to the "OFF" position. By ACTIVATING them you cause things to happen. So in essence you need to turn a SWITCH ON to turn the EVENT "OFF" (or "ON" in some cases, more on that later). It's seems backwards, I know, but it's actually quite intuitive. Second, before we can program this, you need to learn one more thing. -PAGES Not quite as daunting as switches may seem, they are no less important. By default an event has 1(one) page. A "page" is where all the programming goes. Pages have 2 basic things that effect them, their "contents" (or actual programming code) and their "conditions" (or things that must be true on a global scale for that page of code to activate). Contents are where you activate switches. This is done by going into the page contents, opening the menu, selecting "switching" and setting a switch to "ON." Once the switch is ON it is ON GLOBALY, it is ON until you turn it off, and many events can be set to be effected by it. But we're only going assume that there is just this one event (the guard blocking the doorway) for now. So create an event in front of the doorway if you haven't already to get the guard to disappear, we need to have a 2 page event. So go ahead before you do anything else and add a page to the guard’s event. You can either add it to the front or to the back at this point, it doesn’t matter. Note now that the page number in the upper right has changed from "page 1 of 1" to either "page 2 of 2" or "page 1 of 2." You want to be on "page 1 of 2" at this point so go there now. Now you may choose a graphic - any will do for now, because for the purposes of this example it doesn't really matter - and you will want to set the "Start Type" option to "Check." Let me explain what you have just done. Events "Start" (or are activated) in various ways. The most common way is to "Check" the event. This means that the player has to walk up to the event and press the "X" button. If you had left it as "touch" it would have activated if you bump into it. This may or may not be a good thing, but I always find "friendly" events that are activated "automatically" are rather annoying. (<- Good tip there). So now that you have your graphic and your start type, go in to page contents, and set a switch to be ON. I'll assume that you are using an empty game, so the switch we will use is "001." If you want, you can put some text in the event by opening the menu, selecting "Message," (use the default option here) and then typing out the text you would like. It's not necessary though, I just think that it gives the event a little charm, and a reason for being. I mean, how would you feel if you were created only to be blinked out of existence am moment later? But hey, it's up to you. Anyway, make sure that the switch comes AFTER any and all code in the event. (There is one exception to this rule, but I'll discuss it in a later article, as it does not apply here.) NOW, go to the page marked "page 2 of 2." Here you are going to do 2 things: First you want to set the "Start Type" to "Do Not Start" and second you want to set a page condition. So go down there, and on the first line press X. This should open a menu. Go down to where it says "Switch on/off" and it will open another little window, where you can say either ON or OFF. Choose ON. Now it will show you a window like this: [000] where the first zero is flashing. Highlight the last zero and set it to read: [001]. Now exit the event. Congratulations! You have just made an event that will disappear on cue! Switches are really handy when you have events that need to change their state. Usually, it will be making sure that the event will go away and stay that way, but other times switches will allow you set up new situations in existing events, even across dungeons. Remember; a switch that is turned on is turned on GLOBALY. Pages are progressive. This means that if you set a switch to activate one page of an event, and then have another page activated by another switch, the switch that was most recently activated over rides the other switches in the event, regardless of switch number. This is a tidy little system because usually switches are activated sequentially and pages are added front to back. So if you have switch 001 activating page 2 of an event and switch 002 activating page 3, page three will always run so long as switch 002 is ON. ( @_@ I know... once you see it in action though it's easy to understand) Oh! And one more thing, you CAN NOT add a page condition to the first page of an event. More on this interesting predicament in the next article.