Advertisement
EkielZan

display Mob

Nov 24th, 2014
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.24 KB | None | 0 0
  1. --- Computer ID = 4  - Turtle
  2. --# load the touchpoint API
  3. os.unloadAPI("touchpoint")
  4. os.loadAPI("touchpoint")
  5. local monSide = "back"
  6. local wlmSide = "left"
  7. -- Connecting Peripheral
  8. local wirelessModem = peripheral.wrap(wlmSide)
  9. local replyChannel = 1
  10. local listenChannel = 3
  11. local turtle = 4
  12. --Fill this table with the names of mobs
  13. local currMob = "NONE"
  14. --The ID of the turtle with the safari nets                            
  15. --The side your modem is on
  16.  
  17. local function setCurrMobMoni(currMob)
  18.   currMob=currMob
  19.   print (string.match(currMob,"Pech"))
  20.   print ("")
  21.   if  string.match(currMob,"Pech") == "Pech" then
  22.     currMob="Pech"
  23.   end
  24.   local t = touchpoint.new(monSide)
  25.   momo = peripheral.wrap(monSide)
  26.   mX = momo.getSize()
  27.   x =  math.floor(mX/2) - math.floor(string.len(currMob)/2)
  28.   sx=x
  29.   fx = sx + #currMob + 1
  30.   t:add(currMob, nil, sx, 2, fx, 4, colors.red, colors.red)
  31.   t:draw()
  32.   t=nil
  33. end
  34.  
  35. while true do
  36.   wirelessModem.open(listenChannel)--Open channel 3 so that we can listen on it
  37.   event, modemSide, senderChannel, replyChannel, mySerMes, senderDistance = os.pullEvent("modem_message")
  38.   myCopy=textutils.unserialize(mySerMes)
  39.   if myCopy.message == "curMob" then
  40.     setCurrMobMoni(myCopy.argument)
  41.   end
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement