Rocket Networking Docs🚀
  • About this Documentation
  • Basics of Rocket Networking
    • Room based multiplayer (Auto State Sharing)
      • Clients and clientId
      • Entities
      • Smart Entities
    • Single Message Sharing
    • Persistent Objects on the Server
    • Easy Matchmaking
    • Discord Server Integration
    • Database for your Account
    • Server Side Scripting
    • Global Multiplayer(Cross play)
  • Rocket Networking Code
    • Connecting and Disconnecting
      • ConnectToServer()
      • callback_ConnectToServer()
      • DisconnectFromServer()
      • callback_DisconnectFromServer()
    • Rooms
      • ChangeRoom( new_room_name )
      • callback_ChangeRoom()
      • LeaveRoom()
      • callback_LeaveRoom()
      • ShowAllClientsInRoom(room_name ) and callback_ShowAllClientsInRoom()
      • ShowAllRooms() and callback_ShowAllRooms()
    • Private Messaging
      • SendEventToClient
      • callback_ReceivedEvent
      • SendMessageToClient
      • callback_ReceivedMessage
    • Persistent Objects
      • CreatePersistentObject(roomId , persistentObjectStruct)
      • callback_CreatedPersistentObject()
      • EditPersistentObject(persistentObjectId , new_persistentObjectStruct)
      • DestroyPersistentObject(persistentObjectId)
      • ShowPersistentObjectsInRoom(room_name)
      • callback_ShowAllPersistentObjectsInRoom(array_of_persistent_objects)
    • Database Functions
      • SetSimpleData()
      • callback_SetSimpleData()
      • ReadSimpleData()
      • callback_ReadSimpleData()
      • AddToSimpleData()
      • callback_AddToSimpleData()
      • DeleteSimpleData()
    • Discord Integration
      • SendDiscordMessage()
      • callback_DiscordMessageReceived()
    • AI Functions
      • CallSimpleAI
      • callback_CallSimpleAI
      • CallGeneralAI
      • callback_CallGeneralAI
  • KickPlayer(client_id)
  • ViewServerActivity()
    • callback_ViewServerActivity()
  • oBrain - ping and pseudoHost
  • Admin Callbacks
  • API
    • Database
    • AI
  • Server Side Scripting
    • Basics
    • Understand the heirarchy on the server
    • Create a Persistent Object from Server
    • Important Scripts
      • "step" Script format
      • "client_sent_event" Script format
      • "game_server_created" Script format
    • Send Event to a Client from Server
    • Database Functions on Server
    • AI Functions on the Server
Powered by GitBook
On this page
  • No code Example
  • Direct code example
  1. Server Side Scripting
  2. Important Scripts

"step" Script format

PreviousImportant ScriptsNext"client_sent_event" Script format

Last updated 1 year ago

Add this code to your step script to get started. This is how you can scout your RNet server for anything you want.

No code Example

You can use the no code tool to see how easy it is.

Direct code example

//const game is the game instance!!
for (let roomId in game.rooms) {
    const room = game.rooms[roomId];



    // Room-specific code here

    // Client iteration
    for (let clientId in room.clients) {
        const client = room.clients[clientId];

        // Client-specific code here

        //
        for (let entityId in client.entities) {
            try {
                var EP = JSON.parse(client.entities[entityId])

                // Entities-specific code here

            } catch (e) {
                console.log(e)
            }

        }

        //Persistent Object iteration
        for (let persistentObjectId in room.persistentObjects) {
            const persistentObject = room.persistentObjects[persistentObjectId]
            //Persistent Objects specific code here

        }
    }
}