SWAT TUTORIAL
Quantifiers
Another type of word that we use in Deikto is a Quantifier. This is a word that indicates the magnitude of some quantity. Quantifiers can be used to intensify a Verb or modify an Attribute. There are eleven Quantifiers:
    
extra tiny (-0.99)
tiny (-0.8)
very small (-0.6)
small (-0.4)
medium-small (-0.2)
medium (0.0)
medium-large (+0.2)
large (+0.4)
very large (+0.6)
huge (+0.8)
extra huge (+0.99)


There are two situations in which you will write scripts using Quantifiers:

1) Writing the Acceptable and Desirable scripts for a Quantifier WordSocket; and

2) Using an existing Quantifier to calculate a result.

Letís take them separately:


How to Write Acceptable and Desirable Scripts for a Quantifier

Assume you want to set a Quantifier to be equivalent to an Actor's Fearful_Angry. The scripts for that Quantifier's WordSocket would look like this:

Acceptable:
    true

Desirable:
    Suitability of:
        CandidateQuantifier
        Fearful_Angry of:
            ReactingActor

Suitability is a special Operator that we cooked up just to handle the problem of selecting the right Quantifier for a position. It yields the highest value for the CandidateQuantifier most closely corresponding to the value of the BNumber argument.

Following is an exercise for how you might use a Quantifier.


Exercise 1: Setting a Quantifier in your Walkthrough Storyworld

Let's harken back to the testing storyworld created in the first tutorial section. Tom and Fred get into a bar fight, and Mary intervenes with Fred when he hits Tom with a Prop. Her only choice was to plead to desist. Let's add a Verb scold.

First, we need some more Attributes to make this work properly. Go to the Actor Editor and add two Attributes: Submissive_Dominant and Nasty_Nice. Assign Submissive_Dominant, Nasty_Nice, Submissive_DominantWeight, and Nasty_NiceWeight values for each of the Actors. (Recall that the Attributes themselves describe how much of that personality trait an Actor has, whereas the Weights tell how much the Actor wants to be perceived as having that Trait. Consequently Weights also reflect how important it is to the Actor that others have that Trait.)

Now return to the Verb Editor. Create a new Verb, scold, in your walkthrough storyworld, give it 3Actor and 4Quantifier WordSockets under Properties, and add it as an Option for the girlfriend Role under hit with. Now create two emotional reactions for Mary.

your first category: hit with: girlfiend: Adjust Fearful_Angry:

Submissive_Dominant of:
    ReactingActor

This script says that Mary will either become fearful to see Tom hit with an object, or angry, depending on how submissive or dominant she is.

Next, let's adjust her opinion of Fred:

your first category: hit with: girlfiend: Adjust PNasty_Nice:

ThisSubject
    BInverse of:
        BNumber2UNumber of:
        Harmless_Lethal of:
            This4Prop

This says that Mary's opinion of ThisSubject's (that is, Fred's) niceness will always go down (BInverse of BNumber2UNumber accomplishes this). That is, Mary never likes to see anyone hitting her boyfriend, Tom. How far her opinion of how nice he is will drop is affected by how lethal the Prop is that was used to hit Tom. (To see why this script works the way it does, look at how this script behaves in Scriptalyzer. We'll talk more about UNumbers, BNumbers, and so forth in our next tutorial, BNumbers, UNumbers, and Numbers.)

Now look under the Option scold. Make the Inclination to scold match the Fearful_Angry of ReactingActor. This says that Mary will only scold Fred if she is angry; otherwise, she will plead for him to desist.

Then create the scripts shown above for 4Quantifier.

Acceptable:
     true

Desirable:
     Suitability of:
          CandidateQuantifier
          Fearful_Angry of:
               ReactingActor

This says that the intensity of Mary's scolding of Fred will match the level of her anger.


How to Use an Existing Quantifier to Calculate a Result

