Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Clean Coding - Common Sense (https://forums.graalonline.com/forums/showthread.php?t=73158)

Kristi 04-13-2007 03:36 PM

Quote:

Originally Posted by Twinny (Post 1299409)
I. (Question how long this thread will survive :whatever:)

I (decided it will go on no longer)

Sam 04-13-2007 03:56 PM

Next time I see people power spamming a serious thread like this, I will spread also power infraction points for each spam post. x_x

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.


Kristi 04-14-2007 08:50 PM

I am reopening this for the sake of clean coding discussion. No spam tolerence here!

cbk1994 04-15-2007 04:41 AM

Quote:

Originally Posted by Novo (Post 1298799)
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?

xXziroXx 04-15-2007 04:42 AM

Quote:

Originally Posted by cbkbud (Post 1300082)
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!
  
}



Twinny 04-15-2007 11:06 AM

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(); 


Skyld 04-15-2007 11:07 AM

Quote:

Originally Posted by xXziroXx (Post 1300085)
Example:

PHP Code:

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



Eh. That sorta screams 'inconsistency'.

cbk1994 04-15-2007 02:21 PM

Quote:

Originally Posted by xXziroXx (Post 1300085)
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();



xXziroXx 04-15-2007 04:42 PM

Quote:

Originally Posted by Skyld (Post 1300117)
Eh. That sorta screams 'inconsistency'.

It can scream whatever it wants, aslong as I like to script like that. :)

cbk1994 04-15-2007 05:38 PM

Quote:

Originally Posted by xXziroXx (Post 1300163)
It can scream whatever it wants, aslong as I like to script like that. :)

That's one way to think about it.


All times are GMT +2. The time now is 12:42 PM.

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