Creating a shop script
From Platinum Arts Sandbox Free 3D Game Maker
This is a Sandbox shop example script, just follow and edit it to your liking.
1. "on_start" = [ 2. money = 0 3. pie = 0 4. sword = 0 5. treasure = 0 6. ] 7. 8. "level_trigger_1" = [ money = ( + $money 5 ) 9. echo "You got 5 moneys." 10. ] 11. 12. "level_trigger_2" = "showgui Shopkeeper" 13. 14. newgui Shopkeeper [ 15. guitext "What're ya buyin, stranger?" chat 16. guibar 17. guilist [ 18. guibutton "Pie: 10 moneys" [ 19. if ( > $money 9 ) [ 20. money = ( - $money 10 ) 21. pie = ( + $pie 1 ) 22. ] 23. ] 24. guibar 25. guibutton "Sword: 20 moneys" [ 26. if ( > $money 19 ) [ 27. money = ( - $money 20 ) 28. sword = ( + $sword 1 ) 29. ] 30. ] 31. guibar 32. guibutton "Treasure: 40 moneys" [ 33. if ( > $money 39 ) [ 34. money = ( - $money 40 ) 35. treasure = ( + $treasure 1 ) 36. ] 37. ] 38. ] 39. ] 40. 41. newgui Inventory [ 42. guibutton "Back" "cleargui 1" 43. guibar 44. guitext ( format "You have %1 moneys in your wallet." $money ) 45. guitext ( format "You have %1 pies. Yum." $pie ) 46. guitext ( format "You have %1 swords. Not that you can use them..." $sword ) 47. guitext ( format "You have %1 treasures. Lucky you!" $treasure ) 48. ] 49. 50. newgui main [ 51. guilist [ 52. guilist [ 53. guibutton "Inventory" "showgui Inventory" 54. ] 55. ] 56. guibar 57. @main 58. ]