Demont Posted November 18, 2008 Share Posted November 18, 2008 I have a M.U.D. I am working on. Brower and PHP based. One thing I am having major trouble with is devising a way to add rooms, so that players can move around within the game world. I don't have any code for it, only the database tables. I table is called rooms, and stored the rooms(name, description, room number, and North,south,east,west,up, and down directions.) The only code I have relevant to that table in the database is the movementimage script. <? include("connect.php"); include("userinfo.php"); $result = mysql_query("SELECT * FROM rooms WHERE room='$roomin'"); while($row = mysql_fetch_array($result)){ $north=$row['north']; $east=$row['east']; $south=$row['south']; $west=$row['west']; $up=$row['up']; $down=$row['down']; } Print "<table width='135' height='135' border='.5' bgColor='CC0000' align='center'>"; Print "<tr>"; Print "<td> </td>"; Print "<td>"; if($north==1){ Print "<a href='movement.php?d=north'><img src='/system/img/north-active.gif' border='0'></a>"; } else { Print "<img src='/system/img/north-inactive.gif' border='0'>"; } Print "</td>"; Print "<td>"; if($up==1){ Print "<a href='movement.php?d=up'><img src='/system/img/up-active.gif' border='0'></a>"; } else { Print "<img src='/system/img/up-inactive.gif' border='0'>"; } Print "</td>"; Print "</tr>"; Print "<tr>"; Print "<td>"; if($west==1){ Print "<a href='movement.php?d=west'><img src='/system/img/west-active.gif' border='0'></a>"; } else { Print "<img src='/system/img/west-inactive.gif' border='0'>"; } Print "</td>"; Print "<td> </td>"; Print "<td>"; if($east==1){ Print "<a href='movement.php?d=east'><img src='/system/img/east-active.gif' border='0'></a>"; } else { Print "<img src='/system/img/east-inactive.gif' border='0'>"; } Print "</td>"; Print "</tr>"; Print "<tr>"; Print "<td> </td>"; Print "<td>"; if($south==1){ Print "<a href='movement.php?d=south'><img src='/system/img/south-active.gif' border='0'></a>"; } else { Print "<img src='/system/img/south-inactive.gif' border='0'>"; } Print "</td>"; Print "<td>"; if($down==1){ Print "<a href='movement.php?d=down'><img src='/system/img/down-active.gif' border='0'></a>"; } else { Print "<img src='/system/img/down-inactive.gif' border='0'>"; } Print "</td>"; Print "</tr>"; Print "</table>"; ?> And this: <? include("connect.php"); require("sessions.php"); include("userinfo.php"); include("functions.php"); $movewhere=$_GET[d]; move($movewhere); die(header('Location: room.php')); ?> What I need is help in adding the rooms to the database, and having the columns update(which is easy), but so that say I add a room to the north of a room already in existence, I need the room in the south to know that "hey, a room to the north was added, better update!". For the rooms table, the north,south,east and etc directions are a 1 or 0 value, to determine if a user should be allowed to go north, south and such. I have another table called roomdirections, which hold the directions, such as: ------- room: North: South: East: West: Up: Down ------- 1 : 2 : 0: 0: 3: 4: 0 ------- Basic, like that. Room one is connected to room 2 though the North, no exit south, or east, and connects to room 3 to the west, and goes Up, to room 4, and no exit down. I hope this isn't too confusing, and would appreciate any help anyone could give me. Thank you. If you need clarification, just ask. Link to comment https://forums.phpfreaks.com/topic/133160-custom-mud-room-adding-scripthelp/ Share on other sites More sharing options...
Demont Posted November 18, 2008 Author Share Posted November 18, 2008 ? Link to comment https://forums.phpfreaks.com/topic/133160-custom-mud-room-adding-scripthelp/#findComment-692898 Share on other sites More sharing options...
Demont Posted November 19, 2008 Author Share Posted November 19, 2008 Bump Link to comment https://forums.phpfreaks.com/topic/133160-custom-mud-room-adding-scripthelp/#findComment-693395 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.