Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
In-Game Hue Tester/Sampler
Author Message
n1ghtwish
Apprentice
*

Posts: 40
Likes Given: 0
Likes Received: 28 in 8 posts
Joined: Jan 2016
Reputation: 0



Post: #1
In-Game Hue Tester/Sampler
This started out as a project for Khaos, but since she has disappeared from the face of the planet, I'll just leave it here for all to use.

               

This tool will allow you to sample, in-game, either a range of hues, a list of hues from a file (hues.txt, for example), OR all 3,000 slots at once. You can choose any item in game to sample the hues with. It's pretty self explanatory, but basically just add this script and jump in, using the command ".huetest". From there, you will be given options.

If you'd like to have it read from a file, create "hues.txt" in your root Sphere directory and fill it with decimal hues, one hue per line. Ex:

Code:
34
67
12
678
1234
.. and so on....

You can create as many of these files as you want, just change the file you want to read from in the little options dialog you get when you use the command.

Post questions, comments and concerns! (and suggestions/bugs if I suck and missed something)

Code:
// In-Game Hue Tester/Sampler
// By n1ghtwish/Maximus
// LAST EDITED: 9/06/2016

[DEFNAME hueTest_Settings]
htMaxPP = 15                            // max tiles per page (don't change this unless you modify the overall dialog size and other code)
htDefHuesFile = "hues.txt"                // default hues file from root Sphere directory

[FUNCTION huetest]
sdialog dHueTest

[DIALOG dHueTest]
150,150
page 0
resizepic 0 0 2620 300 220
checkertrans 5 5 290 215
dhtmlgump 15 15 269 25 1 0 <def.center><def.big>Hue Tester - Options<def.bige><def.centere>
button 15 60 4005 4007 1 0 1 // hue range
dtext 57 60 68 Range
resizepic 100 60 9350 40 23
dtextentrylimited 103 61 40 23 0 1 4 <eval rand(1,1500)>
dtext 150 61 68 TO
resizepic 180 60 9350 40 23
dtextentrylimited 183 61 40 23 0 2 4 <eval rand(1501,3000)>
button 15 90 4005 4007 1 0 2 // file
dtext 57 90 68 File
resizepic 100 90 9350 180 23
dtextentrylimited 103 90 180 23 0 3 30 <def.htDefHuesFile>
button 15 120 4005 4007 1 0 3 // all 3,000
dtext 57 120 68 ALL Hues
button 15 180 4017 4019 1 0 0 // close
dtext 57 180 68 Close

[DIALOG dHueTest BUTTON]
ON=0 // cancel
sysmessage Aborted!

ON=1 // range
if (<isempty <argtxt1>>)||(<isempty <argtxt2>>)||(!<isnum <argtxt1>>)||(!<isnum <argtxt2>>)
    sysmessage Must provide two numbers for hue range!
    return 1
elseif (<isnum <argtxt1>>)&&(<isnum <argtxt2>>)&&(<argtxt1> > <argtxt2>)
    sysmessage Invalid range.
    return 1
endif
ctag.htType = 1
ctag.htB = <argtxt1>
ctag.htE = <argtxt2>
sysmessage Select target.
targetf fHuetest

ON=2 // file
if (!<FILE.FILEEXIST <argtxt3>>)
    sysmessage File "<argtxt3>" not found!
    return 1
endif
ctag.htType = 2
ctag.htFile = <argtxt3>
sysmessage Select target.
targetf fHuetest

ON=3 // all
ctag.htType = 3
sysmessage Select target.
targetf fHuetest

[FUNCTION fHuetest]
// You could get rid of this IF statement to allow targeting of characters as well
if (<argo.isitem>)
    ctag.htTileBG = 2620
    ctag.htPnum = 1
    argo.sdialog dHuetest2
    return 1
endif
sysmessage Items only, dummy!

[DIALOG dHuetest2]
100,100
page 0
resizepic 0 0 2620 700 560
checkertrans 5 5 695 555
doswitch <eval <src.ctag.htType> - 1>
    begin // range
        local.tnum = <eval <eval <src.ctag.htE> - <src.ctag.htB>> + 1>
        dhtmlgump 15 15 670 25 1 0 <def.center><def.big>Hue Tester - Range: <src.dctag.htB> to <src.dctag.htE><def.bige><def.centere>
    end
    begin // file
        FILE.MODE.WRITEFLAG = 0
        FILE.MODE.CREATEFLAG = 0
        FILE.MODE.READFLAG = 1
        if (<FILE.OPEN <src.ctag.htFile>>)
            local.tnum = <FILE.FILELINES <src.ctag.htFile>>
        endif
        dhtmlgump 15 15 670 25 1 0 <def.center><def.big>Hue Tester - File: <src.ctag.htFile> - <dlocal.tnum> hues<def.bige><def.centere>
    end
    begin // all
        local.tnum = 3000
        dhtmlgump 15 15 670 25 1 0 <def.center><def.big>Hue Tester - ALL HUES<def.bige><def.centere>
    end        
