Microstar301

CCTERMSERV/SERVER MATH

Dec 2nd, 2013
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.24 KB | None | 0 0
  1. a="+-----------------CALCULATOR----------------------+"
  2. local xa=a
  3. rednet.send(RAM,"CLEAR")
  4. rednet.send(RAM,a)
  5. a=" "
  6. rednet.send(RAM,a)
  7. a="+ or - * or / ?"
  8. rednet.send(RAM,"write")
  9. rednet.send(RAM,a)
  10. rednet.send(RAM,"INPUT")
  11. local it,ot=rednet.receive()
  12. if it==RAM then
  13.  if ot=="+" then
  14.   x=1
  15.  end
  16.  if ot=="-" then
  17.   x=2
  18.  end
  19.  if ot=="*" then
  20.   x=3
  21.  end
  22.  if ot=="/" then
  23.   x=4
  24.  end
  25. end
  26. rednet.send(RAM,"CLEAR")
  27. rednet.send(RAM,xa)
  28. rednet.send(RAM," ")
  29. rednet.send(RAM,"write")
  30. rednet.send(RAM,"First Number: ")
  31. rednet.send(RAM,"INPUT")
  32. local zt, tz=rednet.receive()
  33. if zt==RAM then
  34.  F=tz
  35. end
  36. rednet.send(RAM,"CLEAR")
  37. rednet.send(RAM,xa)
  38. rednet.send(RAM," ")
  39. rednet.send(RAM,"write")
  40. rednet.send(RAM,"Second Number: ")
  41. rednet.send(RAM,"INPUT")
  42. local zt, tz=rednet.receive()
  43. if zt==RAM then
  44.  S=tz
  45. end
  46. if x==1 then
  47.  E=F+S
  48. end
  49. if x==2 then
  50.  E=F-S
  51. end
  52. if x==3 then
  53.  E=F*S
  54. end
  55. if x==4 then
  56.  E=F/S
  57. end
  58. rednet.send(RAM,"CLEAR")
  59. rednet.send(RAM,xa)
  60. rednet.send(RAM," ")
  61. rednet.send(RAM,"write")
  62. rednet.send(RAM,"RESULT: ")
  63. rednet.send(RAM,E)
  64. rednet.send(RAM," ")
  65. rednet.send(RAM,"PULL")
  66.  
  67. local ui=0
  68. while ui==0 do
  69.  uu,ut=rednet.receive()
  70.  if uu==RAM then
  71.   if ut=="PULLED" then
  72.    ui=1
  73.   end
  74.  end
  75. end
Advertisement
Add Comment
Please, Sign In to add comment