In Special Operators, we talked a little about Blend and the kinds of things it lets you do. The Blend Operator is far and away the most useful tool for calculations with BNumbers. With this one Operator, you can perform just about all of the common calculations we find in Scripts.
Averaging Two BNumbers (with or without a Bias)
Blend's most frequent use is to take two values and find a value between them, or in other words, to average them. It also allows you to put your thumb on the scale toward one or the other value, by use of the third term, the bias factor. For instance, let's suppose you have a family drama sequence in which a character, a ne'er-do-well, gets into trouble and has to go around begging family members for help. All family members have to decide whether to intervene for him. Let's further suppose you want each family member to take into account both how close their kinship is to the begging Actor, as well as how much affection they have for him.
The script might look like this:
beg for help: beggee: intervene on behalf of: Inclination
In this example, the Actor who has to make a decision whether to intervene is the ReactingActor and the ne'er-do-well who has just begged for help is ThisSubject. Notice that this script assumes the degree of Kinship is equally important to the outcome as the degree of affection ReactingActor has for ThisSubject. But you can also use the bias factor to change the balance. Let's walk through some examples.
(1) In the example above, if Kinship is +0.5 (ReactingActor and ThisSubject are cousins) but PNasty_Nice is -0.5 (ReactingActor actively dislikes ThisSubject), you get this:
This yields a result of 0.0—the average of +0.5 and -0.5. In this scenario, ReactingActor might intervene for ThisSubject. But don't bet your life savings on it; there's only a 50/50 chance that it'll happen, all other things being equal. This is what you get when you place equal importance on Kinship and PNasty_Nice.
(2) You can also do weighted averages, which give greater weight to one of the Blend factors. Let's try making the degree of Kinship a little more important than PNasty_Nice. In this case, as above, ReactingActor and ThisSubject are still cousins (Kinship is +0.5), and ReactingActor still dislikes ThisSubject (PNasty_Nice is -0.5), but we change the bias factor to +0.2—that is, we put our thumb on the scales and tip the result toward the first term, Kinship.
(The +0.2 means we are biasing toward the first term, Kinship. If we used a -0.2, we'd be biasing toward the second term, PNasty_Nice.)
This yields a result of +0.1, because the bias factor of +0.2 gives slightly greater weight to the +0.5. ReactingActor is a bit more likely to help his irritating cousin out.
(3) What if we want to make ReactingActor's PNasty_Nice for ThisSubject more important than than Kinship?
A -0.6 biases the result strongly toward the second term, PNasty_Nice. This yields a result of -0.3. In this case, ReactingActor is quite a bit less likely to help out his or her irritating cousin than in either of the prior two examples.
If you play around with the Blend operator in Scryptalyzer you can see this principle at work.