question

malik-allen01 avatar image
malik-allen01 asked

Can I pass properties from a Rule into the arguments of a ExecuteCloudScript Action?

Player InventoryPlayStream
1 comment
10 |1200

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

malik-allen01 avatar image malik-allen01 commented ·

Specifically When the player is granted a duplicate item, I am looking to give player virtual currency (which is already confirmed to be working) instead.

1.The problem is in trying to consume the item that the player has just received. I wanted to piggy back this off the the action of granting items to players, and I will add more conditions as needed to identify which items are capable of being exchanged for virtual currency when duplicates are present.

The items on my catalog are marked as consumable (consumption count of 1) and stackable.

I intend use the ExecuteCloudScript action to call Consume Item and pass the item id from the player_inventory_item_added event, in the above example. But, I don't know how to get the ItemInstanceId from the event, and if that is even supported in this context.

2. In the below example I've added a condition of checking an items remaining uses, to see that is greater than 1 before executing the action. When I monitor this event, the actions never occur even when items have a stack greater than one.

0 Likes 0 ·

1 Answer

·
Seth Du avatar image
Seth Du answered

Context has the information. You may simply add “return context;” in the cloud script function to see what are contained there. By default, event-triggered execution will have the event payload in the context, which has instance ID if it is “Player inventory item added” event. However, checking the remaining uses will still need to get the full inventory in the cloud script function.

2 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.

malik-allen01 avatar image malik-allen01 commented ·

Ok so, I had tried using the context in the past. But whenever I tried to consume the item with the context's ItemInstanceId it, would always return an error stating that the item does not exist in the player's inventory

As of today, the rule and action no longer executing. I made no changes to the actions or conditions and the action was executing each time, but now its not.

0 Likes 0 ·
capture.png (24.1 KiB)
malik-allen01 avatar image malik-allen01 commented ·

*Update* It seems that my code is working. Just that the playstream does not always show the event being executed

0 Likes 0 ·

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.