Skip to content

Buy Shop Item

Buy Shop Item

Attempts to purchase a shop item identified by its unique ID stored in a variable.

Properties

System

Name Explanation Type
Result The switch to store whether the purchase succeeded. Switch or Value
Shop Item The variable referencing the shop item to operate on. Variable or Value
Store Results When enabled, the result of the purchase attempt is stored in a switch. Toggle

Examples

Buy a Shop Item Referenced by Global Variable 0

This attempts to purchase the shop item whose unique ID is stored in Global Variable 0.

buy($gv[0]);
{"Data":{"Result":{"IsGlobalSwitch":true,"IsLocalSwitch":false,"IsValue":false,"Value":false,"SwitchIndex":0,"Metadata":null},"ShopItem":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"","VariableIndex":0,"Metadata":null},"StoreResults":false,"Metadata":null},"TypeName":"MAR.Game.RPGCore.Models.Scripts.Commands.Shop.BuyShopItemCommand"}

Buy a Shop Item and Store Whether the Purchase Succeeded

This attempts to purchase the shop item referenced by Local Variable 2 and stores the result in Global Switch 0.

$gs[0] = buy($lv[2]);
{"Data":{"Result":{"IsGlobalSwitch":true,"IsLocalSwitch":false,"IsValue":false,"Value":false,"SwitchIndex":0,"Metadata":null},"ShopItem":{"IsGlobalVariable":false,"IsLocalVariable":true,"IsValue":false,"Value":"","VariableIndex":2,"Metadata":null},"StoreResults":true,"Metadata":null},"TypeName":"MAR.Game.RPGCore.Models.Scripts.Commands.Shop.BuyShopItemCommand"}