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)

Rapidwolve 04-06-2007 10:38 PM

Quote:

Originally Posted by Skyld (Post 1294941)
Ugh, that makes my eyes bleed. Your brackets should be inline with the block, not with the contents. You've missed out a load of brackets anyway, and you've mixed all sorts of conditional checks which are totally unrelated to each other in one line. :/ Bleugh.

I thought that was directed to me x.x

Chompy 04-06-2007 10:40 PM

Quote:

Originally Posted by Rapidwolve (Post 1297498)
I thought that was directed to me x.x

Thread revival xD

Inverness 04-07-2007 03:55 AM

Quote:

Originally Posted by Chompy (Post 1295060)
return NULL; is just to clear out that it is not returning to a function nor returning a value.

Null IS a value, zero actually. You could just do return; anyways.

And I think Stefan should make the compiler optimize if (var == true) since that looks nicer than if (var) which makes me think of the horrors of GS1.

JkWhoSaysNi 04-07-2007 04:13 AM

Except Gscipt isn't compiled it's interpreted. If it were compiled then the compiler could optimise the statement (by turning it into if (var) ) but since it's interpreted I don't think theres any way to do it.

Anyway, the difference in speed is negligible. Just use if (var == true) if it makes it easier to read.

godofwarares 04-07-2007 04:17 AM

Everyone has their own style of coding, and they can read it. It doesn't matter if other people can't. I style similar to Skyld's styling, mainly because I find his scripts readable and he kinda pushed me to it :P

Inverness 04-07-2007 04:35 AM

GScript is not interpreted, its Compiled when you save the script. Thats how scripts are sent to the client Pre-Compiled like Stefan said. Unless Stefan has a different definition of Compiled.

Twinny 04-07-2007 05:49 AM

I think they are optimised a bit and compiled into byte code.

godofwarares 04-07-2007 02:14 PM

Its compiled into byte code, because they're all stored on your computer if you look closely enough.

Every time you add yourself a weapon, that compiled code goes directly into your computer, probably to lessen the load on the server.

cbk1994 04-07-2007 04:32 PM

if (var) always reminded me of GS1 ... I still have nightmares about that.

Inverness 04-07-2007 09:27 PM

PHP Code:

if (playerchats) {
  
tokenize #c;
  
if (strequals(#t(0),kill:)) {
    
with (getplayer(#t(1))) {
      
playerhearts 0;
    }
  }



JkWhoSaysNi 04-07-2007 10:09 PM

Quote:

Originally Posted by Inverness (Post 1297588)
GScript is not interpreted, its Compiled when you save the script. Thats how scripts are sent to the client Pre-Compiled like Stefan said. Unless Stefan has a different definition of Compiled.

I stand corrected. I always thought it was just interpreted.

The compiler could potentially optimise the code then.

Skyld 04-07-2007 10:42 PM

Quote:

Originally Posted by JkWhoSaysNi (Post 1297726)
I stand corrected. I always thought it was just interpreted.

The compiler could potentially optimise the code then.

Scripts are folded when they are compiled so that they are more efficient.

cbk1994 04-08-2007 04:42 AM

I would find it annoying if I wrote

PHP Code:

if ( var == 

and it changed it to
PHP Code:

if ( var == true 


zokemon 04-08-2007 04:48 AM

Usually the ammount of styling and the importance of a scripter's styling to himself usually reflects his skill with Graal coding.

Pretty hard to do complex scripts if you have horrible spacing ;)

Inverness 04-08-2007 05:02 AM

Quote:

Originally Posted by zokemon (Post 1297907)
Usually the ammount of styling and the importance of a scripter's styling to himself usually reflects his skill with Graal coding.

Pretty hard to do complex scripts if you have horrible spacing ;)

Irrelevant if your typing speed is excellent.


All times are GMT +2. The time now is 08:35 PM.

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