MV A little help with swith, variable in a common event please

Hello, Basically I have a common event that recalls a diary as IMG, and also the various notes that may appear are image.
The principal notes are for the main quest and appears by : variable = 1,2,3,4..
so IF variable m quest = 1
show this img
event output processing
else
IF variable m quest = 2 etc.
but in the same way I have to enter the switches that unlike the main quest which is linear are variable depending on whether or not the player talks with certain npc. like : IF variable m quest = 1; show img; IF switch A is ON; show img2
there is a command like "event output processing" to check the first group of IF (variables) and does not leave the event once a positive result has been obtained but passes to the next group of IF (switches)
There's no such thing as an event output processing command. Maybe you got some wrong translation there. Regardless, I think what you're talking about are nested conditional branches, and yes, they are certainly possible.
There's no such thing as an event output processing command. Maybe you got some wrong translation there. Regardless, I think what you're talking about are nested conditional branches, and yes, they are certainly possible.
is the fourth command, below stop cycle; near conditional branches
That's exit event processing.
1751740433023.png

as I suspected. The answer is still the same. What you're asking for is nested conditional branches. You can do that by just having multiple conditional branches inside other conditional branches, just gotta figure out the logic you'll need for it.
imho.. the logic should be fix first..
perhaps focus only using variable.. but you use switch right? just make it as variable
..
next is about condition. I prefer to count how many action you have.. based on your variable..
Spoiler: combination method
Screenshot 2025-07-06 025733.png
I'm not fluent on English.. but I think the action I mean is combination method on math
* fyi I'm using AI to help me

lets say you have 4 condition based on above combination.. put it on result variabel
ex:
JavaScript:
var iCon01=1; //change as you wanted
var iCon02=1; //change as you wanted
var result;
if(iCon01==1){
    if(iCon02==1){
        result=1;
    }
    if(iCon02==2){
        result=2;
    }
    if(iCon02==3){
        result=2;
    }

}
if(iCon01==2){
    if(iCon02==1){
        result=3;
    }
    if(iCon02==2){
        result=4;
    }
    if(iCon02==3){
        result=5;
    }

}

if(result==1){
    //run image based on result 1
}
if(result==2){
    //run image based on result 2
}
//you should use switch but this is only example
switch (result) {
    case 1:
    //run image based on result 1
    break;
    case 2:
    //run image based on result 2
    break;
   
    default:
    //run default image

}

Summary:
  • make flowchart based on your idea
  • put as coding (mean using plugin)
  • tested
imho.. the logic should be fix first..
perhaps focus only using variable.. but you use switch right? just make it as variable
..
Thanks for the answer, the problem is i dind't know how to use code, so I asked how to do it in rpg maker. I can explayn the logic : The first Variable 1 to 7 or more, the seconds are for example 5 other distinct variable or switch. So the result can be for 3 simple example:
first Variable = 2 ||| first Variable = 4 ||| first Variable = 6
first switch = off ||| first switch = on ||| first switch = off
second switch = on ||| second switch = off ||| second switch = off
third switch = on ||| third switch = on ||| third switch = on
fourth switch = off ||| fourth switch = off ||| fourth switch = on

because these secondary are totaly random, depends on whether and when the player interacts with them. I don’t know if the code you posted already can be used in this way

That's exit event processing.
View attachment 344330
as I suspected. The answer is still the same. What you're asking for is nested conditional branches. You can do that by just having multiple conditional branches inside other conditional branches, just gotta figure out the logic you'll need for it.
maybe label, and jump to label did what i say
weit a sec.. like this?
Code:
var1=2 |var1=4 |var1=6 |
Sw1=0  |Sw1=1  |Sw1=0  |
Sw2=1  |Sw2=0  |Sw2=0  |
Sw3=1  |Sw3=1  |Sw3=1  |
Sw4=0  |Sw4=0  |Sw4=1  |
Sw is switch
1: On
0: off

well.. you logic is kinda VN game based your description. The VN is more complex (thats why have 10++ ending)
anyway.. if using your example logic.. You will have like this
Screenshot 2025-07-06 044013.png

is kinda long.. in this image, you need to put number to variable ex:
Screenshot 2025-07-06 044339.png


