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

Username:   Password: 
 RegisterRegister   
 Procedure help needed
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
cat8864




PostPosted: Sun Oct 05, 2008 5:54 pm   Post subject: Procedure help needed

I'm trying to make a chose your own adventure by using procedures for each scenario. Its set up so each scenario is linked to two other scenario procedures, the restart and end procedures (unless its one of the endings) - I can't map it since everything is dependent on each other.

My problem is that each time I try to run it I keep getting 'not declared' - is there anyway to get everything to run without having to create a file for each individual scenario then importing it into the file that starts everything?
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Sun Oct 05, 2008 6:16 pm   Post subject: RE:Procedure help needed

This is tricky. You have to organize your procedures so that if one relies on another, the one relied on it created first. This would mean putting your end procedures first. Turing is annoying like that.
The_Bean




PostPosted: Sun Oct 05, 2008 6:22 pm   Post subject: Re: Procedure help needed

Try looking up 'forward' in the Turing help files.

Turing:

forward procedure test
test
body procedure test
    put "test worked"
end test
gitoxa




PostPosted: Sun Oct 05, 2008 6:58 pm   Post subject: Re: RE:Procedure help needed

insectoid @ Sun Oct 05, 2008 6:16 pm wrote:
This is tricky. You have to organize your procedures so that if one relies on another, the one relied on it created first. This would mean putting your end procedures first. Turing is annoying like that.

How's that annoying, it's scope made easy.

Cat, my idea would be to call each of the three scenarios through a "main menu" as opposed to linking them all to each other.
Insectoid




PostPosted: Sun Oct 05, 2008 7:04 pm   Post subject: RE:Procedure help needed

That could work too.

It's annoying because it doesn't recognize that the procedure is called further down the program. Dunno if other procedural languages are like this, but whatever. I find it annoying.
btiffin




PostPosted: Sun Oct 05, 2008 7:17 pm   Post subject: RE:Procedure help needed

Old guy recommends; for further offtopic reading:

Inform7

http://www.inform-fiction.org/I7/Welcome.html

I7 is nice development system that accepts near english and produces interactive fiction games ala Zork and Adventure.

If you don't pick up any hints from some of the example source code, the concepts in the manual make for sound game designs.

Cheers
syntax_error




PostPosted: Mon Oct 06, 2008 12:36 am   Post subject: Re: Procedure help needed

do something long the lines of :

code:


proc gah
proc foo
proc bar
proc yougetthepoint
/* main menu */
loop

if x = a
gah

if x= b
foo


if x = c
bar

end loop



edit: tags...
S_Grimm




PostPosted: Mon Oct 06, 2008 8:36 am   Post subject: RE:Procedure help needed

syntax_error has it right. have a variable (ie "thisvariable"), have it equals 0 (var thisvariable := 0) then in your main loop, have if statements (if thisvariable = 1 then procedure a, if thisvariable = 2 then procedure b, etc..)
Sponsor
Sponsor
Sponsor
sponsor
cat8864




PostPosted: Mon Oct 06, 2008 9:13 am   Post subject: Re: Procedure help needed

Thanks for the tips - everythings running smoothly now (and decently organized!)
Insectoid




PostPosted: Mon Oct 06, 2008 11:54 am   Post subject: RE:Procedure help needed

hey, A/V, could you shrink your avatar a bit? I would PM you, but the '/' in 'A/V' screws up the board, meaning it won't let me!
S_Grimm




PostPosted: Tue Oct 07, 2008 10:15 am   Post subject: RE:Procedure help needed

oh, sorry. yeah, ill replace it with something smaller.
isaiahk9




PostPosted: Wed Oct 08, 2008 3:09 pm   Post subject: RE:Procedure help needed

I think the easiest way would be to have all seperate files, and then just in the main file click "Compress to executable" button on the top of the User Interface. Unless there's something that you want that this cannot offer, this seems the simplest and best. . .
gitoxa




PostPosted: Wed Oct 08, 2008 10:15 pm   Post subject: RE:Procedure help needed

I think we need a sage button on the forums.

That doesn't work, the program is compiled before it's run when you press the run button anyways.
Dan




PostPosted: Wed Oct 08, 2008 11:00 pm   Post subject: RE:Procedure help needed

The_Bean has the best awnser.

Look up and use forward. It is like prototyping in C.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
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  [ 14 Posts ]
Jump to:   


Style:  
Search: