Computer Science Canada [Tutorial]How to make your own commands, (like drawbox, etc) |
Author: | recneps [ Sun Feb 01, 2004 6:46 pm ] | ||||||||||||
Post subject: | [Tutorial]How to make your own commands, (like drawbox, etc) | ||||||||||||
Here is how you make your own commands, for use in Turing, like the built in ones, drawbox, drawline, etc. This can even be used for data processing, like calculate(supplyvariablehere) heres what you do: First, make a procedure:
Next, add parameters, they're the things that you put in brackets after the command, eg.
All the parameters are listed with their type after, separated by commas when being declared with the procedure. So, it now looks like this:
Next, put the stuff to do inside the procedure, and end it.
And lastly, call your procedure, with parameters, like you would drawline, etc..
If you are unable to cut and paste broken up code () then here is the full code i created.
Enjoy! |
Author: | Paul [ Sun Feb 01, 2004 6:49 pm ] |
Post subject: | |
Thats REALLY good! I haven't thought about it like that before, thanx, I'll be using this one. |
Author: | shorthair [ Sun Feb 01, 2004 6:49 pm ] |
Post subject: | |
Hate to break it to ya but thats not how you make your own commands , because if you do that , and then onpen a new program and try to call it , your gonna get an error , unless you include hat file at hte top in which it is located , you wanna make your ow ncommands , you use classes , its what turing is built on , sorry to sound harch but this is misleading , this is jsut a basic procedure and is not how drawbox or drawline is called at all , take a quick look in th ehelp file about classes |
Author: | recneps [ Sun Feb 01, 2004 6:51 pm ] |
Post subject: | |
OK, to clarify, Since im a newbie, as said by shorthair there, THIS MUST BE DECALRED AT TOP OF PROGRAM TO CALL IT. There |
Author: | Paul [ Sun Feb 01, 2004 6:58 pm ] |
Post subject: | |
I know it is a procedure, but I still found it useful. |
Author: | recneps [ Sun Feb 01, 2004 7:00 pm ] |
Post subject: | |
Just had to clear that up. |
Author: | shorthair [ Sun Feb 01, 2004 7:06 pm ] |
Post subject: | |
well to clear things up , programs are meant to be writtin like that , your main should be tiny , sorry to spam your thread with my stuff but , my blackjack ( 3000 ) lines had a 40 line main program , cuase everything was procedures , that way you can make multi app , and multi game programs , procuders make sode clean , you should b eusing them wher eever ya can , but to learn propper command making , take a look at classes |
Author: | Cervantes [ Sun Feb 01, 2004 7:52 pm ] |
Post subject: | |
spencer if you want to keep going along the lines you've started you should write tutorials for process and function don't kill me shorthair |
Author: | shorthair [ Sun Feb 01, 2004 7:59 pm ] |
Post subject: | |
nope not at all , i jsut found hte post misleading , adding those would be agood ideas, but i hate to flame again spencer , but adding in complex funstions and procedures would be good aswell , add in hte fact that vars inside them are no good outside hte procedures and functions and that processes are mostly useless, |
Author: | recneps [ Mon Feb 02, 2004 3:44 pm ] |
Post subject: | |
This is to show people an easier way than cut and paste if they are doing same thing over again, and just changing number |
Author: | Cervantes [ Mon Feb 02, 2004 6:12 pm ] |
Post subject: | |
its definately a good tutorial to post, just, as shorthair said, the name is slightly misleading |