Sign In Register

How can we help you today?

Start a new topic

grant a free virtual good

Hi Gamesparks,

I'm trying to grant virtual goods for free to my users. I found this lines of script should do the job:


var GOLD_COIN_VAR = Spark.getData().GOLD_COIN_ATT

Spark.getPlayer().addVGood(GOLD_COIN, GOLD_COIN_VAR, "reason")


Though when i try to test my script in the test harness, i get the following error:

ReferenceError: "GOLD_COIN" is not defined. (event/GRANT_GOLD_COIN.js#11)

what am i missing out on? Thank you in advance. 


Hi Bark Bark,

The problem here is that you're passing a variable in to the 'addVGood' function (GOLD_COIN), which hasn't been defined. Could you try the following and let us know if you're still getting an error?

Spark.getPlayer().addVGood("GOLD_COIN", GOLD_COIN_VAR);



hey Vinnie,

thanks, that fixed the issue. For the future, is there any page where i can look to troubleshoot errors? thank you for your help!



Login to post a comment