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 01-21-2012, 12:57 AM
khortez khortez is offline
PrototypeX
khortez's Avatar
Join Date: Dec 2008
Posts: 91
khortez will become famous soon enough
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.
Reply With Quote
  #2  
Old 01-21-2012, 01:51 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
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.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #3  
Old 01-21-2012, 01:53 AM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
Quote:
Originally Posted by Gunderak View Post
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.
Reply With Quote
  #4  
Old 01-21-2012, 02:22 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 Gunderak View Post
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.
__________________
Skyld
Reply With Quote
  #5  
Old 01-21-2012, 06:44 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
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.
__________________
Reply With Quote
  #6  
Old 01-22-2012, 03:39 AM
khortez khortez is offline
PrototypeX
khortez's Avatar
Join Date: Dec 2008
Posts: 91
khortez will become famous soon enough
Noted, thank you
Reply With Quote
  #7  
Old 01-22-2012, 07:29 AM
Tricxta Tricxta is offline
The Muffin Man
Tricxta's Avatar
Join Date: Oct 2010
Location: Australia
Posts: 563
Tricxta is just really niceTricxta is just really nice
Quote:
Originally Posted by Gunderak View Post
Not a bad start, this
PHP Code:
if(this.boots) { 
should probably be
PHP Code:
if(this.boots == true){ 
I'm seriously suprised to see this comming from you

Last edited by Tricxta; 01-22-2012 at 10:24 PM..
Reply With Quote
  #8  
Old 01-22-2012, 08:15 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 Tricxta View Post
I seriously suprised to see this comming from you
Agreed, I would've expected if (this.boots == 1) {.
__________________
Reply With Quote
  #9  
Old 01-24-2012, 05:48 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Quote:
Originally Posted by cbk1994 View Post
Agreed, I would've expected if (this.boots == 1) {.
-.-
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
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 11:12 AM.


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