Complex Event Help: Number Reduction

Pubicbear

Warper
Member
Joined
Sep 19, 2014
Messages
1
Reaction score
0
First Language
English
Primarily Uses
Hey guys, This is a somewhat odd request but I'm in a little over my head here considering I'm only used to basic eventing but just wondered if it'd be possible to do a reduction of 8 digits but with some special exceptions.

For example:

Players birthdate is (05/07/1988) so he inputs the following (05071988)

I would then like it to reduce these numbers in the following way.

Calculation 1: 0 + 5 + 0 + 7 + 1 + 9 + 8 + 8 = 38

Calculation 2: 3+8=11

Calculation 3: 1+1=2

If the final total of Calculation 1 = 11, 22, 33, or 44 (No further reduction needed but if it doesn’t equal one of those numbers I’d like it to continue reducing to a single digit)

Would It then be possible to turn on a switch that correlates with each final reduction?

Like if the number is reduced to 1, turn on a switch named 1.

If the number is reduced to 2, turn on switch named 2.

But if the number is reduced to 11,22,33 or 44 in Calculation 1, turn on switch named 33.
etc.
 
Last edited:

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
I strongly suggest that you look at Andar's compilation of info for new users. Among the many excellent things there are links to 2 playable tutorials, one on Event Commands and the other on Switches and Variables. You absolutely need a firm grasp of these if you are going to make a game, and for the particular query you have now.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,674
First Language
German
Primarily Uses
RMMV
basically this can be done in two different ways:
Either with scripting knowledge and string conversion commands to seperate the different numbers.
Or by control variable with the modulo operation to do the same.

If you don't know how to program (probably or you wouldn't ask this), then the modulo operation is vital for this - check your advanced math schoolbooks on it. It is rarely used in regular live, but it is the third type of the second class operations (multiplication, division and modulo) and it is very usefull in programming, especially game programming.
 

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,628
Reaction score
1,115
First Language
English
Primarily Uses
RMMV
OK so it can be done without any scripting (though scripting may be easier):

[when I say V1, I mean variable #1]
  • The player inputs 05071988 into V1
  • Set V2 as (V1 % 10)
    • % is the "modulus operator" sometimes abbreviated as mod
    • You should look up this operator to learn more
  • Set V3 as (V1 % 100)
  • Set V4 as (V1 % 1000)
  • Set V5 as (V1 % 10000)
  • ... Continue until you did all 8 digits...
Test play and press F9 to see the variable values. Hopefully you can understand what the % did. But you're not done yet.

Back to the event and add more commands, this time working backwards:
  • Set V9 as (V9 - V8) / 10000000
  • Set V8 as (V8 - V7) / 1000000
  • Set V7 as (V7 - V6) / 100000
  • Set V6 as (V6 - V5) / 10000
  • ...keep going until you get all the digits
Now test play again and press F9. All the variables should be correct now, and you can add them together for the rest of your scenario.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,860
Messages
1,017,040
Members
137,569
Latest member
Shtelsky
Top