Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Buttons in the Taskbar (Graal) (https://forums.graalonline.com/forums/showthread.php?t=134259451)

xAndrewx 06-09-2010 08:34 PM

Buttons in the Taskbar (Graal)
 
HTML Code:

  with(Serverlist_TaskBar) {
    new GuiButtonCtrl("Bravo_GPTool") {
      useownprofile = true;
      for (temp.i: Serverlist_TaskButton_Main.getvarnames()) {
        if (temp.i != icon) (@ temp.i) = Serverlist_TaskButton_Main.(@ temp.i);
      }
      x = 500;
      text = "GP Tools";
      seticonsize(20, 20);
      icon.clearall();
      icon.drawimagestretched(0, 0, icon.width, icon.height, "login_icon_developer4.png", 0, 0, 32, 32);
      width += 10;
     
      thiso.catchevent(this, "onAction", "onDisplayFunctions");
    }
  }

Helped with by Dusty (adds a button to your graal taskbar)

TheRuckus 08-10-2010 09:44 AM

What kinda button does it add?

Fulg0reSama 08-10-2010 10:01 AM

Quote:

Originally Posted by TheRuckus (Post 1592553)
What kinda button does it add?

I think basically whatever you want the button to call.
I'm a tad tired but It seems like that's the case.

In this case a tool for the bravo GPs.
Nice work.

TheRuckus 08-10-2010 10:21 AM

Won't you need a script to let the button work?

PowerProNL 08-10-2010 02:26 PM

Thanks +rep

Rufus 08-10-2010 02:46 PM

"Bravo_GPTool" lol..

salesman 08-10-2010 08:03 PM

Quote:

Originally Posted by TheRuckus (Post 1592559)
Won't you need a script to let the button work?

You just need to handle the onAction event for the buttons you add (i.e. the catchEvent() in the OP).

Contrast 08-11-2010 01:45 AM

You seriously need to document your releases more, not copy snippets from your code from Bravo, paste it, "here's something I made, read the title of the thread, figure out the rest yourself", post

Crow 08-11-2010 09:34 AM

Quote:

Originally Posted by Contrast (Post 1592713)
You seriously need to document your releases more, not copy snippets from your code from Bravo, paste it, "here's something I made, read the title of the thread, figure out the rest yourself", post

Code Gallery snippets are not meant to be used as is. Most require integration into existing systems. What's shown here is a piece of code only including some very basic things. If you don't know exactly what it does, I don't think you should be using it in the first place. No offense.

Fulg0reSama 08-11-2010 09:55 AM

Quote:

Originally Posted by Crow (Post 1592791)
Code Gallery snippets are not meant to be used as is. Most require integration into existing systems. What's shown here is a piece of code only including some very basic things. If you don't know exactly what it does, I don't think you should be using it in the first place. No offense.

+rep.

zephirot 08-11-2010 10:28 AM

Quote:

Originally Posted by Contrast (Post 1592713)
You seriously need to document your releases more, not copy snippets from your code from Bravo, paste it, "here's something I made, read the title of the thread, figure out the rest yourself", post

That's exactly what one should do, actually.

xXziroXx 08-11-2010 11:35 AM

Quote:

Originally Posted by Crow (Post 1592791)
Code Gallery snippets are not meant to be used as is. Most require integration into existing systems. What's shown here is a piece of code only including some very basic things. If you don't know exactly what it does, I don't think you should be using it in the first place. No offense.

Quote:

Originally Posted by zephirot (Post 1592798)
That's exactly what one should do, actually.

I disagree. The Code Gallery is a place where scripters or people needing scripts can look for, well, scripts. Whomever releases something here should really explain how to use it so anyone that want too can, and you guys are being jackasses.

Crow 08-11-2010 11:39 AM

Quote:

Originally Posted by xXziroXx (Post 1592807)
I disagree. The Code Gallery is a place where scripters or people needing scripts can look for, well, scripts. Whomever releases something here should really explain how to use it so anyone that want too can, and you guys are being jackasses.

Code is useless if you don't understand it, because then you can't integrate it into other things, therefore it's of no use. Playerworlds relying completely on the Code Gallery don't stand a chance, either.

xXziroXx 08-11-2010 11:44 AM

Quote:

Originally Posted by Crow (Post 1592808)
Playerworlds relying completely on the Code Gallery don't stand a chance, either.

No, but it sure as hell can help them along the way, which is why we post stuff here to begin with or at least it should be.

Fulg0reSama 08-11-2010 12:01 PM

Quote:

Originally Posted by xXziroXx (Post 1592809)
No, but it sure as hell can help them along the way, which is why we post stuff here to begin with or at least it should be.

I think what crow is saying ziro is that this wasn't posted for anyone to "understand". It was posted so he could show it to the people as an accomplishment and be available for others to use

Crow 08-11-2010 12:08 PM

Quote:

Originally Posted by xXziroXx (Post 1592809)
No, but it sure as hell can help them along the way, which is why we post stuff here to begin with or at least it should be.

The thing is, most people don't know how things work, they just want to know how to use it. And that won't help. Not at all.

DrakilorP2P 08-11-2010 04:22 PM

Quote:

Originally Posted by Crow (Post 1592812)
The thing is, most people don't know how things work, they just want to know how to use it. And that won't help. Not at all.

Maybe they don't know how to write their own script from scratch, but if they can use it they may at least attempt to read and modify it.
That's the impression I get anway.

Crow 08-11-2010 04:55 PM

Sorry if this wasn't clear. When I talked about the people who just want to know how to use a certain thing, I was specifically talking about the kind which just wants to, well, use it; and no more. And if anything doesn't work like they want it to do, they come onto the forums, crying. You know, the people who don't even want to learn or look at things, the ones who just want everything to work out of the box.

Contrast 08-11-2010 05:57 PM

Quote:

Originally Posted by Crow (Post 1592791)
Code Gallery snippets are not meant to be used as is. Most require integration into existing systems. What's shown here is a piece of code only including some very basic things. If you don't know exactly what it does, I don't think you should be using it in the first place. No offense.

Quote:

Originally Posted by Crow (Post 1592808)
Code is useless if you don't understand it, because then you can't integrate it into other things, therefore it's of no use. Playerworlds relying completely on the Code Gallery don't stand a chance, either.

Way to imply how things can be, but always isn't. You're implying that I shouldn't use code from the code gallery if I don't understand it? If I understood it, I could script the code myself. The Code Gallery isn't the place to dump your code for people who understand it, but a place to release code that can help and more. In terms of helping I mean understanding the code, the function of it and maybe how to integrate it into systems.

If I was a new scripter and wanted to integrate this code into my own systems, I wouldn't have any clue on how how to do so. There's no explaination behind the code posted by the OP, like where should it go? The code is also indented, so should it go under an event? A function? The title is also vague compared to the content posted, I would have expected a guide explaining how to add buttons on the taskbar by script, not some snippet from his GP Tool. And aslo about the underlined bold part, if I don't try to use if I didn't understand it fully, I wouldn't learn how to use it at all. Many scripters learn by trial and error.

This isn't post isn't meant to bash the OP, just to inform him that some documentation would be more useful for people learning or wondering how the code is used, code gallery posts including sections like screenshots, how-to-install and description/function is much more constructive and helping.

fowlplay4 08-11-2010 06:10 PM

For those who can't work from the snippet:

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
createButton();
}

