Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- the results of "select * from room;" are at zamnedix.chaosnet.org/results
- the entire codebase as of yet is at zamnedix.chaosnet.org/world.py
- I'm making a MUD in Python. I'm using PostgreSQL as my database and psycopg2 as my interface to the database.
- The function below looks around the room and shows the obvious exits. The problem is when you play the game,
- every room displays the north exit and no others, regardless of what exits there actually are.
- def Look(self,player):
- name = cur.execute("select name from room where room = "+str(player.room)+";")
- print str(cur.fetchone()[0])
- desc = cur.execute("select rdesc from ROOM where room = "+str(player.room)+";")
- print str(cur.fetchone()[0])
- exits = cur.execute("select n,ne,e,se,s,sw,w,nw,u,d from ROOM where room = "+str(player.room)+";")
- print "Obvious exits:"
- try:
- if str(cur.fetchone()[0]):
- print "North"
- if str(cur.fetchone()[1]):
- print "Northeast"
- if str(cur.fetchone()[2]):
- print "East"
- if str(cur.fetchone()[3]):
- print "Southeast"
- if str(cur.fetchone()[4]):
- print "South"
- if str(cur.fetchone()[5]):
- print "Southwest"
- if str(cur.fetchone()[6]):
- print "West"
- if str(cur.fetchone()[7]):
- print "Northwest"
- if str(cur.fetchone()[8]):
- print "Up"
- if str(cur.fetchone()[9]):
- print "Down"
- except:
- pass
- running the mud:
- -DEBUG MODE-
- Name:zamnedix
- Password:
- InitPlayer player id = 0
- InitPlayer player room = 0
- Shell player id = 0
- <99999 99999> l
- Starting room:
- Zamnedix's room
- 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.
- Obvious exits:
- North
- Going north:
- <99999 99999> n
- Shell Direction = n
- Walk Player ID 0
- Walk Player Room 0
- Walk Direction n
- Walk New Room 1
- Room to the north should have exit to the south back to the starter room.
- Zamnedix's Sculpture Room
- You are in another white sterile room, except this one is *full* of marble sculptures. Goblins, dragons, swords..Everything you can imagine.
- Obvious exits:
- North
- Going south anyway takes me back to the right room.
- <99999 99999> s
- Shell Direction = s
- Walk Player ID 0
- Walk Player Room 1
- Walk Direction s
- Walk New Room 0
- Zamnedix's room
- 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.
- Obvious exits:
- North
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement