home *** CD-ROM | disk | FTP | other *** search
/ UnrealScript Game Programming All in One / UnrealScriptGameProgrammingAllInOne.iso / UGPAIOListings / UGPAIOListingsCh13 / CH13LIST / Classes / CH13_09LIST.uc < prev    next >
Encoding:
Text File  |  2006-02-06  |  2.7 KB  |  75 lines

  1. // %PARAMETERS = "CH13LIST C:\UT2004"
  2. //Identifies the package
  3. //CH13_09LIST.uc
  4.  
  5. class CH13_09LIST extends Commandlet;
  6. function int Main(string Args){
  7.  
  8. // #1
  9. local string  szToPrint, szSource;
  10. local int iItr;
  11. local Array<string> rzWaldenLines;
  12.  
  13. iItr = 0;
  14.  
  15. rzWaldenLines[0] = "   The mass of men live lives of quiet desperation.";
  16. rzWaldenLines[1]= "    Most of the luxuries, and many of the so called"
  17.                                                                    $ Chr(10) $
  18.                "    comforts of life, are not only not indispensable,"
  19.                                                                    $ Chr(10) $
  20.                "    but positive hinderances to the elevation of mankind.";
  21. rzWaldenLines[2]= "    Every child begins the world again, to some extent,"
  22.                                                                    $ Chr(10) $
  23.                "    and loves to stay out doors, even in wet and cold.";
  24. rzWaldenLines[3]= "    If I knew for a certainty that a man was coming to"
  25.                                                                    $ Chr(10) $
  26.                "    my house with the conscious design of doing me good,"
  27.                                                                    $ Chr(10) $
  28.                "    I should run for my life . . . .";
  29. rzWaldenLines[4]= "    The heroic books, even if printed in the character"
  30.                                                                    $ Chr(10) $
  31.                "    of our mother tongue, will always be in a dead"
  32.                                                                    $ Chr(10) $
  33.                "    language to degenerate times . . . .";
  34. rzWaldenLines[5]= "    No man ever followed his genius until it misled him.";
  35.  
  36.  
  37. szSource  = "      Henry D. Thoreau  1817-1862" $ Chr(10) $ Chr(10) $
  38.             "      From: Henry D. Thoreau, Walden "  $ Chr(10) $
  39.             "      (Philadelphia: Courage Press, 1990).";
  40.  
  41.  
  42. // #2
  43. //Generate a random number
  44. //Convert number to a character
  45. Log(Chr(10) $ " CH13_09LIST " $  Chr(10));
  46.  iItr = Rand(6);
  47.  
  48. //#3 Test for the value of iIt - an integer
  49. //You can also test for a string
  50.   switch(iItr){
  51.     case 0:
  52.       szToPrint =  rzWaldenLines[0];
  53.        break;
  54.     case 1:
  55.       szToPrint =  rzWaldenLines[1];
  56.        break;
  57.     case 2:
  58.       szToPrint =  rzWaldenLines[2];
  59.        break;
  60.     case 3:
  61.       szToPrint =  rzWaldenLines[3];
  62.        break;
  63.     case 4:
  64.       szToPrint =  rzWaldenLines[4];
  65.        break;
  66.     default:      //will receive 5
  67.       szToPrint =  rzWaldenLines[5];
  68.  }//end switch
  69.  
  70.  iItr +=1;
  71.  Log( "(" $ iItr  $ ")" $ szToPrint $ Chr(10)
  72.                         $ Chr(10) $ szSource);
  73.  return 0;
  74. }
  75.