TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

comments?

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Feature Requests
View previous topic :: View next topic  
Author Message
pladdypants



Joined: 30 Nov 2014
Posts: 8

PostPosted: Tue Aug 18, 2015 9:01 pm    Post subject: comments? Reply with quote

Other than using #nop, could we get comments for code documentation? Maybe C style with /* and */? I'd settle for '#' as well but might be hard with the commands being prefixed with it.
Back to top
View user's profile Send private message
Slysven



Joined: 10 Apr 2011
Posts: 365
Location: As "Jomin al'Bara" in WoTMUD or Wiltshire, UK

PostPosted: Fri Aug 21, 2015 6:20 pm    Post subject: Reply with quote

I may be mistaken but I thought that was already present in the code...!
Back to top
View user's profile Send private message
LokiChaos



Joined: 27 Oct 2009
Posts: 61

PostPosted: Sun Aug 23, 2015 1:27 pm    Post subject: Reply with quote

You can use /* */ style comments outside of code blocks. However, inside a code block you cannot use them and #nop <comment>; is your only option.

Code:

/* Valid Comment */
#nop Also a Valid Comment;

#alias {foo} {

#nop This is a comment, and it works;
/* This is invalid and will do bad things */

};


My vim syntax file for tintin's language actually will highlight bad comment blocks to warn you.
Back to top
View user's profile Send private message
Slysven



Joined: 10 Apr 2011
Posts: 365
Location: As "Jomin al'Bara" in WoTMUD or Wiltshire, UK

PostPosted: Thu Aug 27, 2015 5:10 pm    Post subject: Reply with quote

And don't forget the end of command character ';' on all but the last line of a code block even for those #NOP lines...!
Back to top
View user's profile Send private message
pladdypants



Joined: 30 Nov 2014
Posts: 8

PostPosted: Mon Sep 14, 2015 8:44 pm    Post subject: Reply with quote

LokiChaos wrote:
You can use /* */ style comments outside of code blocks. However, inside a code block you cannot use them and #nop <comment>; is your only option.

Code:

/* Valid Comment */
#nop Also a Valid Comment;

#alias {foo} {

#nop This is a comment, and it works;
/* This is invalid and will do bad things */

};


My vim syntax file for tintin's language actually will highlight bad comment blocks to warn you.


Using the above style '/* */ breaks my session. I do a #read on a file with this in it:

Code:

/* set up functions to return string in color based on the value.  goal is to use these for */
/* status bars                                                                              */

#function colorize_pct {
  #if {%1 > 90} {#return <120>%1;};
  #if {%1 > 80} {#return <020>%1;};
  #if {%1 > 70} {#return <130>%1;};
  #if {%1 > 60} {#return <020>%1;};
}

#function colorize_bar {
  #var color_bar {||||||||||};
  #if {%1 > 75} {#return <120>$color_bar;};
  #if {%1 > 50 && %1 < 75} {#return <130>$color_bar;};
  #if {%1 < 50} {#return <110>$color_bar;};
}


I'm using tintin++ version 2.01.1

This is the output I get when i try to read the above fille:

read default/functions/colors.tin
There is no reason to '#function' here.
> There is no reason to '#function' here.
> #end
There is no reason to '#end' here.
Back to top
View user's profile Send private message
Slysven



Joined: 10 Apr 2011
Posts: 365
Location: As "Jomin al'Bara" in WoTMUD or Wiltshire, UK

PostPosted: Wed Sep 16, 2015 5:52 pm    Post subject: Reply with quote

I'm not sure you should have all the ';' you have there; you need them to separate commands within a '{'...'}' block so the last one in such a block does not (must not???) need them, does this work any better:
Code:
/* set up functions to return string in color based on the value.  goal is to use these for */
/* status bars                                                                              */

#function colorize_pct {
  #if {%1 > 90} {#return <120>%1} {};
  #if {%1 > 80} {#return <020>%1} {};
  #if {%1 > 70} {#return <130>%1} {};
  #if {%1 > 60} {#return <020>%1} {}
}

#function colorize_bar {
  #var color_bar {||||||||||};
  #if {%1 > 75} {#return <120>$color_bar} {};
  #if {%1 > 50 && %1 < 75} {#return <130>$color_bar} {};
  #if {%1 < 50} {#return <110>$color_bar} {}
}
Back to top
View user's profile Send private message
pladdypants



Joined: 30 Nov 2014
Posts: 8

PostPosted: Wed Sep 16, 2015 8:49 pm    Post subject: Reply with quote

Thanks for the advice but no luck. I even created a file with just a comment:

test.tin
/* test */

