Skip to content
Michael Barrett edited this page Jan 26, 2017 · 6 revisions

Patchwire-GM API

Basics / Setup

net_init()

Initializes Patchwire-GM. Run this before any other script for networking.

net_connect(String ServerIP, Real ServerPort)

Connects to the given server/port. Upon a successful connection, a "connected" command is received.

net_cmd_resolve()

Run this function in your networking controller's Async - Networking event to enable networking.

Receiving Commands

net_cmd_add_handler(String CommandType, Script HandlerScript)

Adds a command handler to Patchwire-GM which will run when the given command type is received. The script is passed a ds_map of the incoming data.

NOTE: Your handler scripts do not need to clean up the data ds_map. Patchwire handles this for you.

Sending Commands

net_cmd_init(String CommandType)

Initializes a command to be sent to the server. Returns a ds_map which you can add more data to.

net_cmd_send([ds_map Command, Boolean PreventDestroy])

Sends the given command to the server. If no arguments are provided, sends the most recently created command. PreventDestroy can be set to true to prevent Patchwire from cleaning up the command map after sending it.

Internal functionality

NOTE: These are for internal use, and should probably never be used otherwise

net_handle_command()

net_cmd_parse()

Clone this wiki locally