Graal Forums  

Go Back   Graal Forums > Graal V6 forums > Bug Report
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 03-15-2009, 12:29 AM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
closing block comments...or not?

Had a weird problem with the serverside portion of a class not working, but the clientside portion worked fine:

After 20 minutes of trying to figure out why the hell my code was freaking out, I found that the problem was commented out information about functions contained in the script:
PHP Code:
/*
//INFO */ 
When writing code, it appears as if the block comment is closed, but when compiled the */ is actually being commented out by the "//"

PHP Code:
/*
//TEST */
function onActionServerSidecmd ) {
  if ( 
cmd == "Test" ) {
    echo(
"Complete");
  }
}
//#CLIENTSIDE
function onMouseDown() {
  
player.chat "Kewl";
  
triggerserver("weapon"this.name"Test"NULL );

Serverside portion would not work with the comments at the top, but the clientside portion would.
Reply With Quote
  #2  
Old 03-15-2009, 05:30 AM
Frankie Frankie is offline
xChugxLifex
Frankie's Avatar
Join Date: Feb 2008
Location: New York
Posts: 1,610
Frankie is a jewel in the roughFrankie is a jewel in the rough
Send a message via AIM to Frankie Send a message via MSN to Frankie
doesn't seem like a bug to me. just a bad use of comment codes. there's no reason why you should use the /* */ if you're just going to use // vice versa.
__________________
*Sum41Freeeeek
*Frankie
Reply With Quote
  #3  
Old 03-15-2009, 06:39 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Anything after // will be comments, so you can't use */ after a // on the same line. Serverside is read separately from clientside, so if you did a /* at the top of a script, it would only comment out until it reaches //#CLIENTSIDE.

If you wanted to comment out a whole script you would have to put a /* at the top and a /* right under //#CLIENTSIDE.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #4  
Old 03-15-2009, 06:42 AM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
Quote:
Originally Posted by Frankie View Post
doesn't seem like a bug to me. just a bad use of comment codes. there's no reason why you should use the /* */ if you're just going to use // vice versa.
I just happened to close a commented line within the block comment when I added more information about the enclosed functions.

The script window telling you that the block comment is closed, but the compiler seeing it otherwise is a bug. And the fact that it only knocked out the serverside portion of the code is even worse...had nothing worked, I could have easily determined that the code was commented out, but that wasn't the case.

Quote:
Originally Posted by Tigairius View Post
Anything after // will be comments, so you can't use */ after a // on the same line. Serverside is read separately from clientside, so if you did a /* at the top of a script, it would only comment out until it reaches //#CLIENTSIDE.

If you wanted to comment out a whole script you would have to put a /* at the top and a /* right under //#CLIENTSIDE.
Really?
If I placed /* at the top of a script, everything appears to be commented out in the script window (serverside AND clientside)...but I haven't tested if the clientside portion still works.

I know that // comments out the entire line, but it doesn't change the fact that the block comment appeared to be closed but in fact wasn't
Reply With Quote
  #5  
Old 03-15-2009, 07:11 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by salesman View Post
Really?
If I placed /* at the top of a script, everything appears to be commented out in the script window (serverside AND clientside)...but I haven't tested if the clientside portion still works.

I know that // comments out the entire line, but it doesn't change the fact that the block comment appeared to be closed but in fact wasn't
Yes, in the script window the syntax highlighting will show that the whole script is commented out, but that's because it's just syntax highlighting. It doesn't really have anything to do with the script itself.

As a good rule of thumb I usually start a line like
HTML Code:
/*
  Comments here.
*/
So each one gets their own line.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #6  
Old 03-15-2009, 04:23 PM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
Quote:
Originally Posted by Tigairius View Post
Yes, in the script window the syntax highlighting will show that the whole script is commented out, but that's because it's just syntax highlighting. It doesn't really have anything to do with the script itself.

As a good rule of thumb I usually start a line like
HTML Code:
/*
  Comments here.
*/
So each one gets their own line.
Yea, it was just carelessness/bad luck on my part that the closing */ ended up on the same line as a previous // comment...at least now someone who has read this can watch out and not make the same mistake of trusting the script window.

EDIT: I thought everything within a block comment was ignored when compiled (isn't that the purpose of comments??)...why would one line comments within the block comment not be ignored?
Reply With Quote
  #7  
Old 03-15-2009, 04:26 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by salesman View Post
EDIT: I thought everything within a block comment was ignored when compiled (isn't that the purpose of comments??)...why would one line comments within the block comment not be ignored?
Stefan probably have the engine checking first for //, and secondly /* */, which breaks the latter when the sooner is used within it.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #8  
Old 03-15-2009, 04:35 PM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
Quote:
Originally Posted by xXziroXx View Post
Stefan probably have the engine checking first for //, and secondly /* */, which breaks the latter when the sooner is used within it.
Figured as much...I just wish it was consistent between script window and compiling.
Reply With Quote
  #9  
Old 03-22-2009, 12:46 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Single-line comments can be used to comment out the end of multi-line comments, for GS1 compatibility. Most other languages don't allow that and the script highlighter is simplier in that regard so it's not supporting it.
The server should display a warning if multi-line comments are not closed, if it's not doing that yet then we can add it.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:04 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.