Advertisement
Guest User

Gamebot.py -- Indentation error line 29

a guest
Oct 19th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.03 KB | None | 0 0
  1. import socket
  2. import random
  3. import time
  4. import re
  5. import string
  6. import traceback
  7.  
  8. server = ('irc.orderofthetilde.net', 6667)
  9. username = "gamebot"
  10. #+ str(random.randrange(1,69))
  11. hoppy = '#Battlearena'
  12.  
  13. s = socket.socket()
  14. s.connect(server)
  15. s.send('NICK '+ username + '\r\n')
  16. s.send('USER ' + username + ' . . :retard\r\n')
  17.  
  18. possible_monsters = ['Bee','BluePoring','Poring','Lost_Soul', 'orb_fountain','Wild_Rabbit','Jester', 'Ding_bats', 'Brauner', 'Tiamat']
  19.  
  20. readbuffer = ""
  21. monsters = []
  22.  
  23.  
  24.  
  25. while 1:
  26. readbuffer = s.recv(2048)
  27. lines = readbuffer.split('\n')
  28.  
  29. for line in lines:
  30. line = line.rstrip()
  31. print 'this is feed' + feed
  32. terms = feed.split()
  33. if not terms: continue
  34. print terms
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41. # put comamnds and checks after this comment. Everything above this is all that is needed.
  42. try:
  43.  
  44. if len(terms) >= 0 and terms[0] == 'PING':
  45. s.send('PONG '+terms[1]+'\r\n')
  46.  
  47. elif len(terms) >= 1 and '376' == terms[1]:
  48. s.send('JOIN ' + hoppy +'\r\n')
  49. s.send('PRIVMSG ' + hoppy + ' !id 54321' + '\r\n')
  50.  
  51. if len(terms) >= 3 and ':!test' == terms[3]:
  52. s.send('PRIVMSG ' + hoppy + ' test' + '\r\n')
  53. elif len(terms) > 4 and 'dimensional'== terms[4]:
  54. s.send('PRIVMSG ' + hoppy + ' !enter' + '\r\n')
  55.  
  56. elif len(terms) >= 3 and ':!printmonsters' == terms[3]:
  57. s.send('PRIVMSG ' + hoppy + ' the monsters are ' + str(monsters) + '\r\n')
  58. s.send('PRIVMSG ' + hoppy + ' hello ' + str(possible_monsters) + '\r\n')
  59. print 'the cmd is working'
  60. except:
  61. print traceback.print_exc()
  62. try:
  63. if len(terms) > 4 and 'order' == terms[4]:
  64.  
  65. for term in terms:
  66. if term in possible_monsters:
  67. monsters.append(term)
  68. print monsters
  69.  
  70.  
  71. if monsters >= 1:
  72. num = 0
  73. if monsters > 1:
  74. num = random.randint(0,len(monsters))
  75. if len(terms) > 4 and ':gamebot' == terms[3] and 'steps' == terms[4]:
  76. s.send('PRIVMSG ' + hoppy + ' !attack ' + str(monsters[num]) + '\r\n')
  77. if len(terms) > 5 and "gamebot" == terms[3] and terms[5]== 'another':
  78. s.send('PRIVMSG ' + hoppy + ' !attack ' + str(monsters[num]) + '\r\n')
  79. if len(terms) > 5 and "gamebot's" == terms[5]:
  80. s.send('PRIVMSG ' + hoppy + ' !attack ' + str(monsters[num]) + '\r\n')
  81.  
  82. if len(terms) > 5 and 'their' == terms[4] and 'victory' == terms[5]:
  83. del monsters[:]
  84. if len(terms) > 5 and 'their' == terms[4] and 'efforts' == terms[5]:
  85. del monsters[:]
  86. except:
  87. print traceback.print_exc()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement