RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[RESOLVED] Event - Switch - Local Switch - Page - Variable Relation

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 88
Your greatest flaw is that you have a soul.
Warm greetings.

As I am new at this, there is a lot still confusing me. I nailed down most of the rmxp postality knights edition features but am having a hard time understanding relation between event - switch - local switch - page. Just as I thought I figured it out without bothering you with my questions, I made a message with 4 choices and realized  I DO NOT understand a damn thing. To put it very simply, I absolutely do not understand relations between Event, Switch, Local Switch, Page and Variable one with another and I believe a tut-through-chocing might help. I am feeling somewhat depressed since I read several tutorials, including the one in Zeriabs link, explaining these few things but I just can't figure out the way they work ( and couldn't find a tut on choices and how they work)...

To make this short and without too much whining, If you find time I humbly ask for you to step-by-step somehow for the dumb explain how Event, Switch, Local Switch, Page and Variable work one with another at all. I mean, for example, I don't have the slightest clue yet how Common Events in Database relate to Events on map where in both of these are options for swiches for which I don't understand how are they turning on and off (while I do know where you DO select on and off) and by what means do pages actually reffer to these switches for which I don't know how they behave, and I specially get confused with Local Switches for I don't understand where are you supposed to edit them since all I ever see is "Local Swich A,B,C,D" is on/off. What the hell that means. Where's the content of that local switch. What does local switch even has to do with other pages? How can I even separate local switches with switches and what is the relation when selecting switches in common events in database and in event  and in aditional pages? And what's the purpose of variable, for naming? Linking? Is that additional type of switch? Do you just type something in variable to reffer to something? For what? On the top - Conditional Branch. Now that puzzles me even more. Gosh...

See how I'm thinking when seeing this? I just can't figure it out. >_> Do help. XD
« Last Edit: December 18, 2006, 08:51:30 PM by Decadent Sympozium »

***
Rep:
Level 88
Random-Idiot
Ill see what I can do.

Event
A simple container that can have a graphical display
and a preset set of commands triggered when it should.
For example, on hero touch, on event touch, on action key.

Switch
A stored BOOLEAN. A switch can have only 2 values
(Actually 3, but lets say 2) : 1 or 0, true or false, on or
off. These switches are effective throughout the game. So,
Switch 1 from event 10 set on, will also be on in event 11.

Local Switch
The same as switch, however, only works in the event
container they are created. So, local switch A from event 1,
will not effect local switch A from event 2.

Page
2 pages are acutally 2 sets of commands. An event can have a
preset set of commands, with pages, an event can have more then
1 preset set of commands, with one active at the time though.
Also, if more then one page's pre conditions are met (stated in
the left upper part of the event window) the page with the highest
number will be executed.

Pre-Condition
These condition(s) must be met before an event's page (command list)
is excetuted. When not met, the page will be ignored. Ex. Swith 1 on
When Switch 1 is off, the page will not run, when it is on it will.

Variable
A container that can hold pretty much anything. This goes from
numbers to plain text aswel as other data. It could also hold
true and false like a switch.

Common Event
An event (container with preset set of commands ! ;)) without
graphical display. Usually used for sets of commands that need
to be executed more then once.

You can skip this:
I don't know if you want to know, however, the switches are
stored in $game_switches; the variables in $game_variables; the
local switches in $game_self_switches; the events in $game_map.events;
the common events in $data_common_events.  :police:



So... what can they mean for each other? Well, we could go with examples. Let's say we have Mikey. Mikey is a boy, he is desparatly in love with Jessica. Now, he wants to bring Jessica an apple. This apple could be obtained by Grandpa and his aplletree. How would we do this? It can be done in some ways, but we will be using pages, local switches, switches, events and one common event.

We start with an event for Grandpa. Let say we want him to say: Hello Mikey. To get an apple, go to the tree and rumble it hard. You might need to do it more then once though.

Code: [Select]
@>Text: Hello Mikey. To get an apple, go to the tree and
:     : rumble it hard. You might need to do it more then
:     : once though.

This is what we got. Okay. Now we make an event for the tree. We ONLY want to be able to ruble the tree, after we talked to grandpa. This means we need to use switches. If you want to know what kind, think again. Does the event's variable need output from another event? If yes, switches, if no, local switches. The answer is yes. You need to talk with grandpa (is another event) to activate the tree.

So, we make 2 pages. Why? One with the graphic of the tree and a message saying: Look, a ginat apple tree. One (needs to be the second) with the graphic of the tree and a precondition checking if a switch is true if yes... well, we deal with that later.

