home *** CD-ROM | disk | FTP | other *** search
/ UnrealScript Game Programming All in One / UnrealScriptGameProgrammingAllInOne.iso / UGPAIOListings / UGPAIOListingsCh19 / CH19LIST / Classes / CH19_03LIST.uc < prev    next >
Encoding:
Text File  |  2006-02-26  |  2.5 KB  |  73 lines

  1. // %PARAMETERS = "CH19LIST C:\UT2004"
  2. //Identifies the package
  3. //CH19_03LIST.uc
  4.  
  5. //This class tests CH19LIST.Script and
  6. //uses in addition CH19LIST.Element
  7.  
  8.  
  9. class CH19_03LIST extends Commandlet;
  10. function int Main(string Args)
  11. {
  12.   //#1
  13.   local Element firstElement, secondElement, thirdElement;
  14.   local Script firstScript;
  15.  
  16.   firstElement = new class'Element';
  17.   secondElement = new class'Element';
  18.   thirdElement = new class'Element';
  19.   firstScript = new class'Script';
  20.  
  21.   Log(Chr(10)$ " Testing the Element with Script class");
  22.  
  23.   //#2
  24.   firstElement.setElement("None",                                  //prop
  25.                          "Electra",                               //character
  26.                          "Am I to make thy rule of honor mine?",  //speech
  27.                          100);                                    //element
  28.   firstElement.setDirection("Still and angry.");
  29.  
  30.  
  31.   secondElement.setElement("None",                                  //prop
  32.                          "Chrysothemis",                           //character
  33.              "When thou art wise, then thou shalt guide us both.",  //speech
  34.                          105);                                     //element
  35.   secondElement.setDirection("Fearful.");
  36.  
  37.   //#3
  38.   firstScript.addElement(firstElement);
  39.   firstScript.addElement(secondElement);
  40.  
  41.   //#4
  42.   firstScript.showBasicElement(firstElement.getElementNum());
  43.   firstScript.showBasicElement(secondElement.getElementNum());
  44.   //Number of elements in container
  45.   Log(Chr(10) $ "    Elements: " $ firstScript.getLength());
  46.   //#5
  47.   secondElement = firstScript.getElement(100);
  48.  
  49.   Log(Chr(10) $ "  Changed values of second element:" );
  50.   Log("   [" $ secondElement.getElementNum()$ "]");
  51.   Log("   [" $ secondElement.getDirection() $ "]");
  52.   Log("   "  $ secondElement.getElementName() $ ":");
  53.   
  54.  
  55.   //#6
  56.   firstScript.addElement(thirdElement);
  57.  
  58.   thirdElement.setElement("With great passion",               //prop
  59.                          "Orestes",                           //character
  60.              "Can it be sad Electra!",                        //speech
  61.                          103);                                //element
  62.  
  63.   firstScript.addElement(thirdElement);
  64.   Log(Chr(10) $ "    Elements: " $ firstScript.getLength());
  65.   firstScript.showBasicElement(thirdElement.getElementNum());
  66.   firstScript.removeElement(103);
  67.   firstScript.showBasicElement(103);
  68.   Log(Chr(10) $ "    Elements: " $ firstScript.getLength());
  69.  
  70.  
  71.   return 0;
  72. }
  73.