Multiple Rooms
Author |
Message |
azndragon
|
Posted: Thu Dec 26, 2002 9:19 pm Post subject: Multiple Rooms |
|
|
Okay, in my game, I am including different rooms, so you can move in between them. I am already aware of the include command, but I would just like to know if there are any other ones, and the advantages of using them, because I want to learn more about Turing. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
Posted: Thu Dec 26, 2002 10:03 pm Post subject: (No subject) |
|
|
it wouldn't seem right to hardcode every single room... also if you're using include to move between rooms, you might (most likely) run into shit since its a very bad way... once again you'd have to hardcode every room.
If you insist on doing so, I sujest making procedures for rooms instead, this way you will not get in trouble if you move a lot back and forth. Since include actualy includes the code, you will probably crash the system if code loops.
Best way I find is to make outside files for each room... such as .txt
then read from the file and load the variables... if there're some things to be changed and remembered, you can write back to the file.
I think Dan has a tutorial on reading/writing to files somewhere in tutorial section.
Edit: Its here - > http://danco.no-ip.com/turing/viewtopic.php?t=5 |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
azndragon
|
Posted: Thu Dec 26, 2002 10:51 pm Post subject: (No subject) |
|
|
I'm pretty sure I would have to hardcode every single room, because it's text based, and I have magic and skill to alter the environment of the room, such as destroying rocks, etc. This would make each room pretty long. I also kinda redid my game, and I'm only on the first room, which is already 400 lines, so I'm not sure if loading and writing variables would be a good idea. |
|
|
|
|
|
Tony
|
Posted: Fri Dec 27, 2002 1:35 am Post subject: (No subject) |
|
|
well I guess you can hardcode the rooms in... wouldn't be able to add more later though... and you'd have to rewrite similar code over and over and over... gonna be a BIG program...
I still think that loading couple of variables from file is a better way, but its up to you |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
azndragon
|
Posted: Fri Dec 27, 2002 5:04 pm Post subject: (No subject) |
|
|
Well, I'm trying out the procedure method, but the problem is, it seems to be impossible to move back and forth between two rooms, because since the procedures need to follow an order, it's only possible to move in one direction, because if you try to move in another, it says "room14 has not been declared" even though it's already set as a procedure, except it's below the original procedure. |
|
|
|
|
|
|
|