Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Color dialog (https://forums.graalonline.com/forums/showthread.php?t=134259112)

-Ramirez- 05-10-2010 03:27 AM

Color dialog
 
3 Attachment(s)
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.

Imperialistic 05-10-2010 04:01 AM

This is really nice, thanks!

fowlplay4 05-10-2010 04:01 AM

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

-Ramirez- 05-10-2010 04:13 AM

Quote:

Originally Posted by fowlplay4 (Post 1575159)
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.

WhiteDragon 05-10-2010 04:14 AM

Quote:

Originally Posted by fowlplay4 (Post 1575159)
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.

fowlplay4 05-10-2010 04:19 PM

1 Attachment(s)
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.


All times are GMT +2. The time now is 02:19 AM.

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