In fact, things are different from what I had understood. The first POST is made by the game portal server and returns the URL where the game will be located, with the user already logged into the portal.
RETURN { “status": 1, “msg": ‘SUCCESS’, “launch_url": ”http://...” }
Then I need to check the credit balance and then update the balance at the end of the game
//Get Account Balance curl --location 'https://...' \ --header 'Content-Type: application/json' \ --data '{ “method": ‘user_balance’, “user_code": ”000” }' //Define whether you won or lost curl --location 'https://...' \ --header 'Content-Type: application/json' \ --data ' { “method": ‘transaction’, “user_code": ‘000’, “game_type": ‘XXX’, “slot": { “provider_code": ‘XXX’, “game_code": ‘XXX’, “type": ‘BASE’, “used_credit": 10, “win_credit": 0, “txn_id": ”XXX” }
I have a question about how to work with returns. How do I check if the message is equal to SUCCESS so that I can send the second POST?
EDITED:
In your example you used URL as URL instead of the http address. Is this a variable that is not declared with the others?
Thanks for the explanations and the suggestion. I'll use variables to make it more handy.
The right thing to do would be to create an empty template, with just a few buttons and fields, so that I can check that everything is working. Then I'll post C3 here for you to take a look at and perhaps make some changes or improvements. Is that ok?
Just to see if I'm on the right track. I took this example from another post.
I'd have to include the data and then send the post as shown, right?
POST { “method": ‘game_launch’, “agent_code": ‘XXX’, “agent_token": ‘0123456789’, “user_code": ‘test’, “provider_code": ‘TEST’, “game_code": ‘XXXXXXXX’, // Optional - When it is empty, lobby url is returned. “lang": ”en” } //which will return a url already logged into the session RETURN { “status": 1, “msg": ‘SUCCESS’, “launch_url": ”http://” }
Then the server will return the information that I'm logged in, right? Do I use this information to open this URL or do I not need to do anything with it?
Thanks Igor, but it is greek for me :(
I will try to understand. Thank you anyway
Hi Igor. Thanks for answering
Here's a copy of the code I need to include in the game:
POST { “method": ‘game_launch’, “agent_code": ‘XXX’, “agent_token": ‘0123456789’, “user_code": ‘test’, “provider_code": ‘TEST’, “game_code": ‘XXXXXXXX’, // Optional - When it is empty, lobby url is returned. “lang": ”en” } //which will return a url already logged into the session RETURN { “status": 1, “msg": ‘SUCCESS’, “launch_url": ”http://” } //where it will play your system will take data and insert it via webhook on my site Collect balance data POST { “method": ‘money_info’, “agent_code": ‘XXX’, “agent_token": ‘0123456789’, } RETURN { “status": 1, “msg": ‘SUCCESS’, “agent": { “agent_code": ‘XXX’, “balance": 1000000, } } //To change the balance is POST { “method": ‘win’,#Lose “agent_code": ‘XXX’, “agent_token": ‘0123456789’, “user_code": ‘test’, “amount": 10000 } RETURN { “status": 1, “msg": ”SUCCESS” “agent_balance": 100000, “user_balance": 10000 }
Any good soul willing to give a quick lesson on this process of linking an api in the construct game, please?
Hi everyone.
I need to include an API code in the game I'm developing and I have no idea how to do it. Could someone be so kind as to give me some tips on this? I can share the code, which is quite small. Thanks in advance for any help.
Thanks
Develop games in your browser. Powerful, performant & highly capable.
Just one question: how do I remove the correct frame number when generating permutation. For example: I have 20 frames and the correct frame is the 5, how to make it not to be part of it?
So a possible solution would be for me to store the result of the first advancerandom in an array and then use it again for the buttons. Thanks.
You're right, advancerandom is much simpler, however, as I said, I'm already using it to display images of the exercises on the screen. Can't a conflict occur if I also use it for the buttons, since there is only one advancerandom object available?
Member since 29 Oct, 2012