home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 November / pcwk_11_98a.iso / Wtestowe / Money99 / money99.1 / life / logic.txt < prev    next >
Encoding:
Text File  |  1998-07-25  |  19.8 KB  |  605 lines

  1. test
  2. -- "on mouseUp
  3.   puppetSprite 12, false
  4.   getValues
  5.   go to frame 2
  6. end"
  7. -- "**********************************************************************"
  8. -- "on mouseUp
  9.   global calcType
  10.   puppetSprite 12, false
  11.   getValues
  12.   go to frame 5
  13.   
  14. end"
  15. -- "**********************************************************************"
  16. -- "on mouseUp
  17.   puppetSprite 12, false
  18.   getValues
  19.   go to frame 8
  20. end"
  21. -- "**********************************************************************"
  22. -- "on mouseUp
  23.   global calcType
  24.   puppetSprite 12, false
  25.   getValues
  26.   go to frame 11
  27. end"
  28. -- "**********************************************************************"
  29. -- "on mouseUp
  30.   global calcType
  31.   puppetSprite 12, false
  32.   getValues
  33.     go to frame 14
  34. end"
  35. -- "**********************************************************************"
  36. -- "on mouseUp
  37.   global calcType
  38.   puppetSprite 12, false
  39.   getValues
  40.   go to frame 17
  41. end"
  42. -- "**********************************************************************"
  43. -- "on mouseUp
  44.   global calcType
  45.   puppetSprite 12, false
  46.   getValues
  47.   calculateTotal
  48.   go to frame 20
  49. end"
  50. -- "**********************************************************************"
  51. -- "on exitFrame
  52.   global qnum, numValues, mouseIsDown, direction, maxQ, totalValue, onetimeValue, totalassetsValue, livingValue, shortfall, thisRoll, baseColor, darkColor
  53.   set thisRoll = 0
  54.   puppetSprite 39, true
  55.   set baseColor = 215
  56.   set darkColor = 255
  57.   set the floatprecision = 2
  58.   --set totalValue = 0
  59.   --set livingValue = 0
  60.   --set onetimeValue= 0
  61.   --set totalassetsValue = 0
  62.   --set shortfall = 0
  63.   -- set the text of member "onetime" = "$0"
  64.   --set the text of member "living" = "$0"
  65.   --set the text of member "totalassets" = "$0"
  66.   --set the text of member "total" = "$0"
  67.   --set maxQ = 14
  68.   --set direction = 0
  69.   -- set mouseIsDown = "false"
  70.   -- set qnum = 0
  71.   set numValues = list(6000, 5000, 0, 100000, 20000, 120000, 25000, 40000, 15000, 2000, 20, 50000, 50000, 0)
  72.   getValues
  73.   puppetSprite 12, true
  74. end"
  75. -- "**********************************************************************"
  76. -- "on enterframe
  77.   global thisRoll
  78.   set n = 42
  79.   repeat while (n < 49)
  80.     if (rollover(n) and (thisRoll <> (the memberNum of sprite n)) and (n <> 42)) then
  81.       resetColors n
  82.     end if
  83.     set n = n + 1
  84.   end repeat
  85.   set n = 16
  86.   repeat while (n < 21)
  87.     if (rollover(n) and (thisRoll <> (the memberNum of sprite n))) then
  88.       resetColors n
  89.     end if
  90.     set n = n + 1
  91.   end repeat
  92.   otherroll
  93. end
  94.  
  95.  
  96. on exitFrame
  97.   go the frame
  98. end
  99. "
  100. -- "**********************************************************************"
  101. -- "on exitFrame
  102.   puppetSprite 12, true
  103.   set the locV of sprite 12 = 7 + the locV of sprite 16
  104.   set the text of member "info" = "A typical funeral costs about $6,000 but can run double that.  Cremation is less expensive, costing as little as $1,300, although some states require you to buy a coffin anyway."
  105. end"
  106. -- "**********************************************************************"
  107. -- "on enterframe
  108.   global thisRoll
  109.   set n = 42
  110.   repeat while (n < 49)
  111.     if (rollover(n) and (thisRoll <> (the memberNum of sprite n)) and (n <> 43)) then
  112.       resetColors n
  113.     end if
  114.     set n = n + 1
  115.   end repeat
  116.   set n = 16
  117.   repeat while (n < 21)
  118.     if (rollover(n) and (thisRoll <> (the memberNum of sprite n))) then
  119.       resetColors n
  120.     end if
  121.     set n = n + 1
  122.   end repeat
  123.   otherroll
  124. end
  125.  
  126. on exitFrame
  127.   go the frame
  128. end
  129.  
  130. on mouseDown
  131.   global numValues
  132.   if (rollover(16) or rollover(21)) then
  133.     set the locV of sprite 12 = 7 + the locV of sprite 21
  134.     set the text of member "info" = "A typical funeral costs about $6,000 but can run double that.  Cremation is less expensive, costing as little as $1,300, although some states require you to buy a coffin anyway."
  135.   end if
  136.   if (rollover(17) or rollover(22)) then
  137.     set the locV of sprite 12 = 7 + the locV of sprite 22
  138.     set the text of member "info" = "Include the maximum out-of-pocket costs allowed by your medical insurance plus airfare for immediate family attending the funeral."
  139.   end if
  140.   if (rollover(18) or rollover(23)) then
  141.     set the locV of sprite 12 = 7 + the locV of sprite 23
  142.     set the text of member "info" = "Federal inheritance taxes range from 37% to 55% of estates valued at $600,000 or more.  Some states impose taxes on estates worth less than that amount, so consult an attorney if you're not sure."
  143.   end if
  144. end
  145. "
  146. -- "**********************************************************************"
  147. -- "on exitFrame
  148.   puppetSprite 12, true
  149.   set the locV of sprite 12 = 7 + the locV of sprite 16
  150.   set the text of member "info" = "If any relatives would continue to live in your home after your death, it is smart to make sure that the mortgage can be paid off."
  151. end"
  152. -- "**********************************************************************"
  153. -- "on enterframe
  154.   global thisRoll
  155.   set n = 42
  156.   repeat while (n < 49)
  157.     if (rollover(n) and (thisRoll <> (the memberNum of sprite n)) and (n <> 44)) then
  158.       resetColors n
  159.     end if
  160.     set n = n + 1
  161.   end repeat
  162.   set n = 16
  163.   repeat while (n < 21)
  164.     if (rollover(n) and (thisRoll <> (the memberNum of sprite n))) then
  165.       resetColors n
  166.     end if
  167.     set n = n + 1
  168.   end repeat
  169.   otherroll
  170. end
  171.  
  172. on exitFrame
  173.   go the frame
  174. end
  175.  
  176. on mouseDown
  177.   global numValues
  178.   if (rollover(16) or rollover(21)) then
  179.     set the locV of sprite 12 = 7 + the locV of sprite 21
  180.     set the text of member "info" = "If any relatives would continue to live in your home after your death, it is smart to make sure that the mortgage can be paid off."
  181.   end if
  182.   if (rollover(17) or rollover(22)) then
  183.     set the locV of sprite 12 = 7 + the locV of sprite 22
  184.     set the text of member "info" = "Credit card debt, car loans, student loans.  You don't want to saddle your executor or relatives with selling other assets in your estate just to pay off your debts."
  185.   end if
  186.   if (rollover(18) or rollover(23)) then
  187.     set the locV of sprite 12 = 7 + the locV of sprite 23
  188.     set the text of member "info" = "Figure on $15,000 per year for a public university or use the College Savings Calculator."
  189.   end if
  190.   if (rollover(19) or rollover(24)) then
  191.     set the locV of sprite 12 = 7 + the locV of sprite 24
  192.     set the text of member "info" = "This is any extra amount that you may want your family to have.  You should probably include at least $25,000 for an emergency fund."
  193.   end if
  194. end
  195. "
  196. -- "**********************************************************************"
  197. -- "on exitFrame
  198.   puppetSprite 12, true
  199.   set the locV of sprite 12 = 7 + the locV of sprite 16
  200.   set the text of member "info" = "Enter your current annual after-tax living expenses.  The calculator multiplies this by 0.8, because it is assumed that your family's living expenses will decline 20 percent after you are gone."
  201. end"
  202. -- "**********************************************************************"
  203. -- "on enterframe
  204.   global thisRoll
  205.   set n = 42
  206.   repeat while (n < 49)
  207.     if (rollover(n) and (thisRoll <> (the memberNum of sprite n)) and (n <> 45)) then
  208.       resetColors n
  209.     end if
  210.     set n = n + 1
  211.   end repeat
  212.   set n = 16
  213.   repeat while (n < 21)
  214.     if (rollover(n) and (thisRoll <> (the memberNum of sprite n))) then
  215.       resetColors n
  216.     end if
  217.     set n = n + 1
  218.   end repeat
  219.   otherroll
  220. end
  221.  
  222. on exitFrame
  223.   go the frame
  224. end
  225.  
  226. on mouseDown
  227.   global numValues
  228.   if (rollover(16) or rollover(21)) then
  229.     set the locV of sprite 12 = 7 + the locV of sprite 21
  230.     set the text of member "info" = "Enter your current annual after-tax living expenses.  The calculator multiplies this by 0.8, because it is assumed that your family's living expenses will decline 20 percent after you are gone."
  231.   end if
  232.   if (rollover(17) or rollover(22)) then
  233.     set the locV of sprite 12 = 7 + the locV of sprite 22
  234.     set the text of member "info" = "Enter an estimate of your spouse's annual take-home pay."
  235.   end if
  236.   if (rollover(18) or rollover(23)) then
  237.     set the locV of sprite 12 = 7 + the locV of sprite 23
  238.     set the text of member "info" = "How much will your family receive annually in Social Security survivorship benefits?"
  239.   end if
  240. end
  241. "
  242. -- "**********************************************************************"
  243. -- "on exitFrame
  244.   global shortfall
  245.   calculateTotal
  246.   puppetSprite 12, true
  247.   set the locV of sprite 12 = 7 + the locV of sprite 16
  248.   set the text of member "info" = "How many years will your family need help covering the difference between income and expenses?"
  249.   calcNum string(shortfall)
  250.   set incomeString = the result
  251.   calcDollar string(incomeString)
  252.   set tempResult = the result
  253.   if char 1 of tempResult = "-" then
  254.     delete char 1 of tempResult
  255.   end if
  256.   
  257.   if (shortfall > 0) then
  258.     set the text of member 27 = "Without your work income, your family will face an annual shortfall of  " & tempResult & ".  Insurance will be needed to cover this shortfall until circumstances change (as when your children become employed)."
  259.   end if
  260.   if (shortfall < 0) then
  261.     set the text of member 27 = "Without your work income, your family will earn  " & tempResult & " more than they need annually."
  262.   end if
  263.   if (shortfall = 0) then
  264.     set the text of member 27 = "Without your work income, your family's earnings will exactly match their needs."
  265.   end if
  266.   
  267. end"
  268. -- "**********************************************************************"
  269. -- "on enterframe
  270.   global thisRoll
  271.   set n = 42
  272.   repeat while (n < 49)
  273.     if (rollover(n) and (thisRoll <> (the memberNum of sprite n)) and (n <> 46)) then
  274.       resetColors n
  275.     end if
  276.     set n = n + 1
  277.   end repeat
  278.   set n = 16
  279.   repeat while (n < 21)
  280.     if (rollover(n) and (thisRoll <> (the memberNum of sprite n))) then
  281.       resetColors n
  282.     end if
  283.     set n = n + 1
  284.   end repeat
  285.   otherroll
  286. end
  287.  
  288. on exitFrame
  289.   go the frame
  290. end
  291.  
  292. on mouseDown
  293.   global numValues
  294.   if (rollover(16) or rollover(21)) then
  295.     set the locV of sprite 12 = 7 + the locV of sprite 21
  296.     set the text of member "info" = "How many years will your family need help covering the difference between income and expenses?"
  297.   end if
  298. end
  299. "
  300. -- "**********************************************************************"
  301. -- "on exitFrame
  302.   puppetSprite 12, true
  303.   set the locV of sprite 12 = 7 + the locV of sprite 16
  304.   set the text of member "info" = "If you already have some life insurance coverage, how much will those policies pay upon your death?"
  305. end"
  306. -- "**********************************************************************"
  307. -- "on enterframe
  308.   global thisRoll
  309.   set n = 42
  310.   repeat while (n < 49)
  311.     if (rollover(n) and (thisRoll <> (the memberNum of sprite n)) and (n <> 47)) then
  312.       resetColors n
  313.     end if
  314.     set n = n + 1
  315.   end repeat
  316.   set n = 16
  317.   repeat while (n < 21)
  318.     if (rollover(n) and (thisRoll <> (the memberNum of sprite n))) then
  319.       resetColors n
  320.     end if
  321.     set n = n + 1
  322.   end repeat
  323.   otherroll
  324. end
  325.  
  326. on exitFrame
  327.   go the frame
  328. end
  329.  
  330. on mouseDown
  331.   global numValues
  332.   if (rollover(16) or rollover(21)) then
  333.     set the locV of sprite 12 = 7 + the locV of sprite 21
  334.     set the text of member "info" = "If you already have some life insurance coverage, how much will those policies pay upon your death?"
  335.   end if
  336.   if (rollover(17) or rollover(22)) then
  337.     set the locV of sprite 12 = 7 + the locV of sprite 22
  338.     set the text of member "info" = "If you have other assets that could be sold to generate cash, enter the total value of those assets."
  339.   end if
  340. end
  341. "
  342. -- "**********************************************************************"
  343. -- "on otherRoll
  344.   global thisRoll, baseColor
  345.   if (thisRoll <> 0) and not(rollover(42) or rollover(43) or rollover(44) or rollover(45) or rollover(46) or rollover(47) or rollover(48) or rollover(16) or rollover(17) or rollover(18) or rollover(19) or rollover(20)) then
  346.     resetColors 0
  347.   end if
  348. end"
  349. -- "**********************************************************************"
  350. -- "on getValues
  351.   global numValues
  352.   --get values
  353.   set n = 0
  354.   repeat while (n < 13)
  355.       set n = n + 1
  356.     if n = 11 then
  357.       set incomeString = line 1 of the text of member (n + 44)
  358.       calcNum incomeString
  359.       set incomeString = the result
  360.       setAt numValues n, value(incomeString)
  361.       if getAt(numvalues, n) > 100 then
  362.         setAt numValues n, 100
  363.       end if
  364.       if getAt(numvalues, n) < 0 then
  365.         setAt numValues n, 0
  366.       end if
  367.       if getAt(numvalues, n) = 1 then
  368.         set the text of member (n + 44) = getAt(numvalues, n) & " year"
  369.       else
  370.         set the text of member (n + 44) = getAt(numvalues, n) & " years"
  371.       end if
  372.       
  373.     else
  374.       set incomeString = line 1 of the text of member (n + 44)
  375.       calcNum string(incomeString)
  376.       set incomeString = the result
  377.       setAt numValues n, value(incomeString)
  378.       calcDollar string(incomeString)
  379.       set incomeString = the result
  380.       set the text of member (n + 44) = incomeString
  381.     end if
  382.     
  383.   end repeat
  384.   
  385. end
  386.  
  387. "
  388. -- "**********************************************************************"
  389. -- "on calcDollar thisString
  390.   set minus = "false"
  391.   set n = 0
  392.   if (char 1 of thisString = "-") then
  393.     delete char 1 of thisString
  394.     set minus = "true"
  395.   end if
  396.   
  397.   set x = the number of chars in thisString
  398.   repeat while (n < x)
  399.     set n = n + 1
  400.     if (char n of thisString = ".") then
  401.       if (the number of chars in thisString - n > 2) then
  402.         delete char (n + 3) to (the number of chars in thisString) of thisString
  403.       end if
  404.       set x = n - 1
  405.     end if
  406.   end repeat
  407.   set n = 0
  408.   repeat while (n < x - 1)
  409.     set n = n + 1
  410.     if (n mod 3 = 0) then
  411.       set thisString = chars(thisString,1,x - n) & "," & chars(thisString,x - n + 1,the number of chars in thisString)
  412.     end if
  413.   end repeat
  414.   if minus = "false" then
  415.     set thisString = "$" & thisString
  416.   else
  417.     set thisString = "-$" & thisString
  418.   end if
  419.   if char (the number of chars in thisString) of thisString = "." then
  420.     set thisString = thisString & "0"
  421.   end if
  422.   if char ((the number of chars in thisString) - 1) of thisString = "." then
  423.     set thisString = thisString & "0"
  424.   end if
  425.   return thisString
  426. end
  427. "
  428. -- "**********************************************************************"
  429. -- "on calcNum thisString
  430.   if (the number of chars in thisString = 0) then
  431.     set thisString = "0"
  432.   end if
  433.   set minus = "false"
  434.   set n = 1
  435.   set decimal = "false"
  436.   repeat while (n <= the number of chars in thisString)
  437.     if not((value(char n of thisString) >= 0) and (value(char n of thisString) <= 9)) then
  438.       if (not(char n of thisString = ".")) or decimal = "true" then
  439.         if ((char n of thisString = "-") and (n = 1)) then
  440.           set minus = "true"
  441.         end if
  442.         delete char n of thisString
  443.       else
  444.         set decimal = "true"
  445.         set n = n + 1
  446.       end if
  447.     else
  448.       set n = n + 1
  449.     end if
  450.   end repeat
  451.   set zeros = TRUE
  452.   repeat while (zeros = TRUE)
  453.     if (char 1 of thisString) = "0" then
  454.       delete char 1 of thisString
  455.     else
  456.       set zeros = FALSE
  457.     end if
  458.   end repeat
  459.   if decimal = "true" then
  460.     set zeros = TRUE
  461.     repeat while (zeros = TRUE)
  462.       if (char (the number of chars in thisString) of thisString) = "0" then
  463.         delete char (the number of chars in thisString) of thisString
  464.       else
  465.         set zeros = FALSE
  466.       end if
  467.     end repeat
  468.   end if
  469.   
  470.   if thisString = "." then
  471.     set thisString = "0"
  472.   end if
  473.   
  474.   if (the number of chars in thisString = 0) then
  475.     set thisString = "0"
  476.   end if
  477.   if (minus = "true") and not(thisString = "0") then
  478.     set thisString = "-" & thisString
  479.   end if
  480.   repeat while (the number of chars in thisString) > 8
  481.     delete char (the number of chars in thisString) of thisString
  482.     
  483.   end repeat
  484.   if char (the number of chars in thisString) of thisString = "." then
  485.     delete char (the number of chars in thisString) of thisString
  486.   end if
  487.   
  488.   return thisString
  489. end
  490. "
  491. -- "**********************************************************************"
  492. -- "on calculateTotal
  493.   global numValues, totalValue, onetimeValue, livingValue, totalassetsValue, shortfall
  494.   set n = 0
  495.   set onetimeValue = 0
  496.   set livingValue = 0
  497.   set totalassetsValue = 0
  498.   repeat while n < 7
  499.     set n = n + 1
  500.     set onetimeValue = onetimeValue + (getAt(numValues, n))
  501.   end repeat
  502.  
  503.   set livingValue = getAt(numValues, 8)
  504.   set livingValue = integer(livingValue * 0.8)
  505.   set livingValue = livingValue - getAt(numValues, 9) - getAt(numValues, 10)
  506.   set shortfall = livingValue
  507.   set livingValue = livingValue * getAt(numValues, 11)
  508.   set totalassetsValue = getAt(numValues, 12) + getAt(numValues, 13)
  509.   set totalValue = onetimeValue + livingValue - totalassetsValue
  510.   calcNum string(totalvalue)
  511.   set incomeString = the result
  512.   calcDollar string(incomeString)
  513.   
  514.   if totalValue > 0 then
  515.     set the text of member "totaltext" = "To ensure your family's continued well-being, you should have an additional " & the result & " in life insurance coverage."
  516.   else
  517.     set the text of member "totaltext" = "You have more than enough coverage for your family's needs."
  518.   end if
  519.   
  520.   
  521.  
  522.  
  523.  
  524.  
  525.   calcNum string(onetimevalue)
  526.   set incomeString = the result
  527.   calcDollar string(incomeString)
  528.   set the text of member "totaldeath" = "One-time expenses add up to " & the result
  529.  
  530.   calcNum string(shortfall)
  531.   set incomeString = the result
  532.   calcDollar string(incomeString)
  533.  
  534.   set tempResult = the result
  535.   if char 1 of tempResult = "-" then
  536.     delete char 1 of tempResult
  537.   end if
  538.  
  539.   if (shortfall > 0) then
  540.     set the text of member "totalshortfall" = "Your family will experience an income shortfall of " & tempResult & " annually for " & the text of member 55 & " after your death."
  541.   else
  542.     set the text of member "totalshortfall" = "However, your family will earn " & tempResult & " more than they need annually for " & the text of member 55 & " after your death."
  543.   end if
  544.   if (shortfall = 0) then
  545.     set the text of member "totalshortfall" = "Your family will earn exactly what they need to live on for " & the text of member 55 & " after your death."
  546.   end if
  547.  
  548.   calcNum string(totalAssetsValue)
  549.   set incomeString = the result
  550.   calcDollar string(incomeString)
  551.   if totalAssetsValue > 0 then
  552.     set the text of member "totalassets" = "Insurance and other existing assets totaling " & the result & " will help mitigate your family's loss."
  553.   else
  554.     set the text of member "totalassets" = "There are no other assets to help mitigate your family's loss."
  555.   end if
  556. end
  557.  
  558. "
  559. -- "**********************************************************************"
  560. -- "on resetColors n
  561.   global thisRoll, baseColor, darkColor
  562.   if (thisRoll <> 0) then
  563.       set the forecolor of member thisRoll = darkColor
  564.     set the locV of sprite 39 = 800
  565.   end if
  566.   if (n <> 0) then
  567.     if (n < 42) then
  568.       set the forecolor of member (the memberNum of sprite n) = baseColor
  569.     end if
  570.     set thisRoll = (the memberNum of sprite n)
  571.     if (n > 41) then
  572.       set the locV of sprite 39 = 44 + (32 * (n - 42))
  573.     end if
  574.   else
  575.     set thisRoll = 0
  576.   end if
  577. end
  578. "
  579. -- "**********************************************************************"
  580. -- "on enterframe
  581.   global thisRoll
  582.   set n = 42
  583.   repeat while (n < 49)
  584.     if (rollover(n) and (thisRoll <> (the memberNum of sprite n)) and (n <> 48)) then
  585.       resetColors n
  586.     end if
  587.     set n = n + 1
  588.   end repeat
  589.   set n = 16
  590.   repeat while (n < 21)
  591.     if (rollover(n) and (thisRoll <> (the memberNum of sprite n))) then
  592.       resetColors n
  593.     end if
  594.     set n = n + 1
  595.   end repeat
  596.   otherroll
  597. end
  598.  
  599.  
  600. on exitFrame
  601.   go the frame
  602. end
  603. "
  604. -- "**********************************************************************"
  605.