Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Multiple Rooms
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
azndragon




PostPosted: 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
Sponsor
sponsor
Tony




PostPosted: 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. Confused

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
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
azndragon




PostPosted: 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




PostPosted: 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
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
azndragon




PostPosted: 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.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: