Author |
Message |
jedi-bob
|
Posted: Thu Jan 22, 2004 10:38 am Post subject: Subprograms |
|
|
how do they work? Can i make an animation a subprogram, so that i don't need the 300+ animation lines in my main program?
PS- i checked the tutorials and there is nothing of that nature in there. Also i need help urgently am not currently in compsci class.
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
Posted: Thu Jan 22, 2004 10:56 am Post subject: (No subject) |
|
|
eh, sure... you could do that.
code: |
procedure animate
put "animating...
end animate
...
%this is your main program
%you can always call your procedure whenever you need it
animate
|
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
jedi-bob
|
Posted: Thu Jan 22, 2004 10:58 am Post subject: (No subject) |
|
|
when i call my animation can it be a seperate file??
ex: procedure animation.t
|
|
|
|
|
|
Tony
|
Posted: Thu Jan 22, 2004 11:02 am Post subject: (No subject) |
|
|
eh... no... what you do in your separate file is have it like
code: |
%this is file animation.t
procedure animation
put "animate"
end animation
|
now in your main file you place
code: |
include animation.t
|
at the very top of the program so that the procedure will be included.
Edit: go easy on my spelling, pff
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
jedi-bob
|
Posted: Thu Jan 22, 2004 11:17 am Post subject: (No subject) |
|
|
thanks very much
|
|
|
|
|
|
jedi-bob
|
Posted: Thu Jan 22, 2004 2:59 pm Post subject: (No subject) |
|
|
I keep getting an error in my main program saying:
illegal include statement
|
|
|
|
|
|
santabruzer
|
Posted: Thu Jan 22, 2004 3:02 pm Post subject: (No subject) |
|
|
watch tony's spelling..
*cough* include animation.t *cough*...
|
|
|
|
|
|
jedi-bob
|
Posted: Thu Jan 22, 2004 3:15 pm Post subject: (No subject) |
|
|
i checked the spelling, but i get the same error. Would you like to see the code?
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
sport
|
Posted: Thu Jan 22, 2004 3:18 pm Post subject: (No subject) |
|
|
Sure, post the code
|
|
|
|
|
|
jedi-bob
|
Posted: Thu Jan 22, 2004 3:37 pm Post subject: (No subject) |
|
|
its pretty long, and i don't know how to get it in the neat box like other people do so i just attached it.
Description: |
|
Download |
Filename: |
level-test.t |
Filesize: |
1.88 KB |
Downloaded: |
322 Time(s) |
Description: |
|
Download |
Filename: |
animation.t |
Filesize: |
8.97 KB |
Downloaded: |
326 Time(s) |
|
|
|
|
|
|
santabruzer
|
Posted: Thu Jan 22, 2004 3:41 pm Post subject: (No subject) |
|
|
err.. you forgot the " " ".. the quotes basically.. it should be
code: | include "animation.t" |
|
|
|
|
|
|
jedi-bob
|
Posted: Thu Jan 22, 2004 3:45 pm Post subject: (No subject) |
|
|
i put them in but when i try run it, the code of animation.t opens and procedure is highlighted and it says, "procedures may only be declared at the program, module, or monitor level"
|
|
|
|
|
|
vinkster
|
Posted: Thu Jan 22, 2004 6:17 pm Post subject: (No subject) |
|
|
procedures cannot be called from a different file, you can either call it in the animation.t or not use that file and copy and paste that code to the top of your other file..........
|
|
|
|
|
|
santabruzer
|
Posted: Thu Jan 22, 2004 6:21 pm Post subject: (No subject) |
|
|
why don't you make a module on your other file, and export the procedure
|
|
|
|
|
|
shorthair
|
Posted: Thu Jan 22, 2004 6:28 pm Post subject: (No subject) |
|
|
WOW the lamer has somethig good to say , now isnt that a change , i thin kan apologie to compsci is in order , and mabye Dan might me nice enough to take your lamer away , well mabye you will have to keep up the good behaviour
|
|
|
|
|
|
|