Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-09-2010, 08:34 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
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)
__________________
Reply With Quote
  #2  
Old 08-10-2010, 09:44 AM
TheRuckus TheRuckus is offline
Registered User
TheRuckus's Avatar
Join Date: Jan 2010
Posts: 147
TheRuckus can only hope to improve
What kinda button does it add?
Reply With Quote
  #3  
Old 08-10-2010, 10:01 AM
Fulg0reSama Fulg0reSama is offline
Extrinsical Anomaly
Fulg0reSama's Avatar
Join Date: Sep 2009
Location: Ohio
Posts: 3,049
Fulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant future
Quote:
Originally Posted by TheRuckus View Post
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.
__________________

Careful, thoughts and opinions here scare people.
Reply With Quote
  #4  
Old 08-10-2010, 10:21 AM
TheRuckus TheRuckus is offline
Registered User
TheRuckus's Avatar
Join Date: Jan 2010
Posts: 147
TheRuckus can only hope to improve
Won't you need a script to let the button work?
Reply With Quote
  #5  
Old 08-10-2010, 02:26 PM
PowerProNL PowerProNL is offline
Retired Zone Manager
PowerProNL's Avatar
Join Date: Feb 2008
Location: Holland
Posts: 266
PowerProNL can only hope to improve
Send a message via AIM to PowerProNL
Thanks +rep
__________________
Graal Mail: [email protected]
McPowerProNL, I'm loving it
Reply With Quote
  #6  
Old 08-10-2010, 02:46 PM
Rufus Rufus is offline
Registered User
Join Date: Jun 2004
Location: United Kingdom
Posts: 4,698
Rufus has much to be proud ofRufus has much to be proud ofRufus has much to be proud ofRufus has much to be proud ofRufus has much to be proud ofRufus has much to be proud of
"Bravo_GPTool" lol..
__________________
Quote:
Originally Posted by Loriel View Post
Seriously, you have ****-all for content and you're not exactly pulling in new developer talent, angling for prestigious titles should be your last concern.
Reply With Quote
  #7  
Old 08-10-2010, 08:03 PM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
Quote:
Originally Posted by TheRuckus View Post
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).
__________________
Reply With Quote
  #8  
Old 08-11-2010, 01:45 AM
Contrast Contrast is offline
Axel
Join Date: Jul 2010
Location: France
Posts: 7
Contrast is on a distinguished road
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
Reply With Quote
  #9  
Old 08-11-2010, 09:34 AM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Contrast View Post
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.
Reply With Quote
  #10  
Old 08-11-2010, 09:55 AM
Fulg0reSama Fulg0reSama is offline
Extrinsical Anomaly
Fulg0reSama's Avatar
Join Date: Sep 2009
Location: Ohio
Posts: 3,049
Fulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant future
Quote:
Originally Posted by Crow View 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.
+rep.
__________________

Careful, thoughts and opinions here scare people.
Reply With Quote
  #11  
Old 08-11-2010, 10:28 AM
zephirot zephirot is offline
Banned?
Join Date: Sep 2004
Location: Paris
Posts: 1,311
zephirot is a name known to allzephirot is a name known to allzephirot is a name known to all
Send a message via AIM to zephirot Send a message via MSN to zephirot
Quote:
Originally Posted by Contrast View Post
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.
__________________

Quote:
Originally Posted by unixmad
Can you just shut up ?
MAGA
MFGA
MEGA
Reply With Quote
  #12  
Old 08-11-2010, 11:35 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by Crow View 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.
Quote:
Originally Posted by zephirot View Post
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.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #13  
Old 08-11-2010, 11:39 AM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by xXziroXx View Post
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.
Reply With Quote
  #14  
Old 08-11-2010, 11:44 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by Crow View Post
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.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #15  
Old 08-11-2010, 12:01 PM
Fulg0reSama Fulg0reSama is offline
Extrinsical Anomaly
Fulg0reSama's Avatar
Join Date: Sep 2009
Location: Ohio
Posts: 3,049
Fulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant future
Quote:
Originally Posted by xXziroXx View Post
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
__________________

Careful, thoughts and opinions here scare people.
Reply With Quote
  #16  
Old 08-11-2010, 12:08 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by xXziroXx View Post
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.
Reply With Quote
  #17  
Old 08-11-2010, 04:22 PM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
Quote:
Originally Posted by Crow View Post
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.
Reply With Quote
  #18  
Old 08-11-2010, 04:55 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
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.
Reply With Quote
  #19  
Old 08-11-2010, 05:57 PM
Contrast Contrast is offline
Axel
Join Date: Jul 2010
Location: France
Posts: 7
Contrast is on a distinguished road
Quote:
Originally Posted by Crow View 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.
Quote:
Originally Posted by Crow View Post
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.
Reply With Quote
  #20  
Old 08-11-2010, 06:10 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
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!";

__________________
Quote:
Reply With Quote
  #21  
Old 08-11-2010, 06:11 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
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().
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 12:12 AM.


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