Cloud Code

General cloud code discussions...

32 Topics 130 Posts
  • HTTP Client API - DELETE calls

    3
    0 Votes
    3 Posts
    347 Views

    Delete call update and everything is working now. Thanks!

  • bridge.include doesn't exists

    2
    0 Votes
    2 Posts
    389 Views

    Hey, there must be some syntax error in your script, would you be able to provide your script code here?

  • 0 Votes
    3 Posts
    436 Views

    @JasonL Thanks, I ended up with this cloudCode:

    isForceCreate = String(data.callingMessage.forceCreate) == "true"; isNewUser = String(data.message.newUser) == "true"; var response = {}; response.status = 200; response.data = data.message; if (isForceCreate && isNewUser) { var min = 10000000, max = 999999999 prefix = ["player", "user", "member"] const num = Math.floor(Math.random() * (max - min + 1)) + min; const pre = prefix[Math.floor(Math.random() * prefix.length)]; var defaultPlayerName = pre + String(num); var playerStateProxy = bridge.getPlayerStateServiceProxy(); // We are changing the player name on the server. playerStateProxy.updatePlayerName(defaultPlayerName); // And in this API Call's return data. response.data.playerName = pre + String(num); } response; //return the object

    This works just the way I need

  • Lobby creation/deletion events in CloudCode

    Unsolved
    13
    0 Votes
    13 Posts
    919 Views

    Hi Alessio,

    I have a suggestion.

    Why not create a global chat channel called "lobbyListeners".

    Then - when a user is viewing the lobbies - have them connect to and listen to the lobbyListeners channel.

    Then you don't need to maintain a global entity at all. Whenever you create a lobby or delete it - send an event to lobbyListeners - and it will automatically send it to everyone who has registered for the channel.

    Would that work? (or is there a part of your use case that I am missing?)

    Paul.

  • Cloud code retries, error handling question

    Unsolved
    2
    0 Votes
    2 Posts
    315 Views

    A good way to handle failure besides retrying in code, is to schedule another script to run 1 minute later that will basically repeat the same action.

  • 0 Votes
    5 Posts
    519 Views

    There is a global list of reason codes here - https://docs.braincloudservers.com/api/appendix/reasonCodes

  • This topic is deleted!

    Unsolved
    2
    0 Votes
    2 Posts
    5 Views
  • Filter online players in Matchmaking

    Solved
    8
    0 Votes
    8 Posts
    726 Views

    Ciao @Paul-Winterhalder ,

    yes there is not much else to add, except perhaps the fact that the CompleteMatch is sent at the end of the game. Instead, AbandonMatch is sent if one of the players abandons the game prematurely.

    Thanks for the support! 🙂

  • Webhook routes

    Solved
    12
    0 Votes
    12 Posts
    360 Views

    Cool. Thanks for sharing the solution here @devsleeper !

  • bridge.getCustomEntityServiceProxy()

    Unsolved
    5
    0 Votes
    5 Posts
    245 Views

    Hi @kinco-h - I assume (hope) you got the info you needed from our support folks?

    Hint - you access chat support by clicking on the "Ask Support" button in the top right-hand corner of the Design Portal...

    2024-12-04_09-07-57.png

  • "Player Location" custom session/matchmaking id

    Solved
    4
    0 Votes
    4 Posts
    92 Views

    Ah - perfect. Yeah - that sounds like a better option given the full requirements.

    Glad you found it... and welcome to brainCloud!

  • Recurring scheduled tasks?

    Unsolved
    6
    0 Votes
    6 Posts
    105 Views

    We agree with that @antony - we'll get that request to the devs.