procedures
Author |
Message |
Thuged_Out_G
|
Posted: Thu Dec 11, 2003 4:36 pm Post subject: procedures |
|
|
is it possible to add your own procedures to turing, so they are always declared and can be used in program by calling them?
for example, Draw.Line procedure is already made, you just have to call it....can i do this with one of the procedures i have made? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
AsianSensation
|
Posted: Thu Dec 11, 2003 4:48 pm Post subject: (No subject) |
|
|
sure, compile a list of whatever stuff you need, and then just include the file in the beginning of your program, acts like a header file.
If im not mistaken, then there are some useful functions already made that you can include here at compsci.
btw, to include, type it
|
|
|
|
|
![](images/spacer.gif) |
DanShadow
![](http://compsci.ca/v3/uploads/user_avatars/12142970654c996e83e6997.png)
|
Posted: Thu Dec 11, 2003 5:10 pm Post subject: .. |
|
|
I know what im about to do is kind of like helping him cheat...but it isnt really much to cheat for....so here it is. This code will be able to call upon a "draw_line" procedure as many times as needed, so its looped to prove that point. I hope this helps
code: |
var x, y, x2, y2 : int := 0
%Makes a procedure that clears the screen, and draws a line
procedure draw_line
Draw.FillBox (0, 0, maxx, maxy, 0)
Draw.Line (x, y, x2, y2, 255)
end draw_line
loop
%Asks user for (x,y) values of the line
locate (1, 1)
put "Enter the first x and y co-ordinates seperated by a space: "
get x
get y
put "Enter the second x and y co-ordinates seperated by a space: "
get x2
get y2
%Runs the draw_line procedure, and draws the line
draw_line
end loop
|
|
|
|
|
|
![](images/spacer.gif) |
Thuged_Out_G
|
Posted: Thu Dec 11, 2003 10:53 pm Post subject: (No subject) |
|
|
ok dan, i know how to make procedures and call them
what i was asking was:
i was wonering if it is possible tomake a procedure, and save it somewhere so i can call it in any program withhout declaring it...like the draw procedures already available in turing, you just have to call them....is it possible to make my own procedures, and add them to turing somehow? |
|
|
|
|
![](images/spacer.gif) |
AsianSensation
|
Posted: Thu Dec 11, 2003 11:16 pm Post subject: (No subject) |
|
|
yes, use
write a bunch of procedures, save it as some file, and then at the beginning of your new program, do this
that's the easiest way.
Other ways would be including changing Turing's system files and whatnot, and I think that's called software piracy ![Wink Wink](http://compsci.ca/v3/images/smiles/icon_wink.gif) |
|
|
|
|
![](images/spacer.gif) |
DanShadow
![](http://compsci.ca/v3/uploads/user_avatars/12142970654c996e83e6997.png)
|
Posted: Fri Dec 12, 2003 4:16 pm Post subject: (No subject) |
|
|
Ohhh...he wants to include procedures from file...make more specific questions, heh. Well yeah, use "include" to include procedures from disk. |
|
|
|
|
![](images/spacer.gif) |
|
|