home *** CD-ROM | disk | FTP | other *** search
/ UnrealScript Game Programming All in One / UnrealScriptGameProgrammingAllInOne.iso / UGPAIOListings / UGPAIOListingsCh14 / CH14LIST / Classes / CH14_04LIST.uc < prev    next >
Encoding:
Text File  |  2006-02-07  |  1.3 KB  |  58 lines

  1. // %PARAMETERS = "CH14LIST C:\UT2004"
  2. //Identifies the package
  3.  
  4. //CH14_04LIST.uc
  5.  
  6. class CH14_04LIST extends Commandlet;
  7. function int Main(string Args){
  8. //while loops
  9.  
  10. //#1
  11. local Array<string> rgGemCategories;
  12. local string szGemCategories, szHead;
  13. local int iLIMIT, iCtr , iHW;
  14.  
  15. szHead = "";
  16. iHW = 55;
  17. iCtr = 0;
  18.  
  19. //Set up a list of items, colon delimited
  20. //to allow for white spaces
  21.  
  22. szGemCategories  =  "Alexandrite:Chrysoberyl:Cymophane:Chrysoberyl" $
  23.                     ":Red Spinel:Spinel:Blue Spinel:Spinel" $
  24.                     ":Pink Topaz:Topaz:Blue Topaz:Topaz" $
  25.                     ":Emerald:Beryl:Aquamarine:Beryl";
  26. iLIMIT =  split(szGemCategories, ":" , rgGemCategories);
  27.  
  28. //#2
  29. //Make a line
  30.    iCtr = iHW;
  31.    while(iCtr > 0){
  32.    //Concatenate characters into a line
  33.       szHead $= Chr(178);
  34.       iCtr--;
  35.    }//end while
  36.  
  37.  
  38. Log(" " $ Chr(10) @ "CH14_04LIST" @ Chr(10));
  39.  
  40. //#3
  41. //Display the items in the list
  42. Log("  Number of items: " @ (iLIMIT/2) @ Chr(10) );
  43. Log(" " $szHead $ Chr(10));
  44.  
  45.    iCtr = 0;
  46.    while(iCtr < iLIMIT){
  47.       //Display n and n+1 with each iteration
  48.       Log( "   "  $ rgGemCategories[iCtr] $ Chr(9) $ Chr(9)
  49.                                 $ rgGemCategories[iCtr + 1]);
  50.       //Increment by to so skip alternates
  51.       iCtr += 2;
  52.    }//end while
  53.   return 0;
  54. }
  55.  
  56.  
  57.  
  58.