home *** CD-ROM | disk | FTP | other *** search
/ UnrealScript Game Programming All in One / UnrealScriptGameProgrammingAllInOne.iso / UGPAIOListings / UGPAIOListingsCh18 / CH18LIST / Classes / CH18_03LIST.uc < prev    next >
Encoding:
Text File  |  2006-02-22  |  1.2 KB  |  41 lines

  1. // %PARAMETERS = "CH18LIST C:\UT2004"
  2. //Identifies the package
  3. //CH08_03LIST.uc
  4. class CH18_03LIST extends Commandlet;
  5. function int Main(string Args)
  6. {
  7.   //#1
  8.   local string szTest;
  9.   local Decoration firstDecor;
  10.  
  11.   szTest = "Electra";
  12.   firstDecor = new class'Decoration';
  13.   Log(Chr(10)$ "   Decoration Demonstration of Keywords" $ Chr(10));
  14.  
  15.  
  16.   //#2  Use of static form of a function - no identifier
  17.   Log("  1. makeWord(2)       : 'static' call to make a string a number ");
  18.   Log("                       : " $ class'Decoration'.static.makeWord(2));
  19.   Log(Chr(10));
  20.   //#3 Change the string
  21.   Log("  2. addDecoration()   : use of 'out' ");
  22.   Log("     Before change     : " $ szTest);
  23.   firstDecor.addDecoration(szTest, "*");
  24.   Log("     After change      : " $ szTest);
  25.   Log(Chr(10));
  26.   //#4 Force two integers into a string
  27.   Log("  3. Use of 'coerce'   : " $ firstDecor.joinTerms(1, 2));
  28.   Log(Chr(10));
  29.   //#5 Use an optional paramater
  30.   //Don't use it
  31.   Log("  4. Use of 'optional' : ");
  32.   Log("     No arugment given : " $ firstDecor.addSpace("Orestes"));
  33.   Log(Chr(10));
  34.   //Now use it
  35.   Log("  5. Use of 'optional' : ");
  36.   Log("     Argument of 3     : " $ firstDecor.addSpace("Orestes", 3));
  37.  
  38.   return 0;
  39. }
  40.  
  41.