Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #76  
Old 04-08-2007, 07:58 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
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
I, too, think that example A looks better then example B.

A: if (var == true) { .... }
B: if (var) { .... }
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #77  
Old 04-08-2007, 09:36 PM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
Quote:
Originally Posted by xXziroXx View Post
I, too, think that example A looks better then example B.

A: if (var == true) { .... }
B: if (var) { .... }
Thats how I had it on my script first, I forgot why I changed it
Reply With Quote
  #78  
Old 04-10-2007, 04:29 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by xXziroXx View Post
I, too, think that example A looks better then example B.

A: if (var == true) { .... }
B: if (var) { .... }
C:
PHP Code:
if ( var == true )
{
    ...

C seems better than both
__________________
Reply With Quote
  #79  
Old 04-10-2007, 01:23 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
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
Quote:
Originally Posted by cbkbud View Post
C:
PHP Code:
if ( var == true )
{
    ...

C seems better than both
No way! I only make new lines for brackets on functions. And I just dont like that way of spacing
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #80  
Old 04-10-2007, 04:07 PM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
Me either. The spaces inside the ( brackets offend me too

Heres how I do it:

PHP Code:
if (var) {
       ...

i guess if (var) has more meaning if you name your boolean variables as verbs as I tend to do e.g. if (finished)
__________________

Coming soon (Hopefully:P)
Reply With Quote
  #81  
Old 04-10-2007, 05:36 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
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
Quote:
Originally Posted by JkWhoSaysNi View Post
Me either. The spaces inside the ( brackets offend me too

Heres how I do it:

PHP Code:
if (var) {
       ...

i guess if (var) has more meaning if you name your boolean variables as verbs as I tend to do e.g. if (finished)
Same as me then, although I would do:

PHP Code:
if (var == true) {
       ...

__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #82  
Old 04-10-2007, 05:43 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
PHP Code:
if (var)
{
  
// ...

I don't see the point in putting var == true when that's already implied, and I prefer brackets on their own line. It improves spacing and clarity.
__________________
Skyld
Reply With Quote
  #83  
Old 04-10-2007, 06:21 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Skyld View Post
PHP Code:
if (var)
{
  
// ...

I don't see the point in putting var == true when that's already implied, and I prefer brackets on their own line. It improves spacing and clarity.
Lines++ ;/
Reply With Quote
  #84  
Old 04-10-2007, 06:27 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by Crow View Post
Lines++ ;/
Doesn't really matter. The script will be folded into the same amount of bytecodes with new lines as it is with brackets on the same lines.

The fact is that it's clearer when I'm editing the script.
__________________
Skyld
Reply With Quote
  #85  
Old 04-10-2007, 07:11 PM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
That's not a fact it's entirely subjective :P

I think less lines is clearer. I think it's easier to see which statement a block belongs to when the opening bracket is on the same line.
__________________

Coming soon (Hopefully:P)
Reply With Quote
  #86  
Old 04-10-2007, 08:02 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
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
Quote:
Originally Posted by JkWhoSaysNi View Post
That's not a fact it's entirely subjective :P

I think less lines is clearer. I think it's easier to see which statement a block belongs to when the opening bracket is on the same line.
Agreed.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #87  
Old 04-10-2007, 09:01 PM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
PHP Code:
function onKilled()
  {
  var;
  } 
I r bestest in Teh World!
Reply With Quote
  #88  
Old 04-11-2007, 12:09 AM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by JkWhoSaysNi View Post
That's not a fact it's entirely subjective :P
Quote:
Originally Posted by Skyld
The fact is that it's clearer when I'm editing the script.
I.
__________________
Skyld
Reply With Quote
  #89  
Old 04-11-2007, 12:51 AM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
Quote:
Originally Posted by Skyld View Post
I.
I.
Reply With Quote
  #90  
Old 04-11-2007, 01:05 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Novo View Post
I.
I.
--
Less lines? Really.

PHP Code:
//#CLIENTSIDE
function onCreated() { dothis(); thendothis(); thenletthis "foo"thendosomethingelse(); timetomilkthecow();doOTHERSTUFF()} function doOTHERSTUFF() { noWAI(); } function noWAI() { player.chat "MUAHAHAHAHAHAHAH!"; } 
Whoah you're right, that's really neat and clean!
__________________
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 10:42 PM.


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