Server Recieve API
How to fetch the API
local API = LocationToElevatorModel.Cortex_API
How to check for a protocol event
API.Event:Connect(function(protocol, params)
-- If checks go in here
end)
On Elevator Call
if protocol == 'onElevatorCall' then
-- Code here
end
Returns
| Parameter | Value |
|---|---|
| params.floor | destination |
On Call Enter
if protocol == 'onCallEnter' then
-- Code here
end
Returns
| Parameter | Value |
|---|---|
| params | floor |
On Call Remove
if protocol == 'onCallRemove' then
-- Code here
end
Returns
| Parameter | Value |
|---|---|
| params | floor |
On Door Open
if protocol == 'onDoorOpen' then
-- Code here
end
Returns
| Parameter | Value |
|---|---|
| params.side | sideIndex |
On Door Reopen
if protocol == 'onDoorReopen' then
-- Code here
end
Returns
| Parameter | Value |
|---|---|
| params.side | sideIndex |
On Door Close
if protocol == 'onDoorClose' then
-- Code here
end
Returns
| Parameter | Value |
|---|---|
| params.side | sideIndex |
On Depart Start
if protocol == 'onDepartStart' then
-- Code here
end
Returns
| Parameter | Value |
|---|---|
| params.directionString | U / D |
| params.directionValue | 1 / -1 |
On Depart Pre Start Cancel
if protocol == 'onDepartPreStartCancel' then
-- Code here
end
On Elevator Move Begin
if protocol == 'onElevatorMoveBegin' then
-- Code here
end
Returns
| Parameter | Value |
|---|---|
| params.directionString | U / D |
| params.directionValue | 1 / -1 |
On Elevator Stop
if protocol == 'onElevatorStop' then
-- Code here
end
Returns
| Parameter | Value |
|---|---|
| params.floor | arriveFloor |
On Elevator Arrive
if protocol == 'onElevatorArrive' then
-- Code here
end
Returns
| Parameter | Value |
|---|---|
| params.floor | floor |
| params.direction | queueDirection U / N / D |
| params.parking | boolean |
On Leveling State Change
if protocol == 'onLevelingStageChange' then
-- Code here
end
Returns
| Parameter | Value |
|---|---|
| params.brakingMode | brakingMode |
| params.stage | levelingStage |
On Relevel Start
if protocol == 'onRelevelStart' then
-- Code here
end
Returns
| Parameter | Value |
|---|---|
| params.direction | direction |
On Safety Brake
if protocol == 'onSafetyBrake' then
-- Code here
end
On Elevator Lantern API
if protocol == 'onElevatorLanternApi' then
-- Code here
end
Returns
| Parameter | Value |
|---|---|
| params.state | active / neutral |
| params.floor | floor |
| params.direction | queueDirection |
| params.type | interior / exterior |
| params.eventData | lanternEventData |
| params.conditionMet | boolean |
Code Example
API.Event:Connect(function(protocol, params)
if protocol == 'onElevatorLanternApi' then
if params.floor ~= indicatorFloor then return end
if params.type ~= 'exterior' then return end -- Exterior lantern
if params.state == 'active' then
if params.conditionMet then
setArrowDirection(params.direction)
end
elseif params.state == 'neutral' then
setArrowDirection('N')
end
end
end)