Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Confirmation box troubles (https://forums.graalonline.com/forums/showthread.php?t=134265244)

Emera 12-15-2011 10:20 PM

Quote:

Originally Posted by BlueMelon (Post 1677976)
Yea it was a little rude, but when people comment on my programming I get iffy.

I've programming in C++ and python for over 3 years, I know what I'm talking about.

I am also well capable of "styling" my code and finding errors on my own its just that there is no GScript doc excepting Graal Bible and Wiki, but even those don't have every single function you can use.

I appreciate the help I got, no further replys should be made.

Python and C++ aren't the same as GS2 and different programming languages have different coding methods. If you've been coding for "3 years" you should know that.

BlueMelon 12-15-2011 11:09 PM

Quote:

Originally Posted by Emera (Post 1677978)
Python and C++ aren't the same as GS2 and different programming languages have different coding methods. If you've been coding for "3 years" you should know that.

GScript is like a fusion of Java and C++. Event based with OOP.

There is no "correct" method, its all in the logic you use. If you can read it clearly, and it makes sense to others, there is no need to say "YOUR MISSING A SPACE HERE, OH AND HERE TO.".

cbk1994 12-15-2011 11:22 PM

Quote:

Originally Posted by BlueMelon (Post 1677995)
If you can read it clearly, and it makes sense to others, there is no need to say "YOUR MISSING A SPACE HERE, OH AND HERE TO.".

Yes, there is. Consistency is important.

Tolnaftate2004 12-15-2011 11:22 PM

Quote:

Originally Posted by BlueMelon (Post 1677995)
There is no "correct" method, its all in the logic you use. If you can read it clearly, and it makes sense to others, there is no need to say "YOUR MISSING A SPACE HERE, OH AND HERE TO.".

If you ever work in industry or contribute to an open source project, you'll quickly learn that this is generally not true.

e: by seconds!!!

BlueMelon 12-15-2011 11:33 PM

Quote:

Originally Posted by cbk1994 (Post 1677997)
Yes, there is. Consistency is important.


if(bool){
and
if ( bool ) {

So your saying one is better then the other?

Both are the same and are easily readable.

fowlplay4 12-15-2011 11:54 PM

I just said it twice and made it bold because your post (before you edited it) wasn't styled all the way through.

cbk1994 12-16-2011 02:10 AM

Quote:

Originally Posted by BlueMelon (Post 1678000)
if(bool){
and
if ( bool ) {

So your saying one is better then the other?

Both are the same and are easily readable.

The first is better because it's consistent with the vast majority of the GScript community (if there was a space after 'if' and ')'). The second is acceptable, however, as long as every other script on the server follows the same formatting rules for consistency. The only thing worse than bad styling is bad and good styling in the same script.

Tolnaftate2004 12-16-2011 02:44 AM

Quote:

Originally Posted by BlueMelon (Post 1677757)
The confirmation box does popup and it does hide when I click yes or no, but it wont return a value, If I take off the hide() then it does return the value...

You can do:

PHP Code:

  // snip
  
while (!waitfor(this.name"AnsweredDialog"));
  return 
params[0];
}

function 
onReplied(obj) {
  
ConfirmationBox.hide();
  
this.trigger("AnsweredDialog"obj.text == "Yes"true false);



BlueMelon 12-16-2011 06:58 AM

Quote:

Originally Posted by Tolnaftate2004 (Post 1678041)
You can do:

PHP Code:

  // snip
  
while (!waitfor(this.name"AnsweredDialog"));
  return 
params[0];
}

function 
onReplied(obj) {
  
ConfirmationBox.hide();
  
this.trigger("AnsweredDialog"obj.text == "Yes"true false);



This has already been said, but thank you.

Questions are answered, thanks everyone.

Tolnaftate2004 12-16-2011 09:42 AM

Quote:

Originally Posted by BlueMelon (Post 1678099)
This has already been said, but thank you.

Questions are answered, thanks everyone.

Actually, to add to that, the use of ternary operator in your code is redundant.

BlueMelon 12-16-2011 09:02 PM

Quote:

Originally Posted by Tolnaftate2004 (Post 1678112)
Actually, to add to that, the use of ternary operator in your code is redundant.

Please tell me where they are redundant so I can try and improve on that.

Tolnaftate2004 12-16-2011 09:05 PM

Quote:

Originally Posted by BlueMelon (Post 1678178)
Please tell me where they are redundant so I can try and improve on that.

PHP Code:

 x == true false 

is better expressed as simply
PHP Code:

 x == 



All times are GMT +2. The time now is 02:48 PM.

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