Skip to content

Instantly share code, notes, and snippets.

@TheUltDev
Last active November 21, 2015 16:33
Show Gist options
  • Save TheUltDev/60ebe0c5028b0abcf0a0 to your computer and use it in GitHub Desktop.
Save TheUltDev/60ebe0c5028b0abcf0a0 to your computer and use it in GitHub Desktop.
local xenohub = IpcPublisherSocket.New('xenohub', 30100)
print('XenoHub listening on port 30100.')
-- Send blue flashing alarm to hue lights
--xenohub:PublishMessage('alarm', '0, 255,0')
Module.New('xenohub', function(mod)
-- Update player in XenoHub's player list
xenohub:PublishMessage('player', string.format('{"id": %d, "name": "%s", "level": %d, "vocation": "Druid", "script": "%s", "state": "%s", "exp": %d, "gold": %d}',
Self.ID(),
Self.Name(),
Self.Level(),
'-',
'-',
0,
0
));
-- Send location to XenoHub's map
local pos = Self.Position()
xenohub:PublishMessage('position', string.format('{"id": %d, "name": "%s", "x": %d, "y": %d, "z": %d}',
Self.ID(),
Self.Name(),
pos.x, pos.y, pos.z
));
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment