I need to fill 'player' collection with bots. So I wrote an event script, which generates a set of players-bots. I run it from Test Harness.
Also I need to generate a specific display name for every bot. I used to apply ChangeUserDetailsRequest, and it worked fine if the real player was logging in.
But in case of 'programmatically' created bots, it doesn't work, because this request changes the display name of the currently signed in user, which is Test Harness user (the one I run GenerateBots() script from). So Test Harness user's name is changed every time new bot is created. Not bot's.
May I ask your advice how I can overcome this issue?
Best Answer
C
Customer Support
said
about 6 years ago
Hi Aleksey,
You can send requests as another player in cloud code provided you can access their playerId:
var req = new SparkRequests.AccountDetailsRequest();
var res = req.sendAs(anotherPlayerId);
Try this out and let us know how it works for you.
Aleksey Shishkin
Hi,
I need to fill 'player' collection with bots. So I wrote an event script, which generates a set of players-bots. I run it from Test Harness.
Also I need to generate a specific display name for every bot. I used to apply ChangeUserDetailsRequest, and it worked fine if the real player was logging in.
But in case of 'programmatically' created bots, it doesn't work, because this request changes the display name of the currently signed in user, which is Test Harness user (the one I run GenerateBots() script from). So Test Harness user's name is changed every time new bot is created. Not bot's.
May I ask your advice how I can overcome this issue?
Hi Aleksey,
You can send requests as another player in cloud code provided you can access their playerId:
var req = new SparkRequests.AccountDetailsRequest();
var res = req.sendAs(anotherPlayerId);
Try this out and let us know how it works for you.
Regards,
Vinnie
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstTech Support
Are you executing the ChangeUserDetailsRequest via SendAs function?
As long as you pass in the playerId, you can execute requests on their behalf.
Hope this helps,
Omar
Customer Support
Hi Aleksey,
You can send requests as another player in cloud code provided you can access their playerId:
var req = new SparkRequests.AccountDetailsRequest();
var res = req.sendAs(anotherPlayerId);
Try this out and let us know how it works for you.
Regards,
Vinnie
Aleksey Shishkin
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics