question

vwoowv avatar image
vwoowv asked

CloudScript execution error.

When I execute cloud script, an error occurred.

Screenshot about an error is below.

Some cloud scripts succeed, some scripts failed.

CloudScript
cloudscript-error.png (159.1 KiB)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

Can you please provide the details of the handler you're calling?

16 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

vwoowv avatar image vwoowv commented ·

Ok.

This is the handler function.

handlers.forceToSetGold = function(args) {
    var currentGold = parseInt(args.data["CurrentGold"]);
    var updateUserData = {};
    updateUserData["Gold"] = currentGold;
    server.UpdateUserReadOnlyData({
        PlayFabId: currentPlayerId,
        Data: updateUserData
    });


    return true;
}

0 Likes 0 ·
brendan avatar image brendan vwoowv commented ·

Are you sure that's the handler? It's "forceToSetGold", while you're calling "rebirth". If it is, and you've just renamed it, then can you try passing CurrentGold in, since that's what this handler is trying to parse?

0 Likes 0 ·
vwoowv avatar image vwoowv brendan commented ·
handlers.rebirth = function(args) {
    var spentSoulStone = parseInt(args.data["SpentSoulStone"]);


    var userReadonlyData = server.GetUserReadOnlyData({
        PlayFabId: currentPlayerId,
        Keys: ["CumulStageRewardSoul", "ItemInfo", "StatisticsInfo"]
    });


    var statisticsData = new UserStatistics(userReadonlyData.Data["StatisticsInfo"].Value);
    
    var userInventoryData = server.GetUserInventory({
        PlayFabId: currentPlayerId
    });
    var itemInfoData = null;
    if (spentSoulStone > 0) {
        var ownedSoulStone = userInventoryData["VirtualCurrency"]["SS"];
        if (spentSoulStone > ownedSoulStone) spentSoulStone = ownedSoulStone;
        server.SubtractUserVirtualCurrency({
            PlayFabId: currentPlayerId,
            VirtualCurrency: "SS",
            Amount: spentSoulStone
        });
        itemInfoData = completeItemLevelUp(args, userReadonlyData);
    }

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.