question

lanpartygamesstudio avatar image
lanpartygamesstudio asked

Event History Query: virtual currency decreased

Hi!

I'm trying to filter the event history to get events with name 'player_virtual_currency_balance_changed' and EventData.VirtualCurrencyBalance < EventData.VirtualCurrencyPreviousBalance in order to check how my players are expending Gems in my game (I'm using a custom cloudscript function to buy some items and accelerate chests).

My first approach was this query:

where EventData.EventName == 'player_virtual_currency_balance_changed' and EventData.VirtualCurrencyBalance < EventData.VirtualCurrencyPreviousBalance

but it seems that with elasticsearch you cannot access and compare both properties of the event.

How can I do this?

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.

jital avatar image jital ♦ commented ·

Greetings,

Since you are trying to see where players are spending VC, would it work for you to look into the cloudscript purchase events? In this case the query would be:

where FullName_Name == 'player_executed_cloudscript'and EventData. CloudScriptExecutionResult.FunctionName == 'CloudScriptFunctionName'

Does this work for you?

0 Likes 0 ·
lanpartygamesstudio avatar image lanpartygamesstudio jital ♦ commented ·

Hi Jital! Thanks for your answer.

Yes, thats an option that we already have and help us clasify the source of the currency expense.

The problem is that inside those functions we are calculating the exact quantity of currency to substract the user (how many gems to accelerate a chest opening depending on the remaining time, for example).

So with that query we still are not able to know the exact quantity of currency spent per user.

0 Likes 0 ·

1 Answer

·
jital avatar image
jital answered

Hello,

This is how to make less/greater than queries.

The issue is that an explicit cast needs to be made on the fields. This process currently isn't documented. The query you are looking to make would be something like this:

where FullName_Name == 'player_virtual_currency_balance_changed' and tolong(EventData.VirtualCurrencyPreviousBalance) > tolong(EventData.VirtualCurrencyBalance)
10 |1200

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

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.