home *** CD-ROM | disk | FTP | other *** search
/ UnrealScript Game Programming All in One / UnrealScriptGameProgrammingAllInOne.iso / UGPAIOListings / UGPAIOListingsCh10 / CH10LIST / Classes / CH10_07LIST.uc < prev    next >
Encoding:
Text File  |  2006-01-31  |  1.3 KB  |  59 lines

  1. // %PARAMETERS = "CH10LIST C:\UT2004"
  2. //Identifies the package
  3. //CH10_07LIST.uc
  4.  
  5. class CH10_07LIST extends Commandlet;
  6.  
  7. function int Main(string Args)
  8. {
  9.   //#1
  10.   local int iInteger;
  11.   local float rReal;
  12.   local byte fByte;
  13.   local string szStringNumber;
  14.   local string szStringWord;
  15.   local bool bBoolean;
  16.  
  17.   fByte = 23;
  18.   iInteger = 1001;
  19.   rReal = 123.45;
  20.   szStringNumber = "1001";
  21.   szStringWord = "Word";
  22.   bBoolean = true;
  23.  
  24.   log("*************");
  25.   log("CH10_07LIST Casting floats" $ Chr(13) $ "");
  26.   log(Chr(13));
  27.   
  28.   //#2
  29.   //Casting numbers fo floats
  30.   //boolean to float
  31.   rReal = float(true);
  32.   log("1. Float value of boolean true: " @ rReal );
  33.  
  34.   //byte to float
  35.   rReal = float(fByte);
  36.   log("2. Float value of byte (23):" @ rReal );
  37.  
  38.   //Integer to float
  39.   rReal = float(iInteger);
  40.   log("3. Float value of integer (1001):" @ rReal );
  41.  
  42.   //#3
  43.   //String with word
  44.   rReal = float(szStringWord);
  45.   log("4. Float value of string number (1001):" @ rReal );
  46.  
  47.   //Sting with number
  48.   rReal = float(szStringNumber);
  49.   log("5. Float value of string number (1001):" @ rReal );
  50.  
  51.   //Letter converts to zero
  52.   rReal = float("b");
  53.   log("6. Float value of string as letter "
  54.                       $ Chr(34) $ "b" $ Chr(34)  @ rReal );
  55.  
  56.   return 0;
  57. }
  58.  
  59.