function 
createButton() {
  
with(Serverlist_TaskBar) {
    new 
GuiButtonCtrl("Serverlist_TaskButton_HelloWorld") {

      
useownprofile true;

      
// Copy GUI Values from Main Button
      
for (temp.iServerlist_TaskButton_Main.getvarnames()) {
        if (
temp.!= icon) (@ temp.i) = Serverlist_TaskButton_Main.(@ temp.i);
      }

      
500;
      
text "Hello World";

      
// Draw Icon
      
seticonsize(2020);
      
icon.clearall();
      
icon.drawimagestretched(00icon.widthicon.height"login_icon_developer4.png"003232);
      
width += 10;
      
      
// Setup Action Event Catcher
      
thiso.catchevent(this"onAction""onHelloWorldClicked");
    }
  }
}

function 
onHelloWorldClicked() {
  
player.chat "Whatup world!";



Crow 08-11-2010 06:11 PM

I agree partly. The Code Gallery doesn't exist just for the people who can't code, though. The snippets on here can help you save time while coding. Also, you just can't know everything. Especially on Graal, you get to know things by trial and error. Lots of threads on the Code Gallery show you how to do stuff which isn't documented anywhere; this thread is an example.

So, this is a place to dump code for people who understand it. But, at the same time, it's a place to release code to "help and more". There's a clear line between code for beginners and code for experienced coders though. People new to coding shouldn't start off with anything fancy like task bar buttons in the first place. Besides, who wants to use Graal's task bar anyway? I believe that new coding monkeys should not try to learn much by looking at complicated stuff. If they'd learn things one by one, they would probably understand Andrew's snippet after the lessons on GUI controls and catchEvent().


All times are GMT +2. The time now is 11:54 PM.

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