forums

TNT Basic Forums > Feedback
How to organize code
< Last Thread     Next Thread >
Author
Thread        Post A Reply

04-29-2003 20:21

Posted by:
matteo

Location:
Venice, ITALY!

Click Here to Email matteo   Find more posts by matteo

Ok, I have this 3000 lines game, with a load of procedures.
I don' t like it much to scroll up and down as a mad searching a procedure in a 100 pages code, I loose time and I never find them.

So I have to use the find function, but then, I never remember what is their name.
So I have to think out a word that might be in the procedure name, but that word is also in 5 other variables used 30 times each in the code.
So I end up with a find search with 150 finds, and I' m lucky yo have that great "find all" thingie or I would never get it.

So the point of this story is: I need a way to organize the code. Let' s before anything say that I' m only a novice coder and have used only TNT. But opening project builder I saw you can bookmark stuff and procedures. I think this is a good way to organize code. I don' t know, there might be other ways.
But I' d like a window (of course closeable and optional) wher you can list your procedures (or bookmark other things) and organize them maybe into folders, so when you click on a bookmark you are placed in the right place of the code.

I think this would be VERY helpfull.

In the meanwhile, if somebody knows a way of easily zoom through the code and get to the procedure you want easily please tell me, cause I didn' t find it.

Thanks

Mattttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttteo

04-29-2003 20:29

Posted by:
Wil Hostman

Find more posts by Wil Hostman

Prototypes

A technique that is used in C/C++ for code organization is the "Function Prototype" (Actually, it has other purposes, but I use them even when I don't need them in C/C++ simply to keep track of functions available.)

since we don't have header files, nor are they supported in TNTB, here's a similar approach.

Each time you add a procedure, copy the definition, then go to the top of the program and start a line comment, then paste the proceedure definition in that comment.

example:
'proceedure foo(int fooin)
'proceedure foo2(int fooin)
'proceedure foo3(int fooin, string foostring)

proceedure foo(int fooin)

end proc
proceedure foo2(int fooin)
proceedure foo3(int fooin, string foostring)

04-29-2003 21:34

Posted by:
Mark Tully

Location:
TNT HQ, England

Click Here to Email Mark Tully   Find more posts by Mark Tully

Procedure Popup

Have you tried the procedure popup menu at the bottom left of the code editing window. It's the one with the 'P' on it?

Cheers,

Mark

04-29-2003 22:24

Posted by:
matteo

Location:
Venice, ITALY!

Click Here to Email matteo   Find more posts by matteo

Oh, my...

I can' t beleave it... the popup thingie... it was there, hidden... Was that written somewhere in the documentation? Oh, my, I guess I should ask questions more often ;-P
But how could I guess that that little blue P was something??

Otherwise your idea, Wil, is very good!

Thanks mark :-)

04-30-2003 10:14

Posted by:
matteo

Location:
Venice, ITALY!

Click Here to Email matteo   Find more posts by matteo

ATTENTION: POLL TO ANSWER: DID YO KNOW OF THE PROCEDURES POPUP MENU?

Ok, ok, I' m not letting you go with this and we' ll have a poll here ;-)
Everybody that reads this thread please reply:

DID YOU KNOW THAT THERE WAS THIS LITTLE BLUE "P" IN THE LOWER LEFT PART OF THE "CODE" SECTION WHERE YOU SEE THE LIST OF PROCEDURES?


Ok, I' ll start: Not at all!

04-30-2003 14:34

Posted by:
puffin

Click Here to Email puffin   Find more posts by puffin

nope.

04-30-2003 14:41

Posted by:
Machi

Click Here to Email Machi   Find more posts by Machi

Of course, and I'm not 100% sure Matteo, but I think that I even mentioned it to you in one of the emails where we were talking about the value of procedures. (But I'll have to check, I may not have mentioned it explicitly.)

04-30-2003 14:49

Posted by:
Machi

Click Here to Email Machi   Find more posts by Machi

... and I take it that you DO know about entering a line number to go directly to it ?

:-)

04-30-2003 14:58

Posted by:
matteo

Location:
Venice, ITALY!

Click Here to Email matteo   Find more posts by matteo

the goto line stuff

yep I know that, I discovered it yesterday ;-P

Well, actually that never would have been much usefull... but the procedure menu... Oh my, hours of futile code searching... :-(
However I sill would like (well, it' s more a way of complaining...) to organize them in folders... would it help? Probably not much ;-)

04-30-2003 21:08

Posted by:
Wil Hostman

Find more posts by Wil Hostman

Sho'nuff!

Actually, I was aware of the function popup. The pseudo-prototypes, however, also show me variable types. And, once functions become part of the lexicon, they'll be prototyped there too.

-wil

04-30-2003 21:24

Posted by:
matteo

Location:
Venice, ITALY!

Click Here to Email matteo   Find more posts by matteo

I rarely use procedures that need input and return output (though I have some)

05-01-2003 00:44

Posted by:
CubeFusion

Location:
California, USA

Find more posts by CubeFusion

"DID YOU KNOW THAT THERE WAS THIS LITTLE BLUE "P" IN THE LOWER LEFT PART OF THE "CODE" SECTION WHERE YOU SEE THE LIST OF PROCEDURES?"

I had no clue this feature even existed. But now that I know it is there, I am a very happy man.

05-02-2003 10:55

Posted by:
mark_667

Location:
England

Click Here to Email mark_667   Find more posts by mark_667

WOW! It's no wonder only the likes of Danlab actually publish! Even I knew about it! ;) Not quite sure what function Wil's suggesting with the variables though.

05-02-2003 23:19

Posted by:
eekaydee

Location:
CA, USA

Click Here to Email eekaydee   Find more posts by eekaydee

I noticed the p thing when I first got TNT, looked kinda like something to click...don't think it's in the documentation though

05-02-2003 23:49

Posted by:
Mark Tully

Location:
TNT HQ, England

Click Here to Email Mark Tully   Find more posts by Mark Tully

I knew about it ;)

I've checked the docs, it is mentioned, but it's not very clear. The docs just say "There's a procedures popup" but doesn't actually point out where it is... Doh...

See http://www.tntbasic.com/learn/user_guide/3.2.html.

Also, while we're on the topic of editing tips, one of my favourite ones is to select a variable or procedure call with a double click, then hit cmd-j repeatedly to jump to all the places in the code where you use it. Much quicker than opening the find window. If you need the features of the find window, try using cmd-e to enter the selected text into the find box.

Cheers,

Mark

05-14-2003 11:03

Posted by:
mark_667

Location:
England

Click Here to Email mark_667   Find more posts by mark_667

Have you thought of putting a page in the help files dedicated to useful shortcuts like the ones mentioned above? I've been using TNT for a little while now, and I didn't know the cmd-J and cmd-E shortcuts existed!

05-14-2003 14:24

Posted by:
MapMaker

Location:
Edmonton, Alberta (Canada)

Click Here to Email MapMaker   Find more posts by MapMaker

Yes

I found it the firt time I used Heiroglyph ;)

05-14-2003 20:13

Posted by:
Mark Tully

Location:
TNT HQ, England

Click Here to Email Mark Tully   Find more posts by Mark Tully

Shortcuts

Well, there's not that many that aren't listed in the menus. It's worth reading through them all.

A couple you might not know about

cmd-? look up command in the help file
cmd-opt-up/down go to next previous error/search result

If people post their favourite shortcuts I can compile a page in the help.

Cheers

Mark

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.