Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Constructive criticism needed please. (https://forums.graalonline.com/forums/showthread.php?t=134265595)

khortez 01-21-2012 12:57 AM

Constructive criticism needed please.
 
As title says, i am once again looking for peoples thoughts on my code, so any helpful input thank you in advance here is the link:

http://pastebin.graalcenter.org/read...d=821022392520

tell me if it works or not, thank you.

Gunderak 01-21-2012 01:51 AM

Not a bad start, this
PHP Code:

if(this.boots) { 

should probably be
PHP Code:

if(this.boots == true){ 

Maybe use on KeyPressed to toggle the windows visibility.
I wrote how to do that but incapsula blocked it and I lost all my writing -_-
I effing hate incapsula.

ffcmike 01-21-2012 01:53 AM

Quote:

Originally Posted by Gunderak (Post 1682255)
Not a bad start, this
PHP Code:

if(this.boots) { 

should probably be
PHP Code:

if(this.boots == true){ 


Probably?

If this.boots is true, his way would essentially be doing:

PHP Code:

if(true){
  
//stuff


Which is basically what if(condition){} is for.

Skyld 01-21-2012 02:22 AM

Quote:

Originally Posted by Gunderak (Post 1682255)
should probably be
PHP Code:

if(this.boots == true){ 


if (this.boots == true) is equivalent to if (true == true) or if (false == true), which is unnecessary, since the expression inside the brackets only needs to evaluate to true anyway. if (this.boots) is fine.

cbk1994 01-21-2012 06:44 PM

The only thing I notice is the naming of the GUI controls. The names look unlikely to result in collisions with other scripts, but I'd recommend naming all controls with the same prefix as the parent (e.g. Staff_Window, everything below is named Staff_BootsButton, etc). If you don't do this it can be easy for names to conflict and cause issues.

khortez 01-22-2012 03:39 AM

Noted, thank you :D

Tricxta 01-22-2012 07:29 AM

Quote:

Originally Posted by Gunderak (Post 1682255)
Not a bad start, this
PHP Code:

if(this.boots) { 

should probably be
PHP Code:

if(this.boots == true){ 


x_x I'm seriously suprised to see this comming from you

cbk1994 01-22-2012 08:15 AM

Quote:

Originally Posted by Tricxta (Post 1682382)
x_x I seriously suprised to see this comming from you

Agreed, I would've expected if (this.boots == 1) {.

Gunderak 01-24-2012 05:48 AM

Quote:

Originally Posted by cbk1994 (Post 1682385)
Agreed, I would've expected if (this.boots == 1) {.

-.-


All times are GMT +2. The time now is 07:17 AM.

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