MagneticCardReader - PC-Logix/OpenSecurity GitHub Wiki
Magnetic Card Reader
Reads Magnetic Cards when right clicked.
Methods
-- Sets the event name returned when you click it with a card, default is magData
setEventName(string eventName)
-- Enables/disables automatic lights on the magreader. If true, it will function as it normally does when clicked with a card. If false, you have to call setLightState to change the lights on the magreader. default is true.
swipeIndicator(boolean enableLights)
-- Sets the light state of the magreader. Takes in a number from 0 to 7. default is 0
setLightState(number lightState)
This block queues signals when it is clicked with a Magnetic Cards.
The event parameters are
eventName -- defaults to magData, can be changed
address -- address of the magnetic card reader
playerName -- name of the player that used the card
cardData -- data stored on the card
cardUniqueId -- unique card id
isCardLocked -- writelock state of card
side -- block side of card reader which the player used the card on
example script
event = require("event")
function myFunction(eventName, address, playerName, cardData, cardUniqueId, isCardLocked, side)
print("player " .. playerName .. " used card " .. cardUniqueId .. ", data: " .. cardData)
end
-- subscribe to the event "magData" with myFunction()
event.listen("magData", myFunction)
-- wait for an interrupt before closing the script (CTRL + C)
event.pull("interrupted")
-- unsubscribe from the event bus
event.ignore("magData", myFunction)