then make another condition in the end to process the condition value(!)

Spoiler: oot
you might try this when reply
Screenshot 2025-07-06 042718.png

click + quote
Screenshot 2025-07-06 042731.png

added it using this button
Yes when I started thinking about the project, i think the same, is the first thing that came to my mind,
But of course this solution means if the variable go like 1 to 7 it means 7 of the same you post in the first image, all connected. I was trying to looking for simpler or faster methods
Yes when I started thinking about the project, i think the same, is the first thing that came to my mind,
But of course this solution means if the variable go like 1 to 7 it means 7 of the same you post in the first image, all connected. I was trying to looking for simpler or faster methods
there is no shortcut. sometime the simple make you fail to capture what you needed.
the condition is complex and you need detail methods to find the correct action is needed here..
Yes when I started thinking about the project, i think the same, is the first thing that came to my mind,
But of course this solution means if the variable go like 1 to 7 it means 7 of the same you post in the first image, all connected. I was trying to looking for simpler or faster methods

90% of coding is just doing things meticulously and repetitiously that aren't automated in your coding language of choice.
there is a command like "event output processing" to check the first group of IF (variables) and does not leave the event once a positive result has been obtained but passes to the next group of IF (switches)
You could use the Label and Jump To Label commands:
  • Label lets you define a "name" to jump to. Without Jump to Label, it does nothing.
  • Jump to Label goes immediately to the named Label (if it exists in the current event).
These commands can be helpful for designing non-linear events. 👋

As a general rule, Don't Repeat Yourself, i.e. try to avoid copy+pasting the same thing to many places. For a diary that displays pictures based on certain variables/switches:
  1. Maybe the optional parts can be split into their own picture. E.g.
    • Variable 1 > 5: "I've found the magic bell. I should bring it back to Harold."
    • Switch 1 is ON: "I rang the bell and found myself in a strange world. I need to escape!"
    I.e. 2 different pictures on screen at the same time. It sounds like maybe you already do this?

  2. If some combinations show the same picture then you can give each possible result a unique value, or "index". You can use another variable to determine the quest's current index, e.g.
    • Variable 2 = 0
    • If Variable 1 > 5
      • Variable 2 += 1
    • If Switch 1 is ON
      • Variable 2 += 2
    • Etc.
    Then just show the picture based on Variable 2.

  3. If you have a different image for every different combination of variable/switch, then you need to branch that many times. In that case there is no workaround.
@caethyril @pawsplay @gundambison At the end there is, I did it with the long method, I thought it was more complicated.
Is "only" check variable if is 1, check switch 1,2,3,4 if yes show diary 1+1 or 1+2 etc. if not show diary 1
Once you build the first one, just copy and paste.
check variable if is 2, check switch 1,2,3,4 if yes show diary 2+1 or 2+2 etc. if not show diary 2
Anyway thanks to all for the advice

Ah no... error as not said.. so doing if switch 1 is on, already stops the whole process xD

Maybe the optional parts can be split into their own picture. E.g.
  • Variable 1 > 5: "I've found the magic bell. I should bring it back to Harold."
  • Switch 1 is ON: "I rang the bell and found myself in a strange world. I need to escape!"
I.e. 2 different pictures on screen at the same time. It sounds like maybe you already do this?

Yes, maybe i can try that, i can do a img only with the Text and add upper the img of the diary.
This way i can work separated and easier too. But how to connect that in the common event ?
In the first part the software check the variable, and then ?
this kinda suggestion from programer.. I'm Web Programer
Spoiler: create a matrix
Screenshot 2025-07-08 213827.png
this matrix for detailing the ending (example)
based on this post.. you will have a lot condition. which if you make on action command.. it would be like previous image
Spoiler: reminder
index.php
if this write as plugin.. it would help a lot, since it would be readable
JavaScript:
let cond1 = $gameVariables.value( 21 );
//where you place cond 1
let cond2 = $gameVariables.value( 22 );
//where you place cond 2
let cond3 = $gameVariables.value( 23 );
//where you place cond 3
let cond4 = $gameVariables.value( 24 );
//where you place cond 4
let endValue;
if( cond1==1 AND cond2==2 and cond3==1){
     switch (cond4) {
         case 1:
            endValue = 1;
         break;
         case 2:
            endValue = 2;
         break;
         default:
            endValue = 5;
     }
}

