home *** CD-ROM | disk | FTP | other *** search
- // %PARAMETERS = "CH20LIST C:\UT2004"
- //Identifies the package
- //CH20_04LIST.uc
-
- //This class tests CH19LIST.Actor
-
- class CH20_04LIST extends Commandlet;
- function int Main(string Args)
- {
- //#1
- local Element firstElement, secondElement;
- local Actor firstActor, secondActor;
-
- firstElement = new class'Element';
- secondElement = new class'Element';
- firstActor = new class'Actor';
- secondActor = new class'Actor';
-
- Log(Chr(10)$ " Testing the Actor class");
-
- //#2
- firstElement.setElement("None",
- "Electra",
- "Am I to make thy rule of honor mine?",
- 100);
- firstElement.setDirection("Still and angry.");
-
- secondElement.setElement("None",
- "Chrysothemis",
- "When thou art wise, then thou shalt guide us both.",
- 105);
- secondElement.setDirection("Fearful");
-
- //#3
- //Test Actor using Element information
- Log(Chr(10) $ Caps(" Start of Electra"));
-
- firstActor.addInterpretation(firstElement.getDirection(),
- "Looking angrily at Chrysothemis.");
-
- Log(" Actor's interpretation of '"
- $ firstElement.getDirection() $" ': "
- $ Chr(10) $ " "
- $ firstActor.getInterpretation(firstElement.getDirection()) );
-
- firstActor.setCurrentSpeech( firstElement.getSpeech() );
- firstActor.setName( firstElement.getElementName() );
- firstActor.setAppearance("Dignified");
- firstActor.setPropUse("Nothing in hands. Gestures only.");
-
- //Access data
-
- Log(Chr(10) $
- " Actor name: " $ firstActor.getName());
- Log( " Actor's interpretation: "
- $ firstActor.getInterpretation(firstElement.getDirection()) );
- Log( " Actor's prop use: " $ firstActor.getPropUse());
- Log( " Actor appearance: " $ firstActor.getAppearance() );
-
- Log(Chr(10) $
- " Actor's current speech: ");
- firstActor.performCurrentSpeech();
-
- //#4
- Log(
- Chr(10) $"-------------------------------------------------------");
-
- //The default is to associate interpretation with version 0
- firstActor.addInterpretation("Stand Still",
- "Continue to look at Chrysothemis.");
-
- firstActor.addInterpretation("Stand Still, 2",
- "Look at Chrysothemis and show grief.");
-
- Log(" Actor's interpretation of 'Stand Still': "
- $ Chr(10) $ " "
- $ firstActor.getInterpretation("Stand Still") );
-
- Log(" Actor's interpretation of 'Stand Still 2': "
- $ Chr(10) $ " "
- $ firstActor.getInterpretation("Stand Still, 2") );
-
- Log(
- Chr(10) $"-------------------------------------------------------");
-
- //#5
- //Test for invalid data
- Log(Caps(" Invalid Data: "));
- Log(" When no text for the direction is provided:");
- firstActor.addInterpretation("",
- "Approach Chrysothemis " $
- "and look at the flowers.");
- Log("");
- Log(" When there is no corresponding direction:");
- Log(" Actor's interpretation of 'Show Terror': "
- $ Chr(10) $ " "
- $ firstActor.getInterpretation("Show Terror") );
-
-
- Log(
- Chr(10) $"-------------------------------------------------------");
- //#6
- //Test Actor using Element information
- Log(Chr(10) $ Caps(" Start of Chrysothemis"));
-
- secondActor.addInterpretation(secondElement.getDirection(),
- "Looking meekly at Electra.");
- Log(" Actor's interpretation of '"
- $ secondElement.getDirection() $" ': "
- $ Chr(10) $ " "
- $ secondActor.getInterpretation(secondElement.getDirection()) );
-
- secondActor.setCurrentSpeech( secondElement.getSpeech() );
- secondActor.setName( secondElement.getElementName() );
- secondActor.setAppearance("Reserved");
- secondActor.setPropUse("Carries flowers.");
-
- Log(Chr(10) $
- " Actor name: " $ secondActor.getName());
- Log(" Actor's interpretation: "
- $ secondActor.getInterpretation(secondElement.getDirection()) );
- Log(" Actor's prop use: " $ secondActor.getPropUse());
- Log(" Actor appearance: " $ secondActor.getAppearance() );
-
- Log(Chr(10) $ " Actor's current speech: ");
- secondActor.performCurrentSpeech();
-
- secondActor.addInterpretation("Show Relief",
- "Approach Electra and hold up the flowers.");
- Log(" Actor's interpretation of 'Show Relief': "
- $ Chr(10) $ " "
- $ secondActor.getInterpretation("Show Relief") );
-
- return 0;
- }
-