
-----------------------------------
jedi-bob
Thu Jan 22, 2004 10:38 am

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.

-----------------------------------
Tony
Thu Jan 22, 2004 10:56 am


-----------------------------------
eh, sure... you could do that.

procedure animate
put "animating...
end animate

...
%this is your main program
%you can always call your procedure whenever you need it

animate


-----------------------------------
jedi-bob
Thu Jan 22, 2004 10:58 am


-----------------------------------
when i call my animation can it be a seperate file??

ex: procedure animation.t

-----------------------------------
Tony
Thu Jan 22, 2004 11:02 am


-----------------------------------
eh... no... what you do in your separate file is have it like

%this is file animation.t

procedure animation
put "animate"
end animation


now in your main file you place

include animation.t


at the very top of the program so that the procedure will be included.

Edit: go easy on my spelling, pff

-----------------------------------
jedi-bob
Thu Jan 22, 2004 11:17 am


-----------------------------------
thanks very much

-----------------------------------
jedi-bob
Thu Jan 22, 2004 2:59 pm


-----------------------------------
I keep getting an error in my main program saying:
 illegal include statement

-----------------------------------
santabruzer
Thu Jan 22, 2004 3:02 pm


-----------------------------------
watch tony's spelling.. 
*cough* include animation.t *cough*...

-----------------------------------
jedi-bob
Thu Jan 22, 2004 3:15 pm


-----------------------------------
i checked the spelling, but i get the same error.  Would you like to see the code?

-----------------------------------
sport
Thu Jan 22, 2004 3:18 pm


-----------------------------------
Sure, post the code

-----------------------------------
jedi-bob
Thu Jan 22, 2004 3:37 pm


-----------------------------------
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.

-----------------------------------
santabruzer
Thu Jan 22, 2004 3:41 pm


-----------------------------------
err.. you forgot the " " ".. the quotes basically.. it should be 
include "animation.t"

-----------------------------------
jedi-bob
Thu Jan 22, 2004 3:45 pm


-----------------------------------
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
Thu Jan 22, 2004 6:17 pm


-----------------------------------
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
Thu Jan 22, 2004 6:21 pm


-----------------------------------
why don't you make a module on your other file, and export the procedure

-----------------------------------
shorthair
Thu Jan 22, 2004 6:28 pm


-----------------------------------
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

-----------------------------------
Cervantes
Thu Jan 22, 2004 6:35 pm


-----------------------------------
interesting rank :P

i haven't ever had to use include or anything but I'll make a suggestion:
make sure your two turing files are in the same directory.

Cheers

-----------------------------------
vinkster
Thu Jan 22, 2004 10:04 pm


-----------------------------------
yeah got to love getting banned and then un-banned.....lol.............and on the first post too......

......yeah if you want a seperate file a module is the best thing to use.........

-----------------------------------
vinkster
Thu Jan 22, 2004 10:12 pm


-----------------------------------
sorry for the double post but im just a lamer i dont know better........ :roll: 

this might help ya out
modules
[code]module BOX
export largebox
procedure largebox
drawfillbox (10, 10, 60, 60, 7)
end largebox
end BOX
BOX.largebox
[/code]

-----------------------------------
Boarder16
Thu Jan 22, 2004 10:21 pm


-----------------------------------
i'd make a suggestion but i know nothign of this you talk about lol....i need 100 posts...!!!!! 8)