Quantifiers can be used to affect Actors' decisions. To do this, the exact value of the Quantifier (e.g., "tiny," "very large," etc.) must be convert to a value that can be used in a Desirable or Inclination script. Depending on your needs, you can convert a Quantifier and use it as a BNumber, UNumber, or Number.

To convert an existing Quantifier to a BNumber, in response to an action using that Quantifier, use the following script:

Quantifier2BNumber of:
     This5Quantifier

This assumes that the Verb you are scripting in has a Quantifier in the 5th position. It tells the Engine to convert that Quantifier (extra tiny through extra huge) to a BNumber (-0.99 through +0.99) (Warning: if ThisVerb does not have a 5Quantifier in Properties, you will not be able to access the Operator "This5Quantifier.")

To convert a Quantifier to a UNumber under the same circumstances, use the following script:

Quantifier2UNumber of:
     This5Quantifier


This converts This5Quantifier to a UNumber (0.0 through 1.0).

To convert a Quantifier to a Number, use the following:

Quantifier2Scaler of:
     This5Quantifier

This converts This5Quantifier to a Number (0.0 through 1.0). (Quantifier2Scaler returns the same numerical value as Quantifier2UNumber, only with a Number data type instead of a UNumber/ BNumber data type.)

More on BNumbers, UNumbers, and Numbers can be found in the next tutorial.


Exercise 2: Scripting with a Quantifier

Carrying on from Exercise #1, above, let's assume that Fred has just been scolded by Mary. Now he has to respond, and he will respond according to how sternly Mary has scolded him.

First we need to give Fred some Options. Let's create two new Verbs: apologize and yell at. Give each new Verb a 3Actor WordSocket (hint: see the Verbs' Properties boxes). Then return to scold and add a Role, scoldee. This will be Fred's Role, but let's save ourselves some work. We'll write the AssumeRoleIf script such that others can use it as well, in case we want to allow other Actors to scold each other in different settings. Use this:

your first category: scold: scoldee
AreSameActor
     ReactingActor
     ThisDirObject

The person who will assume the Role will be the person just scolded—in our example, Fred.

Now add apologize and yell at as Options. To do so, single-click on each Verb in the Verb tree, and then use the green plus-arrow below the Options dropdown box.

For both apologize and yell at, here is the DirObject WordSocket:

Acceptable:
     AreSameActor:
          CandidateActor
          This Subject

This says the scolder will be the person scoldee reacts to (if you wanted to get fancy, you could have him apologize to Tom instead, as Tom was the one he was hitting...but let's keep it simple for now). Desirable you can leave as is.

For yell at, use this for the Inclination:

your first category: scold: scoldee: yell at
     Quantifier2UNumber of:
          This5Quantifier

Fred's Inclination to yell at Mary depends on how severely she scolded him.

Notice we converted the Quantifier to a UNumber instead of a BNumber. This means that the lowest possible value for yell at: Inclination is a hair above zero. This is because we assumed that even a tiny scold might make him inclined to react defensively instead of apologetically. However, you could use Quantifier2BNumber instead. This would make Fred less likely to yell at Mary if she scolded him. See what we mean by experimenting with each Quantifier conversion Operator in Scriptalyzer.

Now, for apologize, make the Inclination this:

your first category: scold: scoldee: apologize
     pNasty_Nice of:
          ReactingActor
          ThisSubject

This says that Fred's Inclination to apologize to Mary hinges on how much he likes Mary (for how much he likes her, I've used his perception of how nice she is; i.e., his pNasty_Nice of her). The Engine will compare Fred's pNasty_Nice of Mary to how severely she scolded him, and assign Fred a plan to either yell at her, or apologize, accordingly.

Once you have the scripts all built, try your test storyworld out in Storyteller, and see what happens. Then try adjusting the Actors' personality and relationship Attributes, and see how that changes the outcome.



Previous tutorial:  More About Attributes                                     Next tutorial:  BNumbers, UNumbers, and Numbers