home *** CD-ROM | disk | FTP | other *** search
/ Backpacker 1 (Norsk) / backpacker.iso / pc / data / misc / bpk.dxr / 00211_LoadTempGame.ls < prev    next >
Encoding:
Text File  |  1995-02-28  |  3.9 KB  |  120 lines

  1. on LoadTempGame
  2.   global tSNAME, tUNAME, CALL_F, tTWNS, tJOBS, tAction, J, tRANS, tWANS, DTQR, DTQW, tKARM, tSEX, tCASH, PNM, tYY, tMM, tDD, tDAYS, tDEPDD, tAFDD, tTRAVEL, tARRIVE_CASH, tPHONE_M, tAUKT_JOBS
  3.   if the machineType = 256 then
  4.     openXLib(the pathName & "FILEIO.DLL")
  5.     set FILE to FileIO(mnew, "?read", "bpd")
  6.   else
  7.     if the machineType <> 256 then
  8.       set FILE to FileIO(mnew, "?read", "BPdr")
  9.     end if
  10.   end if
  11.   if not objectp(FILE) then
  12.     ErrorH(FILE)
  13.     exit
  14.   end if
  15.   set S to FILE(mReadLine)
  16.   if not S contains "BackPacker Game - version 1.0" then
  17.     ErrorH(999)
  18.     exit
  19.   end if
  20.   set tSNAME to FILE(mReadLine)
  21.   delete char length(tSNAME) of tSNAME
  22.   set tUNAME to FILE(mReadLine)
  23.   delete char length(tUNAME) of tUNAME
  24.   set tSEX to value(FILE(mReadLine))
  25.   set tCASH to value(FILE(mReadLine))
  26.   set tEXCF to value(FILE(mReadLine))
  27.   set tAction to value(FILE(mReadLine))
  28.   set tLIVC to value(FILE(mReadLine))
  29.   set RRFCC to value(FILE(mReadLine))
  30.   set tYY to value(FILE(mReadLine))
  31.   set tMM to value(FILE(mReadLine))
  32.   set tDD to value(FILE(mReadLine))
  33.   set tDTQR to value(FILE(mReadLine))
  34.   set tDTQW to value(FILE(mReadLine))
  35.   set tLQNO to value(FILE(mReadLine))
  36.   set tRANS to value(FILE(mReadLine))
  37.   set tWANS to value(FILE(mReadLine))
  38.   set tKARM to value(FILE(mReadLine))
  39.   set tDAYS to value(FILE(mReadLine))
  40.   set tDEPDD to value(FILE(mReadLine))
  41.   set tAFDD to value(FILE(mReadLine))
  42.   set tTRAVEL to value(FILE(mReadLine))
  43.   set tARRIVE_CASH to value(FILE(mReadLine))
  44.   set tPHONE_M to value(FILE(mReadLine))
  45.   set tAUKT_JOBS to value(FILE(mReadLine))
  46.   set tGameFileName to FILE(mFileName)
  47.   FILE(mdispose)
  48.   if the machineType = 256 then
  49.     closeXLib(the pathName & "FILEIO.DLL")
  50.   end if
  51.   if not CodeMachine("Decode", RRFCC) then
  52.     ErrorH(666)
  53.     exit
  54.   end if
  55.   set tLPDAY to tDAYS
  56.   MakeTempLists()
  57.   pause()
  58.   continue()
  59.   go(the frame + 1)
  60. end
  61.  
  62. on ErrorH ErrMess
  63.   if ErrMess = -43 then
  64.     nothing()
  65.   else
  66.     if ErrMess = -49 then
  67.       alert("Cannot replace old files!")
  68.     else
  69.       if ErrMess < 0 then
  70.         alert("Problem reading the file!")
  71.       else
  72.         if ErrMess = 666 then
  73.           alert("This BackPacker document is corrupt and cannot be used!")
  74.         else
  75.           if ErrMess = 999 then
  76.             alert("This is not a compatible BackPacker document!")
  77.           end if
  78.         end if
  79.       end if
  80.     end if
  81.   end if
  82. end
  83.  
  84. on CodeMachine Message, readnumber
  85.   global tCASH, tSEX, tSNAME, tAction, tDAYS, tKARM, tUNAME, tYY, tTRAVEL, tPHONE_M
  86.   if tSNAME <> EMPTY then
  87.     set ASCII to charToNum(char 1 of tSNAME)
  88.   else
  89.     set ASCII to 9
  90.   end if
  91.   if (count(tAction) < 20) and (tCASH < 4000) then
  92.     set codenumber to tYY + (length(tSNAME) * integer(tCASH)) + tSEX + integer(tKARM) + count(tAction) - getAt(tAction, 1) + 129 + ASCII + (3435 * tDAYS) - tTRAVEL + tPHONE_M
  93.   else
  94.     if ((tDAYS + count(tAction)) >= 19) and ((tDAYS + count(tAction)) < 45) then
  95.       set codenumber to length(tSNAME) + (integer(tCASH) * tSEX) + integer(tKARM) + count(tAction) - getAt(tAction, 3) + 469 - (2 * tPHONE_M) - (456 * tDAYS) - (24 * tTRAVEL)
  96.     else
  97.       if (length(tUNAME) + integer(tCASH / 1000)) > 10 then
  98.         set codenumber to (tDAYS * integer(tCASH) * 67) + 9 + count(tAction) + ASCII + (2 * tYY) - integer(tKARM) + (tTRAVEL * tPHONE_M) + integer(tKARM)
  99.       else
  100.         if (tPHONE_M < 1500) and (tCASH > 3000) then
  101.           set codenumber to (tDAYS * integer(tCASH) * 63) + 9 + count(tAction) + tYY + (19 * integer(tKARM)) - (320 * tTRAVEL) - tPHONE_M
  102.         else
  103.           set codenumber to (tDAYS * integer(tCASH) * 60) + count(tAction) + tYY + (19 * integer(tKARM)) - (302 * tTRAVEL) - tPHONE_M + 56
  104.         end if
  105.       end if
  106.     end if
  107.   end if
  108.   if Message = "code" then
  109.     return codenumber
  110.   else
  111.     if Message = "decode" then
  112.       if readnumber = codenumber then
  113.         return 1
  114.       else
  115.         return 0
  116.       end if
  117.     end if
  118.   end if
  119. end
  120.