home *** CD-ROM | disk | FTP | other *** search
/ UnrealScript Game Programming All in One / UnrealScriptGameProgrammingAllInOne.iso / UGPAIOListings / UGPAIOListingsCh09 / CH09LIST / Classes / CH09_06LIST.uc < prev   
Encoding:
Text File  |  2006-01-28  |  2.4 KB  |  79 lines

  1.   // %PARAMETERS = "CH09LIST C:\UT2004"
  2.   //  Identifies the package
  3.   //  CH09_06LIST.uc
  4.  
  5.  
  6.   class CH09_06LIST extends Commandlet;
  7.  
  8.       function int main(string args){
  9.  
  10.       //#1 Declare a series of strings
  11.       local string szRedWoodSongLineA,
  12.                    szRedWoodSongLineB,
  13.                    szRedWoodSongLineC,
  14.                    szRedWoodSongLineD,
  15.                    szRedWoodSongLineE;
  16.       //#2 string for source information
  17.       local string szAuthor;
  18.       local string szPoemTitle;
  19.       local string szBookTitle;
  20.       //string for concatenation
  21.       local string szSourceInformation;
  22.       local string szLine;
  23.       local int iCtr;
  24.       local int iStrLen;
  25.  
  26.       // #3
  27.       //Initialize local identifiers
  28.       szRedWoodSongLineA = "A California song," ;
  29.       szRedWoodSongLineB = "A prophecy and indirection," $
  30.                             " a thought impalpable to breathe as air,";
  31.       szRedWoodSongLineC = "A chorus of dyads, fading," $
  32.                            " departing, or hamadryads departing,";
  33.       szRedWoodSongLineD = "A murmuring, fateful, giant voice, " $
  34.                            " out of the earth and sky,";
  35.       szRedWoodSongLineE = "Voice of a mighty dying tree in " $
  36.                            "the redwood forest dense.";
  37.       szAuthor = "Walt Whitman";
  38.       szPoemTitle = "Song of the Redwood-Tree";
  39.       szBookTitle = "Leaves of Grass";
  40.  
  41.       //#4 Concatenate the information for one string
  42.       szSourceInformation $= Chr(13) @ szAuthor;
  43.       szSourceInformation  $=  Chr(13) @ szPoemTitle;
  44.       szSourceInformation $=  Chr(13) @ szBookTitle;
  45.  
  46.  
  47.  
  48.  
  49.       //#5 Make a string using a concatenation operator
  50.       //Use the Chr() function and an ASCII code
  51.       iStrLen = Len(szPoemTitle);
  52.       for(iCtr = 0; iCtr < iStrLen; iCtr++){
  53.          szLine $= Chr(186);
  54.       }
  55.       
  56.      //#6 Use the character string to create a title bar
  57.      // print the stanzas and the source information
  58.      // close with three successive strings
  59.       log("CH09_06LIST");
  60.       log(szLine @ szPoemTitle @ szLine);
  61.       log(Chr(13) @
  62.           szRedWoodSongLineA @ Chr(13) @
  63.           szRedWoodSongLineB @ Chr(13) @
  64.           szRedWoodSongLineC @ Chr(13) @
  65.           szRedWoodSongLineD @ Chr(13) @
  66.           szRedWoodSongLineE
  67.          );
  68.       log(szSourceInformation);
  69.       log(szLine @ szLine @ szLine);
  70.  
  71.       return 0;
  72.   }
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.