Page one Appletree:
Code: [Select]
@>Text:Wow look, a giant appletree!

Page two Appletree:
Code: [Select]
Nothing yet...

If you test your game you will see that when you talk with grandpa he keeps saying the same thing, and when you talk with the tree, nothing happens. We wwant to fix that. Okay, first the tree. Both pages are equally the same, except for one having text. This means that both pages are actibated (read: preconditions. In this case all the pages preconditions are met) so the page with the largest number (read: page) will be exceuted, being the one without the text.

Go to the second page of the appletree. At preconditions find: Switch      [...] is ON. Click the [...] and choose a switch. We call it switch APPLE for the sake of this tutorial. When you test the game, you will see that grandpa says the same text whle the time, and the tree will say the same text too. Okay, how to activate page 2?

Go to grandpa and add Switch Oparation: Switch[APPLE] = on.

Quote
@>Text: Hello Mikey. To get an apple, go to the tree and 
:     : rumble it hard. You might need to do it more then
:     : once though.
@>Control Switches: [0001: APPLE] = ON

Yay, let's test it again!. Okay, after talking with grandpa, the tree stops saying its text. So that worked. Now we want an apple. Grandpa told us we might need to ruble more then once. So we need to rumble 4 times.

Make a new common event, name it RUMBLE and add an event: Variable Operation: Add 1

Quote
@>Control Variables: [0001: TREE] += 1

So. Every time we run this common event, variable 1 will be upped with one. Now go back to the tree, and in page two add: Call common event: Common Event 1

Quote
@>Call Common Event: RUMBLE

(Testing the game will do nothing now)

Make a thirth page in the TREE event. In its pre condiitons selct the [...] after Variable and select variable TREE (number one I guess). In the with space below, make the number 4. This means this page will run when variable TREE is 4 or more. Exactly how we want it. In that page, add: Obtain item Apple, also we want this only once to happen, so add: Set local swith A to on, make a fourth page: preconditions Local switch A is on.

Quote
@>Change Items: [Fruit] += 1
@>Control Self Switch: A = ON

There, this is how far I am going to help you. So what do we got?


We have Grandpa. One page, no preconditions. He says something, and makes a variables true.
We have The tree. 4 pages:

Page 1: No preconditons, says text
Page 2: Switch from grandpa needs to be on: Calls Common event
Page 3: Variable needs to be 4 or more: Adds item + Local switch on
Page 4: Local Switch A on: Does nothing.

Common Event: Adds 1 to a variable.

So, why did we use a variable for the grandpa <=> tree, becuase it need to be interacted between more then 1 event. Why did we use a common event (hello, normally you would jsut place the oparation in the event. There ws NO NEED for a common event, just wanted to show how they work), becuase we would need to exceute a long (cough) oparation more then once. Why did we use a variable? To store anything other then true/false, in this case a number. Why did we use a local swithc in the tree? Because it could all be handled in the three itself.



I hope you understand



ALL HAIL ME™

***
Rep:
Level 88
Your greatest flaw is that you have a soul.
OMG there! That thing with controling switches and locals and operation, that was the damn missing link I had to know to understand the whole process! I'm thrilled. :P You're amazing in explaining, thanks a whole damn lot. I have two more questions but do not want to bother you anymore, I'll try figuring it on my own. I don't know of the way to repay yet but if you'll ever need some kind of music (I usually do the real thing, not midi, and preffer doing electronical or semi-classical of all kind (although I do classical as well but it takes a much longer time, and I can do metal and classical in midi if requested so, it is much more easy because of no cpu use) because I am irritated by midi in games, and you can use any in the rmxp, they do not waste much of cpu) or perhaps a more advanced graphical element (say title, pic scenes, avi, game over, window screen, face edit, borders, etc, no spriting as if for chars or so, I suck at simple things) just hit me with a pm and I'll see if I can help you out.
« Last Edit: December 18, 2006, 10:09:46 PM by Decadent Sympozium »

***
Rep:
Level 88
Random-Idiot
Haha, if you can't figure it out, just make a new topic, and ill hit the keyboard again. That actually was, I think, my longest explanation ever.  :tpg:

Me™
ALL HAIL ME™

***
Rep:
Level 88
Your greatest flaw is that you have a soul.
I figured it out on meself,  ;D now I'm aiming for new challenges that will trouble me. Ho ho ho.