Shop example
by JeremymahargA simple demonstration of a way to make a shop in GameMaker. This file is compatible with GM 3.1 or higher, and uses a maximum of only 5 lines of code per script to allow demo users (of old and current versions) to experiment with it.
INIT CODE - Displays item quantities at start of Shop Interaction. Place in the card script of both the BUY and SELL cards.
SHOWBUTTON 1 Item ( $itemname$ )
SHOWBUTTON 2 Item2 ( $itemname2$ )
...etc...
BUY CODE - Put on button of item. Set number on SHOWBUTTON to same number as button being used.
IF counter >= 100 THEN
itemname = itemname + 1
counter = counter - 100
SHOWBUTTON 1 Item ( $itemname$ )
END IF
SELL CODE - Put on button of item. Set number on SHOWBUTTON to same number as button being used.
IF itemname > 0 THEN
itemname = itemname - 1
counter = counter + 100
SHOWBUTTON 1 Item ( $itemname$ )
END IF
Download it here.