Author Topic: VCE Help - Requiring multiple values.  (Read 1989 times)

With VCE, how would I require multiple conditions to trigger an output event?

For example, with two variable requirements, if I have a bucket of milk, and I need to fill empty jars with the milk, how would I detect the amount of milk and the amount of jars before proceeding to fill the jars.  Say if I have 2 buckets of milk, and 1 bucket of milk equals 4 jars, it should detect how much milk I have, and supposing I only have 5 jars, fill up those jars, and leave ¾ of a bucket of milk behind.

How would I go about requesting for more variables?  For three variables, suppose I have substance A and substance B.  They can be smelted only when a brick's heat variable is at least a certain value.  This should only give me a certain amount of substance C (the smelted material) and leave behind any insufficient amounts of substance A and B.

you could chain checks together
0  if A, 1 2
1  false
2  true if B, 3 4
3  false
4  true (only triggers if A and B)

you could chain checks together
0  if A, 1 2
1  false
2  true if B, 3 4
3  false
4  true (only triggers if A and B)
I've tried this before and it does not work it will activate all trues or all falses after the first if

I've tried this before and it does not work it will activate all trues or all falses after the first if
I have a suspicion that it has to do with toggling events.

and you're probably doing something wrong then
the logic seems correct, and it hasn't failed for me yet

I've tried this before and it does not work it will activate all trues or all falses after the first if

Phlack is completely correct, but that method is not needed.  If all inputs are triggering at the same time, that means you did not put the correct range of lines of events for the parameter range fields.

I have a suspicion that it has to do with toggling events.

You are definitely doing something wrong if you are using toggle events.  Lemme write this all out for you.

Quote
[0]
  • [OnActivate] [Player] [VCE_ModVariable] [JarsEmptyCount] [Set] [<var:pl:JarsEmpty>][1]
  • [OnActivate] [Player] [VCE_ModVariable] [JarsEmptyCount] [Divide] [4][2]
  • [OnActivate] [Player] [VCE_ModVariable] [BucketsFullCount] [Set] [<var:pl:BucketsFull>][3]
  • [OnActivate] [Player] [VCE_ModVariable] [BucketsFullCount] [Subtract] [<var:pl:JarsEmptyCount>][4]
  • [OnActivate] [Player] [VCE_IfVariable] [BucketsFullCount] [>=]
  • [5 16][5]
  • [OnVariableTrue] [Player] [VCE_ModVariable] [BucketsEmptyCount] [Set] [<var:pl:JarsEmptyCount>][6]
  • [OnVariableTrue] [Player] [VCE_ModVariable] [BucketsEmptyCount] [Floor] [1][7]
  • [OnVariableTrue] [Player] [VCE_ModVariable] [BucketsEmpty] [Add] [<var:pl:BucketsEmptyCount>][8]
  • [OnVariableTrue] [Player] [VCE_ModVariable] [BucketsFull] [Set] [<var:pl:BucketsFullCount>][9]
  • [OnVariableTrue] [Player] [VCE_ModVariable] [JarsFull] [Add] [<var:pl:JarsEmpty>][10]
  • [OnVariableTrue] [Player] [VCE_ModVariable] [JarsEmpty] [Set]
  • [11]
  • [OnVariableFalse] [Player] [VCE_ModVariable] [JarsEmptyCount] [Set] [<var:pl:BucketsFullCount>][12]
  • [OnVariableFalse] [Player] [VCE_ModVariable] [JarsEmptyCount] [Multiply] [-4][13]
  • [OnVariableFalse] [Player] [VCE_ModVariable] [JarsEmpty] [Set] [<var:pl:JarsEmptyCount>][14]
  • [OnVariableFalse] [Player] [VCE_ModVariable] [JarsFull] [Set] [<var:pl:BucketsFull>][15]
  • [OnVariableFalse] [Player] [VCE_ModVariable] [JarsFull] [Multiply] [4][16]
  • [OnVariableFalse] [Player] [VCE_ModVariable] [BucketsFull] [Set]

Phlack is completely correct, but that method is not needed.  If all inputs are triggering at the same time, that means you did not put the correct range of lines of events for the parameter range fields.

You are definitely doing something wrong if you are using toggle events.  Lemme write this all out for you.


Wow, loving quote.  Really?!?! God damnit, that was supposed to be a code box.  Damnit badspot, let us edit help posts!!!

Code: [Select]