$gameVariables.setValue( 31, endValue);
//where you send the result value on var number 31

to run you can use
Spoiler: command plugin
Screenshot 2025-07-08 215317.png
then use var 31 to decide what the ending

to make plugin. you can search how to make simple plugin on this forum or/and read my guide on this
Google Doc (link)

nb: image put on spoiler to decrease bandwith consume
I'm not sure if I'm understanding correctly, but...

But how to connect that in the common event ?
In the first part the software check the variable, and then ?
The Show Picture command shows a picture with an ID (1~100). So you can show up to 100 pictures at the same time. To show more than 1 picture, use more than 1 Show Picture command. If 2 pictures overlap, the one with higher ID shows on top.

Example:
Spoiler
  • Comment: Set up diary pictures.
  • Show Picture 7: Diary_Background
  • Erase Picture: 8
  • Erase Picture: 9

  • Comment: Stage 1 content.
  • If Variable 1 = 1
    • Show Picture 8: Diary1
    • If Switch 1 is ON
      • Show Picture 9: Diary1_S1
    • Jump to Label: Done

  • Comment: Stage 2 content.
  • If Variable 1 = 2
    • Show Picture 8: Diary2
    • If Switch 2 is ON
      • Show Picture 9: Diary2_S2
    • Jump to Label: Done

  • Label: Done
  • Comment: Wait for player input, then clear.
  • Show Text: Text = (Nothing), Background = Transparent.
  • Erase Picture: 7
  • Erase Picture: 8
  • Erase Picture: 9
Here, I've used picture ID 7 for the background, 8 for the main content, and 9 for optional content.
I'm not sure if I'm understanding correctly, but...


The Show Picture command shows a picture with an ID (1~100). So you can show up to 100 pictures at the same time. To show more than 1 picture, use more than 1 Show Picture command. If 2 pictures overlap, the one with higher ID shows on top.

Example:
Spoiler
  • Comment: Set up diary pictures.
  • Show Picture 7: Diary_Background
  • Erase Picture: 8
  • Erase Picture: 9

  • Comment: Stage 1 content.
  • If Variable 1 = 1
    • Show Picture 8: Diary1
    • If Switch 1 is ON
      • Show Picture 9: Diary1_S1
    • Jump to Label: Done

  • Comment: Stage 2 content.
  • If Variable 1 = 2
    • Show Picture 8: Diary2
    • If Switch 2 is ON
      • Show Picture 9: Diary2_S2
    • Jump to Label: Done

  • Label: Done
  • Comment: Wait for player input, then clear.
  • Show Text: Text = (Nothing), Background = Transparent.
  • Erase Picture: 7
  • Erase Picture: 8
  • Erase Picture: 9
Here, I've used picture ID 7 for the background, 8 for the main content, and 9 for optional content.
But you make a mistake, because Variable can be 1 to 7, And you can encounter variable = 2 with 3 switch ON, switch can either 1,2,3,4 ON or OFF at the same time, starting to variable=2,3,4,5..
Sorry for mi english, i try to explicate simple :

The main variable is Diary, this follows the main plot, and is therefore gradual from 0 to i dont know.. 7. ok ? The second are various switch, like 4 or 5. This are NOTES that you CAN catch or no, speaking to random citizen. And you can activate them from phase 2 of the variable to the final .. is clear now no ? 😀🤣

Then you suggested that I separate the images, to manage variables and switch separately, but this, that you show is a unique event xD im a little bit confused. Remember that i start all with a simple common event. that’s why I asked you how to connect the variable control, with the switch control...

this kinda suggestion from programer.. I'm Web Programer
Spoiler: create a matrix
this matrix for detailing the ending (example)
based on this post.. you will have a lot condition. which if you make on action command.. it would be like previous image
Spoiler: reminder
index.php
if this write as plugin.. it would help a lot, since it would be readable
JavaScript:
let cond1 = $gameVariables.value( 21 );
//where you place cond 1
let cond2 = $gameVariables.value( 22 );
//where you place cond 2
let cond3 = $gameVariables.value( 23 );
//where you place cond 3
let cond4 = $gameVariables.value( 24 );
//where you place cond 4
let endValue;
if( cond1==1 AND cond2==2 and cond3==1){
     switch (cond4) {
         case 1:
            endValue = 1;
         break;
         case 2:
            endValue = 2;
         break;
         default:
            endValue = 5;
     }
}

