Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
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
  #2  
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
  #3  
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
  #4  
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
  #5  
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
  #6  
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
  #7  
Old 04-15-2007, 04:41 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
PHP Code:
function onKilled()
  {
  var;
  } 
I r bestest in Teh World!
The brackets really need to be on their own line ...

What do you people mean you only give brackets a new line for functions? How are functions any different in that structure than an if () or while (), or w/e?
__________________
Reply With Quote
  #8  
Old 04-15-2007, 04:42 AM
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
The brackets really need to be on their own line ...

What do you people mean you only give brackets a new line for functions? How are functions any different in that structure than an if () or while (), or w/e?
Example:

PHP Code:
function BLAH()
{  
// See? NEW LINE!
  
if (lawl == "xXx") {  // See? NO NEW LINE!
  
}

__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #9  
Old 04-15-2007, 11:06 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
PHP Code:
function blah()
{
  if (
this.condition)
  {
    if (
this.completelydifferentcondition)
      
blah2();
    else
      
blah3();
  }  

My general stylings. I normally have brackets around all conditions and events but when i'm finished and there is only one statement, I generally remove them.

Like

PHP Code:
function Dosomething()
  return 
this.something.index();

public function 
yay()
  return 
localfunction(); 
Reply With Quote
  #10  
Old 04-15-2007, 11:07 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 xXziroXx View Post
Example:

PHP Code:
function BLAH()
{  
// See? NEW LINE!
  
if (lawl == "xXx") {  // See? NO NEW LINE!
  
}

Eh. That sorta screams 'inconsistency'.
__________________
Skyld
Reply With Quote
  #11  
Old 04-15-2007, 04:42 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 Skyld View Post
Eh. That sorta screams 'inconsistency'.
It can scream whatever it wants, aslong as I like to script like that.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #12  
Old 04-15-2007, 02:21 PM
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
Example:

PHP Code:
function BLAH()
{  
// See? NEW LINE!
  
if (lawl == "xXx") {  // See? NO NEW LINE!
  
}

Any logic behind that? Seems a little hard to follow.

Twinny -- why don't you use brackets for one statement? They make it a lot cleaner, and neater, and if you need to adjust something it looks better.
PHP Code:
if ( foo )
{
  
doSomething();

__________________
Reply With Quote
  #13  
Old 04-13-2007, 03:56 PM
Sam Sam is offline
superannuated super mod
Sam's Avatar
Join Date: Sep 2004
Location: Dortmund, Deutschland
Posts: 5,357
Sam is a glorious beacon of lightSam is a glorious beacon of lightSam is a glorious beacon of light
Next time I see people power spamming a serious thread like this, I will spread also power infraction points for each spam post.

Quote:
3) SPAM

a) Posting of spam is not allowed. Spam is defined as any irrelevant or inappropriate message. Due to the nature of the forums, what is considered spam varies between threads. In other words: in some threads, small posts such as "..." are perfectly valid responses, whereas in other threads it is inappropriate. The context of the message is very important in this regard. It is the right and responsibility of the administrators or moderators to determine whether or not a message is spam and to take appropriate action if it is.

Last edited by Sam; 04-14-2007 at 09:25 PM.. Reason: to make it clear for people that likes to make any comment off topic
Reply With Quote
  #14  
Old 04-14-2007, 08:50 PM
Kristi Kristi is offline
Bowie's Deciple
Kristi's Avatar
Join Date: Dec 2003
Location: Boston, MA
Posts: 748
Kristi has a spectacular aura aboutKristi has a spectacular aura about
Send a message via AIM to Kristi Send a message via MSN to Kristi
I am reopening this for the sake of clean coding discussion. No spam tolerence here!
__________________
Reply With Quote
  #15  
Old 03-30-2007, 01:28 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
The only problem I have with adding spacing just for personal looks is the fact I hate adding all that width and having to scroll horizontally.
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 07:32 AM.


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