[0] [OnActivate] [Player] [VCE_ModVariable] [JarsEmptyCount] [Set] [<var:pl:JarsEmpty>]
[1] [OnActivate] [Player] [VCE_ModVariable] [JarsEmptyCount] [Divide] [4]
[2] [OnActivate] [Player] [VCE_ModVariable] [BucketsFullCount] [Set] [<var:pl:BucketsFull>]
[3] [OnActivate] [Player] [VCE_ModVariable] [BucketsFullCount] [Subtract] [<var:pl:JarsEmptyCount>]
[4] [OnActivate] [Player] [VCE_IfVariable] [BucketsFullCount] [>=] [0] [5 16]
[5] [OnVariableTrue] [Player] [VCE_ModVariable] [BucketsEmptyCount] [Set] [<var:pl:JarsEmptyCount>]
[6] [OnVariableTrue] [Player] [VCE_ModVariable] [BucketsEmptyCount] [Floor] [1]
[7] [OnVariableTrue] [Player] [VCE_ModVariable] [BucketsEmpty] [Add] [<var:pl:BucketsEmptyCount>]
[8] [OnVariableTrue] [Player] [VCE_ModVariable] [BucketsFull] [Set] [<var:pl:BucketsFullCount>]
[9] [OnVariableTrue] [Player] [VCE_ModVariable] [JarsFull] [Add] [<var:pl:JarsEmpty>]
[10] [OnVariableTrue] [Player] [VCE_ModVariable] [JarsEmpty] [Set] [0]
[11] [OnVariableFalse] [Player] [VCE_ModVariable] [JarsEmptyCount] [Set] [<var:pl:BucketsFullCount>]
[12] [OnVariableFalse] [Player] [VCE_ModVariable] [JarsEmptyCount] [Multiply] [-4]
[13] [OnVariableFalse] [Player] [VCE_ModVariable] [JarsEmpty] [Set] [<var:pl:JarsEmptyCount>]
[14] [OnVariableFalse] [Player] [VCE_ModVariable] [JarsFull] [Set] [<var:pl:BucketsFull>]
[15] [OnVariableFalse] [Player] [VCE_ModVariable] [JarsFull] [Multiply] [4]
[16] [OnVariableFalse] [Player] [VCE_ModVariable] [BucketsFull] [Set] [0]

Fixed

Start the guy with the simples
There's a and there's b, he wants to do something is he has a and b set to 1

Start the guy with the simples
There's a and there's b, he wants to do something is he has a and b set to 1

Start the guy with the simples
There's a and there's b, he wants to do something if he has a and b set to 1
Sry for posting last twice iPod got messed up
noedit

Sry for posting last twice iPod got messed up
noedit

I know the feel.

Start the guy with the simples
There's a and there's b, he wants to do something is he has a and b set to 1

What he was requesting would be lacking a lot of steps that would not have created a full VCE system.  But I can write what is wanted:

Code: [Select]
[0] [Onactivate] [Player] [VCE_IfVariable] [A] [==] [4] [1 1]
[1] [OnVariableTrue] [Player] [VCE_IfVariable] [B] [==] [7] [2 2]
[2] [OnVariableTrue] [Player] [Addvelocity] [100] [100] [100]

Now, in the above, if your A variable is 4 AND your B variable is 7, the player gets launched.  Notice the last fields on lines 0 and 1, the range that is given.  Range [1 1] triggers only line 1, if line one uses OnVariableTrue/False, which it does.  After line 1 is triggered, another IfVariable check is run, and as specified in the final field on that line, it triggers line 2.

That example was just a random example and doesn't allow for showing the usefulness of this VCE system.  The following example is more complex, but would be extremely useful in many situations:

Code: [Select]
[0] [Onactivate] [Player] [VCE_Modvariable] [Count] [Random]
[1] [Onactivate] [Player] [VCE_IfVariable] [Count] [<=] [.25] [2 3]
[2] [Onvariabletrue] [Player] [Addvelocity] [100] [0] [0]
[3] [Onvariablefalse] [Player] [VCE_Ifvariable] [Count] [<=] [.50] [4 5]
[4] [Onvariabletrue] [Player] [Addvelocity] [0] [100] [0]
[5] [Onvariablefalse] [Player] [VCE_Ifvariable] [Count] [<=] [.75] [6 7]
[6] [Onvariabletrue] [Player] [Addvelocity] [0] [0] [100]
[7] [Onvariablefalse] [Player] [Kill]

What this does is essentially creates a random number generator that sets a variable to a random number, then runs checks on the variable, and results occurring based on what the number was.  This would be for if you have four options you want chosen randomly.  Also, note that when the [Random] operation is used with blank fields, it chooses a random number between 0.0000 and 1.0000.  Also, look at that last line.  Had I continued with the pattern I used for events 1-5, that last line would be an IfVariable check followed by another event similar to the other events.  But, because we already covered 3/4 of the 1.0000, we don't need to include that extra check.

Oh, interesting.  I had no idea that the last blank served as a range.  Can multiple ranges be used?

I think the last box is only takes two numbers, from the first to the last

Oh, interesting.  I had no idea that the last blank served as a range.  Can multiple ranges be used?

I think the last box is only takes two numbers, from the first to the last
^^^

Also, make sure you use a space between the numbers, not a dash.

Yeah, this works great.  Thanks so much, guys.  Topic will remain open in the case that anyone has any more questions.