1
0

_single_stock_item 1.0 KB

1234567891011121314151617181920212223242526272829
  1. # $single_stock_item
  2. !! generic function to be used to stock single purchase items in stores
  3. !! see # shop, specifically the household appliances section for an example of use
  4. !! ARGS 0 is the value identifying when the item is owned
  5. !! it is assumed that anything >= the value is acceptable, this allows for upgrades like regular tv to plasma
  6. !! ARGS 1 is the item description
  7. !! ARGS 2 is the price
  8. !! ARGS 3 is the variable name for the item
  9. !! ARGS 4 is the location to go back to
  10. !! This will check to see if the item is already owned
  11. dynamic "$RESULT = iif(<<$ARGS[3]>> >= <<ARGS[0]>>, '', 'not owned')"
  12. if $RESULT = '':
  13. exit
  14. end
  15. $RESULT = '<tr>' + _
  16. '<td align="center"><<$ARGS[1]>></td>' + _
  17. '<td align="left">costs <<ARGS[2]>> rubles</td>' + _
  18. '<td align="right">'
  19. if money >= ARGS[2]:
  20. $RESULT += '<a href="exec: gs ''$buy_single_item'', <<ARGS[0]>>, ''<<$ARGS[1]>>'', <<ARGS[2]>>, ''<<$ARGS[3]>>'', ''<<$ARGS[4]>>''">buy</a>'
  21. end
  22. $RESULT += '</td></tr>'
  23. --- $single_stock_item ---------------------------------