Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Change to match the side or modem name for sensor.
- local sensorLoc = "right"
- --Change to match the side or modem name for monitor.
- local monitorLoc = "bottom"
- --Enter player names to check here. Only works when
- --player is online, and names are case-sensitive.
- local watchList = {"ringgeest11","Professor29"}
- --How long to show each inventory before moving on.
- local cycleDelay = 5
- --Used by the program, do not adjust.
- local snsr = peripheral.wrap(sensorLoc)
- local mon = peripheral.wrap(monitorLoc)
- local curSpot = 1
- local function displayInventory (vicName)
- vic = snsr.getPlayerData(vicName)
- for i,j in ipairs(vic["inventory"]) do
- if i < 10 then
- mon.setCursorPos(2,i+2)
- elseif i < 21 then
- mon.setCursorPos(1,i+2)
- else
- mon.setCursorPos(40,i-18)
- end
- local name = j["name"]
- print(name)
- mon.setTextColor(colors.yellow)
- mon.write(tostring(i)..": ")
- mon.setTextColor(colors.white)
- mon.write(name)
- end
- end
- while true do
- if snsr.getPlayerData(watchList[curSpot]) ~= nil then
- mon.clear()
- mon.setTextColor(colors.red)
- mon.setCursorPos(1,1)
- mon.write(watchList[curSpot])
- displayInventory(watchList[curSpot])
- os.sleep(cycleDelay)
- end
- curSpot = curSpot+1
- if curSpot > #watchList then
- curSpot = 1
- end
- os.sleep(0.125)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement