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 05-10-2010, 03:27 AM
-Ramirez- -Ramirez- is offline
Registered User
Join Date: Jun 2002
Location: USA, Ohio
Posts: 729
-Ramirez- has a spectacular aura about
Color dialog

Reading through Rufus' thread regarding body colors in the "Future Improvements" section reminded me of this script. It's about the only useful, independent thing I made in the past, so I thought I'd post it. I'm not sure if it's the code is the most efficient or done properly, but it worked on Classic when I made it.

This dialog allows you to truly obtain any (if it's functioning properly) of the 16777216 colors, unlike other scripts I've seen. I think I remember there being some slight inaccuracy, but I'm not sure. I don't have any means of testing it now, so I'm providing it as-is.

To use:
- Upload the image files attached to this post.
- Initialize the dialog once with ColorDialog_Init();. If another script has
already done this, the function will simply return, so you don't have to
worry about checking if it's necessary.
- Call ColorDialog.show(); to show the dialog. Upon closing, the
function "ColorDialog_Close" will be called with the first parameter set
to {r,g,b} (each ranging from 0-255) if "OK" was clicked, or 0 for "Cancel".

The custom colors are stored in client.customcolors as an array.

All functions and variables in this class are prefixed with "ClrDlg_", so
nothing will interfere with whatever script it's combined with. There is
also no timeout done, nor non-GUI-related events defined.
Attached Images
  
Attached Files
File Type: txt colordialog.txt (16.5 KB, 257 views)
__________________
Kat
Reply With Quote
  #2  
Old 05-10-2010, 04:01 AM
Imperialistic Imperialistic is offline
graal player lord
Imperialistic's Avatar
Join Date: Apr 2007
Location: Florida
Posts: 1,094
Imperialistic is a jewel in the roughImperialistic is a jewel in the rough
This is really nice, thanks!
__________________
" It's been swell, but the swelling's gone down. "
Reply With Quote
  #3  
Old 05-10-2010, 04:01 AM
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
You should use waitfor, and make it an actual dialog so in scripts it can be used as follows..

temp.newcolors = ColorDialog.getColor();

Novo's Dialog system is an excellent example of this.. http://forums.graalonline.com/forums...ad.php?t=79557
__________________
Quote:
Reply With Quote
  #4  
Old 05-10-2010, 04:13 AM
-Ramirez- -Ramirez- is offline
Registered User
Join Date: Jun 2002
Location: USA, Ohio
Posts: 729
-Ramirez- has a spectacular aura about
Quote:
Originally Posted by fowlplay4 View Post
You should use waitfor, and make it an actual dialog so in scripts it can be used as follows..

temp.newcolors = ColorDialog.getColor();

Novo's Dialog system is an excellent example of this.. http://forums.graalonline.com/forums...ad.php?t=79557
I haven't touched Graal scripting in about 3 years, and I no longer have a means of testing anything. If you want to modify it to make it more convenient, feel free to do so and post it.
__________________
Kat
Reply With Quote
  #5  
Old 05-10-2010, 04:14 AM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
Quote:
Originally Posted by fowlplay4 View Post
You should use waitfor, and make it an actual dialog so in scripts it can be used as follows..

temp.newcolors = ColorDialog.getColor();

Novo's Dialog system is an excellent example of this.. http://forums.graalonline.com/forums...ad.php?t=79557
Not sure if I'd agree with that, since your whole script could block for entirety if it messes up. I'm more partial to the regular callback method of doing asynchronous things.
Reply With Quote
  #6  
Old 05-10-2010, 04:19 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
Well made an actual dialog version.

I did change the client from.. client.customcolors to client.clrdialog_customcolors, to reduce the chance of collision with other scripts to a minimum.

My test script:

PHP Code:
//#CLIENTSIDE

function onCreated() {
  
temp.newcolors findweapon("-ColorDialog").getColor();
  
player.chat temp.newcolors;

I've included other examples of how it can be used in the script itself.
Attached Files
File Type: txt -colordialog.txt (18.0 KB, 229 views)
__________________
Quote:
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 09:36 PM.


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