View Single Post
  #11  
Old 05-17-2011, 05:39 AM
oo_jazz_oo oo_jazz_oo is offline
Jazz teh Awesome
oo_jazz_oo's Avatar
Join Date: Jul 2006
Location: California
Posts: 596
oo_jazz_oo is a jewel in the roughoo_jazz_oo is a jewel in the rough
Send a message via MSN to oo_jazz_oo
The problem with your styling is that there are huge line gaps, indentation is all wrong.

PHP Code:
function onCreated() {
  if (
player.hearts 5) {
    
this.chat "Hello!";
  }
}
function 
onPlayerTouchsme() {
  if (
player.ap 80) {
    
player.hearts += 1;
    if (
player.hearts >= 10) {
      
this.chat "Thats a lot of hearts!";
    }
  }

Beginning and ending curly braces are on their own line. Code inside said braces is indented more. Any code inside those braces is indented even more.
This makes reading scripts much easier.

Do not use the built in style function on rc, as it tends to muck things up, and it is much better practice to style as you go along, instead of coding a giant wall of text, then attempting to style afterwards.

Beginning braces should be on the same line as the function declaration, and ending braces should be on their own line.
__________________

Reply With Quote