Cabinet Game Events

Game Events

The Cabinet passes events over the WebSocket interface in the following format:

![k[event_type],v[var0,var1,var2...]]!

  • event_type The name of the event
  • var0,var1... Any number of variables can be passed of types int, float, string or bool. The amount of variables and types are determined by event_type. Note that any variable could be nil, noted by a an empty entry.

Player IDs

Many events call reference to a player position by an ID number. These numbers correspond to the following positions:

Position ID Position
1 Gold Queen
2 Blue Queen
3 Gold Stripes
4 Blue Stripes
5 Gold Abs
6 Blue Abs
7 Gold Skulls
8 Blue Skulls
9 Gold Chex
10 Blue Chex

Events

The full list of cabinet events, in alphabetical order. Use this table to determine the number and type of variables to expect:

Event Name Description Example variables var0 var1 var2 var3 var4
spawn A player has tapped in. Tip: Before version 17.26 and the introduction of the mapstart event, position 1's spawn event is the first event in every game v[8,True] int: Position ID bool: True if the position is a bot
mapstart The queens have both pressed the button, players are able to spawn inside the barriers v[map_day,True,0,False,17.14b]] string: The name of the map bool: If true, gold will be on the left side of the map instead of right int: The elapsed game time. This is always zero. bool: true if Attract Mode is enabled (this is always false as mapstart is not sent in attract games) string: The version number of the cab.
gamestart This event is sent when the hive barriers open (after the countdown), NOT when players begin tapping in (use spawn for that). v[map_day,True,0,False,17.14b]] v[map_dusk,False,0,False]] string: The name of the map bool: If true, gold will be on the left side of the map instead of right int: The elapsed game time. This is always zero. bool: true if Attract Mode is enabled (this is always false as gamestart is not sent in attract games) string: The version number of the cab. Note that this was added in version 17.14b and will not be sent in earlier versions
gameend The game has ended. Sent along with victory v[map_dusk,True,131.7972,False] string: The name of the map bool: Unknown, is usually true float: The length of the game in seconds bool: Unknown, is usually false.
victory The game has ended. Sent right after gameend v[Blue, Military] v[Gold, Economic] string: The winning team (Blue or Gold) string: The victory type (Military, Economic, or Snail)
snailEat A snail with a rider has begun eating a drone v[500, 11, 2, 7] int: Snail's X position int: Snail's Y position int: Riding drone's position ID int: Victim drone's position ID
snailEscape A drone being eaten has been freed (the rider was killed) v[500, 11, 7] int: Snail's X position int: Snail's Y position int: Escaped drone's position ID
getOffSnail A drone has ended riding the snail. Can occur from jumping off or death v[960, 11,, 9] v[500, 11, 2, 7] int: Snail's X position int: Snail's Y position int or nil: If killed, killer's position ID. Otherwise, empty value. int: Drone's position ID
getOnSnail A drone has begun riding the snail v[960, 11, 9] int: Snail's X position int: Snail's Y position int: Drone's position ID
berryDeposit A drone has put a berry in their hive. Before version 17.26, they were the drone location when it entered the hole, not the hole location. v[120, 940, 2] int: Hole's X position int: Hole's Y position int: Drone position ID
berryKickIn A berry has entered a hive by being pushed in. It was not carried in. Before version 17.26, they were the berry location when it entered the hole, not the hole location. v[120, 940, 1] int: Berry hole X position int: Berry hole Y position int: Kicker position ID bool True: iff berry counts for own team
carryFood A drone has picked up a berry and is now carrying it v[4] int: Drone's position ID
blessMaiden A queen has tagged a gate v[960,140,Blue] v[960,140,Red] int: Gate X coordinate int: Gate Y coordinate string: Team Color (Blue = Blue, Red = Gold)
reserveMaiden A drone has begun holding a berry above a gate and intends to use it. v[960,700,8] int: Gate's X position int: Gate's Y position int: Drone's position ID
unreserveMaiden A drone intending to use a gate has stopped, either from moving away or being killed. v[960,700,4,8] v[1580,140,,6] int: Gate's X position int: Gate's Y position int or nil: If the drone was killed, killer's position ID. Otherwise, empty value. int: Drone's position ID
useMaiden A drone has entered a gate and is now using it. v[1750,740,maiden_speed,6] v[170,740,maiden_wings,5] int: Gate's X position int: Gate's Y position string: Gate type, maiden_speed for a speed gate and maiden_wings for a warrior gate. int: Entering drone's position ID
glance Two players have collided in a non-lethal way v[91, 1015, 2, 9] int: X position of glance int: Y position of glance int: First player's position ID int: Second player's position ID
playerKill A warrior or queen has killed another player. v[938,548,9,2,Queen] v[1746,364,5,6,Worker] int: Killer's X position int: Killer's Y position int: Killer's position ID int: Killed player's position ID string: Killed player's category (Queen, Soldier, or Worker)
playernames Player names v[a,b,c,d,e,f,g,h,i,j] string: Ten strings are sent, corresponding to player positions in the order of player IDs. These are the cabinet's own naming system and not related to HiveMind's login system

Sample Code

Here is sample code that processes events: KQHivemind KQuity