$gameVariables.setValue( 31, endValue);
//where you send the result value on var number 31

to run you can use
Spoiler: command plugin
then use var 31 to decide what the ending

to make plugin. you can search how to make simple plugin on this forum or/and read my guide on this
Google Doc (link)

nb: image put on spoiler to decrease bandwith consume

Man i realy like your help, but i need a summary of what this code indeed DO xD for understand, and either i dont know the other command in javascript, like show picture, play SE, wait etc

i try to read the code, but is complicated, and i think i see only 1 switch in this code. i even don't understand if is variable 21, or the value of the variable is 21 xDXDXDXD
Please delete this msg, i make an error
....


Man i realy like your help, but i need a summary of what this code indeed DO xD for understand, and either i dont know the other command in javascript, like show picture, play SE, wait etc

i try to read the code, but is complicated, and i think i see only 1 switch in this code. i even don't understand if is variable 21, or the value of the variable is 21 xDXDXDXD

you can read this
https://forums.rpgmakerweb.com/index.php?threads/rpg-maker-mv-mz-script-call-list.46456

back to main question
Screenshot 2025-07-09 142423.png

variable 21 is mean position of your variable name. if you place on action script you will have like your previous image
index.php

or like this
Screenshot 2025-07-09 142716.png


the final result I wanted is like this
Screenshot 2025-07-09 143202.png


where the condition is handle by your plugin code.

I may have been a bit insensitive in presenting more complex answer. Since I have a programming background, my input doesn't quite align with the initial statement in the following topic.
Please use my input as a reference. Maybe you might try creating a plugin based on my last input for fun. just think of programming as NOT fun
Hello again, I encounter the solution, and was MORE much symple than i think, or WE think xD Here is my diary now, working :

Spoiler
◆Se:Il gruppo ha Diario
◆Se:diario = 1
◆Riprodurre SE:Book2 (100, 100, 0)
◆Mostra Immagine:#90, diario1, In alto a sinistra (100,0), (100%,100%), 255, Normale
◆Attesa:1 fotogramma
◆
:Fine
◆Se:diario = 2
◆Riprodurre SE:Book2 (100, 100, 0)
◆Mostra Immagine:#90, diario2, In alto a sinistra (100,0), (100%,100%), 255, Normale
◆Attesa:1 fotogramma
◆
:Fine
◆Se:diario = 3
◆Riprodurre SE:Book2 (100, 100, 0)
◆Mostra Immagine:#90, diario3, In alto a sinistra (100,0), (100%,100%), 255, Normale
◆Attesa:1 fotogramma
◆
:Fine
◆Se:inidizio diario 1 è ON
◆Mostra Immagine:#91, indizio-1, In alto a sinistra (100,0), (100%,100%), 255, Normale
◆Attesa:1 fotogramma
◆
:Fine
◆Se:indizio diario 2 è ON
◆Mostra Immagine:#92, indizio-2, In alto a sinistra (100,0), (100%,100%), 255, Normale
◆Attesa:1 fotogramma
◆
:Fine
◆
:Fine
◆Attesa:5 fotogrammi
◆Mostra Scelte:Salir (Finestra, Destra, #1, -)
:Quando Salir
◆Riprodurre SE:Book closing (100, 100, 0)
◆Cancell Immagine:#90
◆Cancell Immagine:#91
◆Cancell Immagine:#92
◆
:Fine

Indizio = Clue the secondary notes; Attesa = wait; Se = If; salir =exit;

the main fact, was to NOT use Else, muy simple xD
Yeah, one good tip is to ask when looking at conditions: is there actually a problem with testing each case sequentially?
Yeah, one good tip is to ask when looking at conditions: is there actually a problem with testing each case sequentially?
I did not very well understand your question, but for now everything works without problems,
I tried all the conditions plus a new clue.

Original thread: https://forums.rpgmakerweb.com/threads/a-little-help-with-swith-variable-in-a-common-event-please.178745/