enddo
local.pages = <eval (((<local.tnum> - 1) / <def.htMaxPP>) + 1)>
if (<src.ctag.htPnum> > <local.pages>)
    src.ctag.htPnum = <dlocal.pages>
endif
local.offset = <qval (<src.ctag.htPnum> > 1) ? <eval ((<src.ctag.htPnum> - 1) * <def.htMaxPP>)> : 1>
local.x = 15
local.y = 45
if (<local.tnum> >= 1)
    for h <dlocal.offset> <eval <local.offset> + <eval <def.htMaxPP> - 1>>
        if (<local.h> <= <local.tnum>)
            local.c += 1
            resizepic <dlocal.x> <dlocal.y> <eval <src.ctag.htTileBG>> 126 126 // 2620 dark, 3000 light
            doswitch <eval <src.ctag.htType> - 1>
                begin // range
                    tilepichue <eval <local.x> + 45> <eval <local.y> + 15> <id> <eval <eval <local.h> + <src.ctag.htB>> - 1>
                    button <eval <local.x> + 46> <eval <local.y> + 135> 2103 2104 1 0 <eval <eval <local.h> + <src.ctag.htB> - 1> + 3>
                    dtext <eval <local.x> + 60> <eval <local.y> + 130> 1152 <eval <eval <local.h> + <src.ctag.htB>> - 1>
                end
                begin // file
                    tilepichue <eval <local.x> + 45> <eval <local.y> + 15> <id> <FILE.READLINE <dlocal.h>>
                    button <eval <local.x> + 46> <eval <local.y> + 135> 2103 2104 1 0 <eval <FILE.READLINE <dlocal.h>> + 3>
                    dtext <eval <local.x> + 60> <eval <local.y> + 130> 1152 <FILE.READLINE <dlocal.h>>
                end
                begin // all
                    tilepichue <eval <local.x> + 45> <eval <local.y> + 15> <id> <dlocal.h>
                    button <eval <local.x> + 46> <eval <local.y> + 135> 2103 2104 1 0 <eval <local.h> + 3>
                    dtext <eval <local.x> + 60> <eval <local.y> + 130> 1152 <dlocal.h>
                end
            enddo
            local.x += 135
            if (<local.c> == 5)
                local.x = 15
                local.y = 200
            elseif (<local.c> == 10)
                local.x = 15
                local.y = 360
            endif
        endif
    end
endif
FILE.CLOSE
button 15 517 4005 4007 1 0 3
dtext 50 517 1152 Toggle Light/Dark BG
if (<src.ctag.htPnum> > 1)
    button 275 520 9909 9909 1 0 1
endif
dhtmlgump 305 517 100 25 1 0 <def.center><eval <src.ctag.htPnum>> / <dlocal.pages><def.centere>
if (<local.pages> > <src.ctag.htPnum>)
    button 414 519 9903 9903 1 0 2
endif

[DIALOG dHuetest2 BUTTON]
ON=1 2
doswitch <eval <argn1> - 1>
    src.ctag.htPnum -= 1
    src.ctag.htPnum += 1
end
sdialog dHuetest2

ON=3
src.ctag.htTileBG = <qval <src.ctag.htTileBG> == 2620 ? 3000:2620>
sdialog dHuetest2

ON=4 3100
color = <eval <argn1> - 3>
(This post was last modified: 09-11-2016 05:35 AM by n1ghtwish.)
09-06-2016 04:57 AM
Find all posts by this user Like Post Quote this message in a reply
[+] 5 users Like n1ghtwish's post
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 246
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #2
RE: In-Game Hue Tester/Sampler
very nice
09-07-2016 04:20 AM
Find all posts by this user Like Post Quote this message in a reply
rastrero
Master
**

Posts: 250
Likes Given: 41
Likes Received: 28 in 24 posts
Joined: Jan 2016
Reputation: 3



Post: #3
RE: In-Game Hue Tester/Sampler
good buddy. Just a tip: Commit your name and take some credit for your work. Wink
09-11-2016 04:27 AM
Find all posts by this user Like Post Quote this message in a reply
n1ghtwish
Apprentice
*

Posts: 40
Likes Given: 0
Likes Received: 28 in 8 posts
Joined: Jan 2016
Reputation: 0



Post: #4
RE: In-Game Hue Tester/Sampler
(09-11-2016 04:27 AM)rastrero Wrote:  good buddy. Just a tip: Commit your name and take some credit for your work. Wink

Yes, I should right? I'm not HUGE on taking credit, but I did add my name to the script.

Thanks!
09-11-2016 05:36 AM
Find all posts by this user Like Post Quote this message in a reply
rastrero
Master
**

Posts: 250
Likes Given: 41
Likes Received: 28 in 24 posts
Joined: Jan 2016
Reputation: 3



Post: #5
RE: In-Game Hue Tester/Sampler
You should if its your work Smile
(This post was last modified: 09-14-2016 09:13 AM by rastrero.)
09-14-2016 09:12 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)