Please help me solve the problem !!!

Hello! I need help with setting up a variable.

I need to get the average of four variables, and save that average in a fifth variable, and I have no clue how to do it. 😅

Also, another question. The average is probably going to be an inexact number. How does RMVXA write it out in a dialogue box? Will it spell out all the numbers it can?
I could be wrong, but I believe VXA rounds from the decimal, if your product is 13.7 it will round up to 14, if the product is 12.1 it will round down to 12.
Please edit your post into something meaningful. All threads in this section want help to solve a problem. Many members use the title to decide if it's something they could help with before opening the thread. By giving no indication what the query is, you are reducing your chances of receiving helpful advice.
Add each of the four variables to the fifth one, and then divide the fifth variable by four. That will give you the result you are looking for.
Create a control variable, select the fifth variable you want the average result to be in, and add following to the script:
Math.round(($gameVariables.value(X)+$gameVariables.value(Y)+$gameVariables.value(Z)+$gameVariables.value(S))/4)

X,Y,Z,S being the ID of the four variables you want the average from.
One more thing, I don't know about VXA, but MV variables do not hold decimals. I believe it would be same for VXA since they both are RPGMAKER.

for example, if the four variables X,Y,Z,S contain the value of 1, 4, 62, 87.

If you do an average of these four number, the result will be 38.5.

But the system will see this as 39, because it will autometically round the number.

So, if, for some reason, that .5 is important to you, and you want to keep it, here is what you may do:

Math.round(($gameVariables.value(X)+$gameVariables.value(Y)+$gameVariables.value(Z)+$gameVariables.value(S))/4*10)

Add times 10 at the end of the script, so the output of the average will be 385 instead of 39.
@AuralPC The code you have suggested appears to be Javascript. This particular part of the forum is for VX Ace which uses Ruby (RGSS3 to be exact).

In addition:
Double-post notice: AuralPC
If you want to add something, please edit your earlier post and add in the extra info/comment there.
Using event commands:

Control Variables [0005: Average] = Variable 0001
Control Variables [0005: Average] += Variable 0002
Control Variables [0005: Average] += Variable 0003
Control Variables [0005: Average] += Variable 0004
Control Variables [0005: Average] /= 4

This will give you the average, rounded down.

If you don't want it rounded down, you can do a script call instead of that last command:
Script: $game_variables[5] = $game_variables[5] / 4.0

which will give you a decimal figure. I think.
With the event commands only, you can gather the values of all 4 variables into one, then devide on four(as said by Lord Vectra).
If you want to get decimal value, you should use script call, something like that:
Code:
$game_variables[id] /= 4.00
Where you have to replace id with the number of the variable, that contains the total sum of all four variables. To get decimal outcome, is important the number, on which you divide to be decimal, that's why you should write it as 4.00 instead 4. If you don't want decimal outcome, you won't need script call at all, but then your result will be rounded to the lower value.
To display your variable in message box, use this ( inside the text box )
Code:
\v[id]
Where you will have to replace id with the variable id.
AuraIPC, the code you provide is probably for MV, but won't work on Ace.
@Shaz , you ninjaed me ^^. Your post wasn't yet visible for me when i sent mine.
Edit: It seems like @Kes nijaed me too ^^
Edit 2: But thanks to Shaz' answer I seen error in mine (divided on 5, and confused the division operator -_- ), so I fixed it.
@AuralPC The code you have suggested appears to be Javascript. This particular part of the forum is for VX Ace which uses Ruby (RGSS3 to be exact).

In addition:
Double-post notice: AuralPC
If you want to add something, please edit your earlier post and add in the extra info/comment there.
Sorry, didn't read the forum rules careful enough, will mind this next time.😍

@michaeltoan016 and Sorry, I forgot the system for MV and VXA is different.

Spoiler
upload_2018-5-30_16-56-24.png
You will need to select Script for VXA and put following:
$game_variables[5]=($game_variables[1]+$game_variables[2]+$game_variables[3]+$game_variables[4])/4

This will do.

And I just try out, for VXA system, 38.5 will round to 38 instead of 39.

Edit: And thanks to @Shaz and @GGZiron I just tried out. If you want to keep decimal, modify the script to the following will do:
$game_variables[5]=($game_variables[1]+$game_variables[2]+$game_variables[3]+$game_variables[4])/4.00
As a small addendum, if you want the value to be rounded to the nearest integer, simply do this:

Control Variables [0005: Average] = Variable 0001
Control Variables [0005: Average] += Variable 0002
Control Variables [0005: Average] += Variable 0003
Control Variables [0005: Average] += Variable 0004
Control Variables [0005: Average] += 2
Control Variables [0005: Average] /= 4

which is the same as Shaz's solution with an extra line (indicated in bold).

Original thread: https://forums.rpgmakerweb.com/threads/please-help-me-solve-the-problem.95915/