Script call conditional branch

Hello everyone of the rpg maker forums!.I'm having a little problem with the script call conditional branch. I'm trying to make a simple crafting system with script calls and i can't really figure out how to use the script call conditional branch. i'm not having any problems with the plugin i'm just having a bit of trouble understanding how you do it. Is it just like a if statement where you go  if (i brush my teeth){

                                                                                                                                                                                                                                                                                         then my teeth is clean

                                                                                                                                                                                                                                                                                   } 

would it be like that or something else i'm sorry if this thread makes almost no sense but i'm just needing a little help understanding it. thank you for reading  🤣
It's called the 'if' condition.

You write it like this :

if(something){  // something happens}You also have 'else', when condition in 'if' is not met.

if(something){  // something happens}else{  // something else happens}And inbetween them you can have 'else if' 's, that are executed if 'if' 's conditions are not met, but their own conditions are:

if(something){  // executes when something is true}else if(somethingelse){ // executes when something is false, but somethingelse is true}else if(somethingthird){  // executes when something and something else are false, but somethingthird is true}else{  // executes when something, somethingelse and somethingthird are false.}In examples above, something, somethingelse and somethingthird are conditions.

Values of conditions can be true or false.

For example : 1 === 1 returns true, but 2 === 1 returns false, so you can write something like :

if(1 === 2){  // this obviously does not happen}else{  // this happens}Enough of that, what do you actually want to do?

What is that plugin?
This is a great example. 🤣 What I'm trying to do is use the script calls to make a simple crafting system like you got 2 choices you can craft a sword or a bow and this is where I needed to know how the if condition works. its gonna go like if you have the 2 items you needed it would remove the 2 you had and give you what you crafted. Its very simple.  🙂  You could do this using events but I wanted to try to make a plugin of this for extra practice thank you for your time. 
I did some test and it works great thank you so much!
Remember, when you are comparing just one variable with different values, it's better to work with switch-case blocks. Main advantage, you can break blocks whenever you want.

Code:
var testNum = function(num) {  var retVal = 0;  switch(num) {    case 0:      retVal = 1;      break;    case 1:    case 2:    default:      retVal = -1;      break;    case 3:      retVal = 2;    case 4:      retVal++;      break;  }  return retVal;}
In this case, using 0 will return 1, using 3 will return 3, using 4 will return 1 and using anything else will return -1.
And you can also use sign ?: operator.

For example, if you do this :

var a = (1 === 1) ? 2 : 3;a will be set to 2. But if for some reasons 1 isn't equal to 1 then it'll be set to 3.It's just a short way...
alright thanks this is very helpful.  🤣
I would just create a function that evaluates to true or false and then use that function in the conditional branch of the event ... 

Original thread: https://forums.rpgmakerweb.com/threads/script-call-conditional-branch.50201/