Computer Science Canada

Opening other turing files in the same window

Author:  Snicket [ Tue May 23, 2006 7:32 pm ]
Post subject:  Opening other turing files in the same window

I am trying to make a program to be a menu for a game but be seperate from the main code to make it less confusing. I know one way to do it but that opens up a whole new window. Any help welcome. Thanks

Author:  Anonymous [ Tue May 23, 2006 7:57 pm ]
Post subject:  Unit and Module

You can save other turing files (normally with the extension .tu) that have these lines of code:

code:

%file
unit
module (module name)
export (procedure name)
*code placed here with procedures*
end (module name)


Then you can import it in your main program, with this:

code:

import (module name) in "file.tu"
(module name).(procedure name)
[/i]

Hopefully that helps.

Author:  Anonymous [ Tue May 23, 2006 8:02 pm ]
Post subject: 

I'll attach this, a program using modules and import when I was first trying it to guideline you.

Author:  Snicket [ Tue May 23, 2006 8:10 pm ]
Post subject: 

Thanks, just trying to decipher the code. But I get the general idea.

Author:  Snicket [ Tue May 23, 2006 9:02 pm ]
Post subject: 

Finally got it to work. I had import and export written in my program a couple of times that threw me off. Thanks a lot.

Author:  Anonymous [ Wed May 24, 2006 12:05 am ]
Post subject: 

Yay I helped someone for once! =D Now I feel special!


: