Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   F2 Cleaner (https://forums.graalonline.com/forums/showthread.php?t=134259461)

Deas_Voice 06-10-2010 11:09 PM

F2 Cleaner
 
Ever used F2?
Feeling it's a bit too messy?

Theres a solution for it!

The F2 Cleaner will Clean all Tabs for you within a second!

Get it now!

Weapon:
PHP Code:

//#CLIENTSIDE
function F2LogWindow_Window.onShow() {
  if ( 
F2LogWindow_CheckBox.visible == false ) {
    
with (F2LogWindow_Window){
      new 
GuiCheckBoxCtrl("F2LogWindow_CheckBox") {
        
profile GuiBlueCheckBoxProfile;
        
hint "Clicking this checkbox will clear the F2 console window!";
        
575;
        
4;
        
width 100;
        
height 20;
        
text "";
      }
    }
  }
}
function 
F2LogWindow_CheckBox.onAction() {
  if (
F2LogWindow_CheckBox.checked) {
    (
"F2LogWindow_Tab").setselectedbyid(0);
    (
"F2LogWindow_Text0").text "Cleared!";
    for (
temp.1temp.6temp.i++) {
      (
"F2LogWindow_Text" i).text " ";
    }
    
sleep(1);
    
F2LogWindow_CheckBox.checked false;
     (
"F2LogWindow_Text0").text " ";
  }


Screenies:
http://i50.tinypic.com/2w6bb40.png|http://i48.tinypic.com/2d6s8y8.png

Hope you will like it :)
dont forget to rep me if you do!

Chompy 06-10-2010 11:21 PM

Any screenshots? :)

cbk1994 06-10-2010 11:26 PM

A check box seems a very weird way to do it. Why not use a button?

And what is this for?

PHP Code:

10^2.76


Deas_Voice 06-10-2010 11:43 PM

Quote:

Originally Posted by Chompy (Post 1581280)
Any screenshots? :)

Sure, i'll add them in a sec!
Edit: Added, thu some File download sliped thru into the screeny when i just cleared it >:[
Quote:

Originally Posted by cbk1994 (Post 1581281)
A check box seems a very weird way to do it. Why not use a button?

because it's tiny.

Crow 06-11-2010 12:30 AM

Quote:

Originally Posted by Deas_Voice (Post 1581286)
just my way of doing 'x = 575.5;' .

Only that it's 575.43993733715693 and consumes some processing time to calculate.


Quote:

Originally Posted by Deas_Voice (Post 1581286)
because it's tiny.

Make a tiny button! :p

12171217 06-11-2010 01:21 AM

Use a button with an image.

Jiroxys7 06-11-2010 01:27 AM

snipping it down to this works just fine too:
PHP Code:

if(player.chat == "/clear logs"){
    (
"F2LogWindow_Tab").setselectedbyid(0);
    (
"F2LogWindow_Text0").text "Cleared!";
    for (
temp.1temp.6temp.i++) {
      (
"F2LogWindow_Text" i).text " ";
    }
  } 


Fulg0reSama 06-11-2010 02:55 AM

Quote:

Originally Posted by Chompy (Post 1581313)
I didn't know the code gallery was the place to get your scripts grilled under the grill. You always get posts with "cool", "awesome code" or your code gets grilled with unconstructive comments > constructive comments.

I wished there rules was more strict for the code gallery. It's for releasing code to the public, not for other members to boast themselves by correcting them in a(n) unconstructive/non-informal way or try to make better code than the OP. It's not a challenge to have the best code.

I'm not saying that no one posts constructive comments either, it's just that there's a lack of these posts in the sea of unconstructive ones.

Chompy is one smart guy. Also it's kind of the scripting peoples nature here to outdo one another. Just like GFXers sometimes.

cbk1994 06-11-2010 08:06 AM

Quote:

Originally Posted by Deas_Voice (Post 1581286)
just my way of doing 'x = 575.5;' .

That's a really bad idea, and I hope you edit your post and fix it. Teaching scripters to script in a way that requires them to pull out a calculator to read what's being written is counter-productive and defeats the purpose of the Code Gallery.

Quote:

Originally Posted by Chompy (Post 1581313)
I didn't know the code gallery was the place to get your scripts grilled under the grill. You always get posts with "cool", "awesome code" or your code gets grilled with unconstructive comments > constructive comments.

I wished there rules was more strict for the code gallery. It's for releasing code to the public, not for other members to boast themselves by correcting them in a(n) unconstructive/non-informal way or try to make better code than the OP. It's not a challenge to have the best code.

I'm not saying that no one posts constructive comments either, it's just that there's a lack of these posts in the sea of unconstructive ones.

The Code Gallery is for helping new scripters by giving them model code examples. Granted, this script is also useful to developers, but the main purpose of any code gallery script is to help scripters learn.

The problems with the code in themselves do not make the script bad, but the way in which the OP jumped at myself and others for calling out the problems makes me think he has no interest in helping scripters and instead is of the mindset of "if it works, it works".

I don't see any non-constructive comments in this thread, either, until the point at which he accused everyone of whining about his script.

I consider you a better scripter than myself, Chompy, and I think you too would find scripts that have every number raised to a power to be very hard to read. You're not helping him or anyone reading this become a better scripter if you're not suggesting improvements to the way it is done now.

Tigairius 06-11-2010 03:51 PM

Quote:

Originally Posted by Chompy (Post 1581313)
I didn't know the code gallery was the place to get your scripts grilled under the grill.

The code gallery is a place for people to post helpful scripts. By posting on the code gallery, you are always setting an example if someone likes your script. Therefore, it is very important for people to comment if something is being done incorrectly so that people who do want to use this script can change it to be more efficient/effective. We don't need to teach bad habits ;)

I don't see people just grilling his script for no reason, they are providing real reasons why ____ is bad. For example, if you have a constant number, 575, you should just write 575 instead of calculating the value every single time. As Crow said, calculating 10^2.76 each time takes up more processing time than is necessary. Granted, it doesn't really make a big difference in this situation, it's still valuable knowledge to hold onto, and I think many scripters can benefit from this kind of advice.

Constructive criticism is an important part of learning how to be a better scripter. Deas, instead of becoming offended by these posts, you should embrace them and appreciate their helpful feedback, because it's not just blatant bashing.

cbk1994 06-11-2010 04:09 PM

Thanks for changing your original post, Deas_Voice. A shame that Sam deleted all of the posts in this thread, though, since some of them had very valid points.

Quote:

Originally Posted by Tigairius (Post 1581370)
if you have a constant number, 575, you should just write 575 instead of calculating the value every single time. As Crow said, calculating 10^2.76 each time takes up more processing time than is necessary. Granted, it doesn't really make a big difference in this situation, it's still valuable knowledge to hold onto, and I think many scripters can benefit from this kind of advice.

The issue is much more that you need a calculator to read his code, not that takes a fraction of a fraction of a second longer to compute.

Deas_Voice 06-11-2010 04:32 PM

i suggest you all delete your posts about this minor issue, so we will have a clean thread about the code i've submitted here.
i've changed the original post to use non-calculation and added a Hint to the checkbox to tell the user what it does.

lets put this behind us, i'm sorry for thinking you all was out to bash me.
(although, some of you clearly was)

cbk1994 06-11-2010 04:51 PM

No reason to delete posts. Another scripter might stumble upon it and notice the discussion that's taken place, which could well benefit them.

Chompy 06-11-2010 04:53 PM

Quote:

Originally Posted by cbk1994 (Post 1581380)
No reason to delete posts. Another scripter might stumble upon it and notice the discussion that's taken place, which could well benefit them.

I deleted my posts since it actually had no relevance to this thread alone, but more to the scripting community and the code gallery itself. If anyone's interested in the content of the posts I wrote, just send a PM.

fowlplay4 06-11-2010 04:55 PM

Probably wouldn't hurt to provide a function that clears the windows. I.e:

PHP Code:

//#CLIENTSIDE

function clearF2Logs() {
  for (
temp.1temp.6temp.i++) {
    (
"F2LogWindow_Text" i).text "";
  }


Re-usability should be another thing taken into consideration in the Code Gallery.

Fulg0reSama 06-11-2010 05:14 PM

Quote:

Originally Posted by fowlplay4 (Post 1581384)
Probably wouldn't hurt to provide a function that clears the windows. I.e:

Don't see the need if they just added a command or a button in the F2 console area to clear it automatically.

cbk1994 06-11-2010 05:17 PM

Quote:

Originally Posted by Fulg0reSama (Post 1581385)
Don't see the need if they just added a command or a button in the F2 console area to clear it automatically.

Should definitely be done, people like Skyld and possibly Tig have access to the scripts for that.

Inverness 06-12-2010 03:03 AM

Quote:

Originally Posted by Tigairius (Post 1581370)
calculating 10^2.76 each time

That would not be calculated each time unless Stefan wrote a terrible compiler. Constant expressions should be calculated at compile time.

Skyld 06-12-2010 02:27 PM

Quote:

Originally Posted by Tigairius (Post 1581370)
For example, if you have a constant number, 575, you should just write 575 instead of calculating the value every single time. As Crow said, calculating 10^2.76 each time takes up more processing time than is necessary.

Because it is a static expression, the value will be pre-calculated during folding at compile time. It won't have any impact on script execution because it has already been substituted for it's actual value by the time it runs.
Quote:

Originally Posted by cbk1994
Should definitely be done, people like Skyld and possibly Tig have access to the scripts for that.

Yes I am sure this would be possible :)


All times are GMT +2. The time now is 01:48 AM.

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