PickACharacter(ThatPerson, CharacterExpression)

This is a new function that I am contemplating. It takes two arguements; the first is of type person, and the second is of a new datatype; I shall call this datatype "expression", and the arguement of the function will be called CharacterExpression. It will take the form of a numeric constant that will be used by the interpreter to determine which of many functions will actually be used inside a loop of the form:

 

BestValue = 0;

BestIndex = -1;

for (i = 0; (i < CharacterCount); ++i)

{

if (OnStage[i] && (CharacterTest) && (CharacterValue > BestValue))

{

BestValue = CharacterExpression;

BestIndex = i;

}

}

return (BestIndex);

 

If BestIndex == -1, then we have to disable the option before it can do any damage. There are many ways to do this, but I think that the best way is to set the weight of the associated consequence to zero, insuring that it will not be selected. This allows the storytelling engine to select another option in that event. How can we tell the interpreter which consequence is at risk? The obvious approach is to add a third arguement that assigns the consequence number to zero out, but this approach is rife with dangers. What if the storybuilder happens to change the value? What if she later deletes a consequence? The only really safe way to handle this is to set BestIndex to something other than -1, say, -2, then have an if-statement in the ReactToNews routine that examines each of the three character slots (Subject, DirObject, and IndObject) and, if any of them is -2, cancels the whole consequence. Yes, perhaps this is the way to do it.

 

 

 

 

There will be a table of expressions that we can extend in the future; here is the first draft of that table:

 

Expression Name CharacterTest CharacterValue

Anybody i != ThisActor Abs(rand)

AnybodyButSubject i != ThisSubject Abs(rand)

AnybodyButDirObject i != ThisDirObject Abs(rand)

AnybodyButIndObject i != ThisIndObject Abs(rand)

AnybodyButSubjectOrDirObject (i != ThisSubject) && (i != ThisDirObject) Abs(rand)

AnybodyButSubjectOrIndObject (i != ThisSubject) && (i != ThisIndObject) Abs(rand)

AnybodyButDirObjectOrIndObject (i != ThisDirObject) && (i != ThisIndObject) Abs(rand)

AnybodyButSubjectOrDirObjectOrIndObject (i != ThisSubject) && (i != ThisDirObject) && (i != ThisIndObject) Abs(rand)

AnyMale Male[i] Abs(rand)

AnyFemale !Male[i] Abs(rand)

AnybodyOppositeInGenderToThatPerson Male[i] != Male[ThatPerson] Abs(rand)

AnybodyOfTheSameGenderAsThatPerson Male[i] == Male[ThatPerson] Abs(rand)

WhomThatPersonLovesMost i != ThatPerson Affection[ThatPerson, i]

WhomThatPersonHatesMost i != ThatPerson -Affection[ThatPerson, i]

WhomThatPersonTrustsMost i != ThatPerson Trust[ThatPerson, i]

WhomThatPersonTrustsLeast i != ThatPerson -Trust[ThatPerson, i]

WhomThatPersonRespectsMost i != ThatPerson -Dominance[ThatPerson, i]

WhomThatPersonRespectsLeast i != ThatPerson Dominance[ThatPerson, i]

WhoLovesThatPersonMost i != ThatPerson Affection[i, ThatPerson]

WhoHatesThatPersonMost i != ThatPerson -Affection[i, ThatPerson]

WhoTrustsThatPersonMost i != ThatPerson Trust[i, ThatPerson]

WhoTrustsThatPersonLeast i != ThatPerson -Trust[i, ThatPerson]

WhoRespectsThatPersonMost i != ThatPerson -Dominance[i, ThatPerson]

WhoRespectsThatPersonLeast i != ThatPerson Dominance[i, ThatPerson]

WhomThatPersonLikesAndIsStrong i != ThatPerson Affection[ThatPerson, i] * Strength[i]

WhomDirObjectLovesMoreThanThatPerson (i != DirObject) && (i != ThatPerson) Affection[DirObject, i] - Affection[DirObject, ThatPerson]

WhomThatPersonTrustsMoreThanDirObject (i != DirObject) && (i != ThatPerson) Trust[ThatPerson, i] - Trust[ThatPerson, DirObject]

WhoRespectsSubjectMoreThanDirObject (i != Subject) && (i != DirObject) Dominance[i, DirObject] -Dominance[i, Subject] 

 

 

The expression names will be available on a menu labelled PickACharacter. This could be a long menu (28 entries so far); the other way is to provide a dialog box that defines these entries for the storybuilder.