In my session i #read test.tin and output i get a bunch of output dumped to screen and I can't #end again.
Back to top
View user's profile Send private message
Slysven



Joined: 10 Apr 2011
Posts: 365
Location: As "Jomin al'Bara" in WoTMUD or Wiltshire, UK

PostPosted: Thu Sep 17, 2015 8:01 am    Post subject: Reply with quote

Any change with this:
Code:
/* set up functions to return string in color based on the value.  goal is to use these for */
/* status bars                                                                              */

#function colorize_pct {
  #if {%1 > 90} {#return {<120>%1}} {};
  #if {%1 > 80} {#return {<020>%1}} {};
  #if {%1 > 70} {#return {<130>%1}} {};
  #if {%1 > 60} {#return {<020>%1}} {}
}

#function colorize_bar {
  #var color_bar {||||||||||};
  #if {%1 > 75} {#return {<120>${color_bar}}} {};
  #if {%1 > 50 && %1 < 75} {#return {<130>${color_bar}}} {};
  #if {%1 < 50} {#return {<110>${color_bar}}} {}
}
If not I'll have to dust off a copy of the source and investigate further... Confused
Back to top
View user's profile Send private message
PowerGod



Joined: 04 Aug 2014
Posts: 339

PostPosted: Fri Sep 18, 2015 6:17 am    Post subject: Reply with quote

Maybe I'm wrong, but as far as I remember the FIRST character read from a script will be set as the control character, so you should start the file with a '#'
Code:
#nop take this character and shut up

/* other lines of comments */

etc...
Back to top
View user's profile Send private message
pladdypants



Joined: 30 Nov 2014
Posts: 8

PostPosted: Sun Sep 20, 2015 6:59 pm    Post subject: re: comments Reply with quote

PowerGod wrote:
Maybe I'm wrong, but as far as I remember the FIRST character read from a script will be set as the control character, so you should start the file with a '#'
Code:
#nop take this character and shut up

/* other lines of comments */

etc...


Good call. I put this as the test.tin instead:
Code:
#
/* this is a comment
 */
#


That trailing '#' is for symmetry and not part of anything Smile
Back to top
View user's profile Send private message
Slysven



Joined: 10 Apr 2011
Posts: 365
Location: As "Jomin al'Bara" in WoTMUD or Wiltshire, UK

PostPosted: Tue Sep 22, 2015 2:32 pm    Post subject: Reply with quote

PowerGod wrote:
Maybe I'm wrong, but as far as I remember the FIRST character read from a script will be set as the control character, so you should start the file with a '#'...
Oh, good catch Thumbs Up I'd forgotten that little gotcha/necessity (the very first thing the code that parses a file that is #READ must establish the character that indicates TinTin++ commands default is '#' and the #WRITE code is careful to write out the #CONFIG settings as the very first thing it outputs - though strangely NOT the #CONFIG {TINTIN CHAR} {#} which is the parameter concerned...!) If it didn't do that the only way to change it from a saved file would look something like this:
Code:
#CONFIG           {256 COLORS}  {ON}
#CONFIG           {AUTO TAB}  {5000}
#CONFIG           {BUFFER SIZE}  {20000}
#CONFIG           {CHARSET}  {ASCII}
#CONFIG           {COLOR PATCH}  {OFF}
#CONFIG           {COMMAND COLOR}  {<078>}
#CONFIG           {COMMAND ECHO}  {ON}
#CONFIG           {CONNECT RETRY}  {15}
#CONFIG           {HISTORY SIZE}  {1000}
#CONFIG           {LOG}  {RAW}
#CONFIG           {PACKET PATCH}  {0.00}
#CONFIG           {REPEAT CHAR}  {!}
#CONFIG           {REPEAT ENTER}  {OFF}
#CONFIG           {SCROLL LOCK}  {ON}
#CONFIG           {SPEEDWALK}  {OFF}
#CONFIG           {TINTIN CHAR}  {~}
~CONFIG           {VERBATIM}  {OFF}
~CONFIG           {VERBATIM CHAR}  {\}
~CONFIG           {VERBOSE}  {OFF}
~CONFIG           {WORDWRAP}  {ON}
~PATHDIR          {d}  {u}  {32}
~PATHDIR          {e}  {w}  {2}
~PATHDIR          {n}  {s}  {1}
~PATHDIR          {ne}  {sw}  {3}
~PATHDIR          {nw}  {se}  {9}
~PATHDIR          {s}  {n}  {4}
~PATHDIR          {se}  {nw}  {6}
~PATHDIR          {sw}  {ne}  {12}
~PATHDIR          {u}  {d}  {16}
~PATHDIR          {w}  {e}  {8}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Feature Requests All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group