The Dink Network

Maximum line length?

June 17th 2024, 05:25 PM
dinkdead.gif
Having spent ages debugging why on earth my global variable was not working, I moved the comment in main.c on the same line as the make_global_int() to the next line down.

Tada! It works.

But why? Is there a max line length I don't know about? The total length was 129 chars. It works just fine with a shorter comment, so it's not the fact that it's on the same line that's the problem.

FreeDink version Idontknowprobablyquiteold
June 17th 2024, 10:40 PM
pq_knight.gif
ExDeathEvn
Peasant He/Him New Zealand rumble
"Skinny Legend" 
A code snippet might help?
June 17th 2024, 11:19 PM
custom_simon.gif
SimonK
Peasant He/Him Australia
 
Comments on the same line of code have been known to make the code fail, I think I read that in the DinkC Ref somewheres... or maybe it was just a dream...
June 18th 2024, 01:21 AM
peasantmb.gif
yeoldetoast
Peasant They/Them Australia
LOOK UPON MY DEFORMED FACE! 
Perhaps it was both. This is an excerpt from BigTed's annotated Dinkc.txt:


*** BE CAREFUL WITH YOUR COMMENTS ***

Comment like this:

int &crap = 5;
//sets this to 5, duh

Not like this:

int &crap = 5; //sets this to 5, duh

This could cause a problem, some commands use 'does this char exist in this
string?' procedures. Don't do it. [I think he means his parser considers
a line at a time and searches the entire line for text. If so, why doesn't
it internally truncate the line at a "//"? That's what it's for!!
And anyway, Seth is not above violating this rule in his own code -- see
the entry for sp_nocontrol() in part 2.]



Having a brief look at the line parser suggests that a comment is only truly considered a comment if it's on its own line.
June 18th 2024, 03:42 AM
spike.gif
I'm sure there used to be a maximum character limit per line, even for comments. It wasn't much either, something around 200 if I had to try to remember.

However, it seems like whatever version of Freedink I'm using (probably the latest one, whatever that is it's years old at this point anyway) got rid of that limit. THIS SHIT never would have flown in v1.08 or earlier!

And yeah, comments after commands have never worked properly. I think it doesn't work more often than it does. Seth is a sadist, so he made it so that DinkC doesn't support it but still sometimes used it in his scripts.
June 19th 2024, 04:54 AM
goblins.gif
drone1400
Peasant He/Him Romania
C# nerd 
Looking around the DinkHD source code, it seems that line buffers are 200 characters max. See line 3702: https://github.com/drone1400/RTDink/blob/master/source/dink/dink.cpp

Although, further down there's another line buffer that's 512 characters, and then another one that's 300 characters, hah