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

  1. // %PARAMETERS = "CH14LIST C:\UT2004"
  2. //Identifies the package
  3. //CH14_05LIST.uc
  4.  
  5. class CH14_05LIST extends Commandlet;
  6. function int Main(string Args){
  7. //do while loops
  8. //#1
  9. local Array<string> rgQuartzValues;
  10. local string szQuartzValues, szHead;
  11. local int iLIMIT, iCtr, iHW;
  12.  
  13. szHead = "";
  14. iHW = 55;
  15. iCtr = 0;
  16.  
  17. //Set up a list of items, colon delimited
  18. //to allow for white spaces
  19.  
  20. szQuartzValues  =  "Amethyst:Modest:Citrine:High"$
  21.                    ":Rose  :High :Colorless:Low"$
  22.                    ":Cat's-eye:Low:Chalcedony:High"$
  23.                    ":Adventurine:Modest";
  24.  
  25. iLIMIT =  Split(szQuartzValues, ":" , rgQuartzValues);
  26.  
  27. //#2
  28. //Make a line
  29.    do{
  30.    //Concatenate characters into a line
  31.       szHead $= Chr(178);
  32.       iCtr++;
  33.    }until(iCtr > iHW);
  34.  
  35.  
  36. Log(" " $ Chr(10) @ "CH14_05LIST" @ Chr(10));
  37.  
  38. //#3
  39. //Display the items in the list
  40. Log("  Number of items: " @ (iLIMIT/2) @ Chr(10) );
  41. Log(" " $szHead $ Chr(10));
  42.  
  43.    iCtr = 0;
  44.    do{
  45.       //Display n and n+1 with each iteration
  46.       Log( "   "  $ rgQuartzValues[iCtr] $ Chr(9) $ Chr(9)
  47.                                 $ rgQuartzValues[iCtr + 1]);
  48.       //Increment by to so skip alternates
  49.       iCtr += 2;
  50.    }until(iCtr > iLIMIT/2);
  51.   return 0;
  52. }
  53.  
  54.  
  55.