Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.92 KB | None | 0 0
  1. the results of "select * from room;" are at zamnedix.chaosnet.org/results
  2. the entire codebase as of yet is at zamnedix.chaosnet.org/world.py
  3.  
  4. I'm making a MUD in Python. I'm using PostgreSQL as my database and psycopg2 as my interface to the database.
  5. The function below looks around the room and shows the obvious exits. The problem is when you play the game,
  6. every room displays the north exit and no others, regardless of what exits there actually are.
  7.  
  8. def Look(self,player):
  9. name = cur.execute("select name from room where room = "+str(player.room)+";")
  10. print str(cur.fetchone()[0])
  11. desc = cur.execute("select rdesc from ROOM where room = "+str(player.room)+";")
  12. print str(cur.fetchone()[0])
  13. exits = cur.execute("select n,ne,e,se,s,sw,w,nw,u,d from ROOM where room = "+str(player.room)+";")
  14. print "Obvious exits:"
  15. try:
  16. if str(cur.fetchone()[0]):
  17. print "North"
  18. if str(cur.fetchone()[1]):
  19. print "Northeast"
  20. if str(cur.fetchone()[2]):
  21. print "East"
  22. if str(cur.fetchone()[3]):
  23. print "Southeast"
  24. if str(cur.fetchone()[4]):
  25. print "South"
  26. if str(cur.fetchone()[5]):
  27. print "Southwest"
  28. if str(cur.fetchone()[6]):
  29. print "West"
  30. if str(cur.fetchone()[7]):
  31. print "Northwest"
  32. if str(cur.fetchone()[8]):
  33. print "Up"
  34. if str(cur.fetchone()[9]):
  35. print "Down"
  36. except:
  37. pass
  38.  
  39. running the mud:
  40.  
  41. -DEBUG MODE-
  42. Name:zamnedix
  43. Password:
  44. InitPlayer player id = 0
  45. InitPlayer player room = 0
  46. Shell player id = 0
  47. <99999 99999> l
  48.  
  49. Starting room:
  50. Zamnedix's room
  51. You are in a brightly lit, white sterile room with a transparent glass floor into white nothingness. There is a jet black square table in the center of the room with two equally black chairs on opposite sides. There are 10 portals by the walls of the room.
  52. Obvious exits:
  53. North
  54.  
  55. Going north:
  56.  
  57. <99999 99999> n
  58. Shell Direction = n
  59. Walk Player ID 0
  60. Walk Player Room 0
  61. Walk Direction n
  62. Walk New Room 1
  63.  
  64. Room to the north should have exit to the south back to the starter room.
  65.  
  66. Zamnedix's Sculpture Room
  67. You are in another white sterile room, except this one is *full* of marble sculptures. Goblins, dragons, swords..Everything you can imagine.
  68. Obvious exits:
  69. North
  70.  
  71. Going south anyway takes me back to the right room.
  72.  
  73. <99999 99999> s
  74. Shell Direction = s
  75. Walk Player ID 0
  76. Walk Player Room 1
  77. Walk Direction s
  78. Walk New Room 0
  79.  
  80. Zamnedix's room
  81. You are in a brightly lit, white sterile room with a transparent glass floor into white nothingness. There is a jet black square table in the center of the room with two equally black chairs on opposite sides. There are 10 portals by the walls of the room.
  82. Obvious exits:
  83. North
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement