- PenPalThanks.gif (1.07 MiB) Viewed 3148 times
Pretty fantastic help from both of you and I don't see any point in not using everything. Not sure if I can accept more than one answer, wish I could've settled on a secondary neutral gesture (like upvote) sooner than the time it takes to reply. I wanted to try and digest this before responding, admittedly I'm still not sure what Format() is doing just yet.
jeeswg wrote:
- Btw I love the moustache guy in your other posts and your avatar. Do you have a website with image/video examples? Cheers.
- [EDIT:] Added a third example.
- [EDIT:] Helgef said something about new seed here:
[Script] Roll The Dice - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 78#p191478
- [EDIT:] There are now 5 examples.
Thanks! That emoticon set was one of the first things I'd illustrated, and I trust you'll keep that a secret.
:: Send, {joke}
Unfortunately I'm just a hobbyist and don't have a website, but none of it would compare with
what I'm doing with AHK right now anyway. I'm really enjoying AHK for drawing and do not mind shamelessly trading graphics for any help with code because I'm only two months into AHK and programming in general but it's amazing and proving to be really valuable. You've already been very helpful so feel free to knock if you're in need of something.
I'm still having trouble with one of them:
Code: Select all
q::
; ;patterns of the form 'ABABAB' e.g. 272727 (shades of grey)
; Loop, 5
; {
Random, vRand, 0, 255
; MsgBox, % Format("{:02X}{1:02X}{1:02X}", vRand)
c1 := Format("{:02X}{1:02X}", vRand)
c2 := Format("{2:02X}{1:02X}", vRand)
c3 := Format("{2:02X}{:02X}", vRand)
c4 := Format("{1:02X}{:02X}", vRand)
c5 := Format("{:02X}{:02X}", vRand)
MsgBox %c1%`n%c2%`n%c3%`n%c4%`n%c5%
; }
Return
I don't really understand what's going on just yet. I've been able to stumble my way through the others:
Code: Select all
+F21::
Roll2:
;patterns of the form 'AABBCC' e.g. AA00FF
prevAct = "row"
thisRow = "0"
; Loop, 5
; {
Random, vRand1, 0, 15
Random, vRand2, 0, 15
Random, vRand3, 0, 15
c1 := Format("{:02X}{:02X}{:02X}", vRand1*16+vRand1, vRand2*16+vRand2, vRand3*16+vRand3)
c2 := Format("{:02X}{:02X}{:02X}", vRand2*16+vRand2, vRand1*16+vRand1, vRand3*16+vRand3)
c3 := Format("{:02X}{:02X}{:02X}", vRand3*16+vRand3, vRand2*16+vRand2, vRand1*16+vRand1)
c4 := Format("{:02X}{:02X}{:02X}", vRand3*16+vRand3, vRand1*16+vRand1, vRand2*16+vRand2)
c5 := Format("{:02X}{:02X}{:02X}", vRand2*16+vRand2,,vRand3*16+vRand3, vRand1*16+vRand1)
c6 := Format("{:02X}{:02X}{:02X}", vRand1*16+vRand1, vRand3*16+vRand3, vRand2*16+vRand2)
; MsgBox %c1%`n%c2%`n%c3%`n%c4%`n%c5%`n%c6%
;
GuiControl, , BG, Under_rowC.png
;
Shift1 = %c1%
Shift2 = %c2%
Shift3 = %c3%
Shift4 = %c4%
Shift5 = %c5%
Shift6 = %c6%
;
Gosub, GuiRoll2
Return
The above will successfully give six variations, but in the ABABAB example, I can't produce BABABA yet. I only get ABABAB, ABABAB, ABAB[fluke], AB[fluke]AB, ABABAB, ABABAB, ABABAB, etc. and I can only ABABAB, never BABABA so far. Is this something I can get more help with? Also, read that post with Helgef and I've removed NewSeed, the new code works very well without it.
noname wrote:If you want only "nice" colors it is easier to use hls color values.
Code: Select all
;DllCall( "shlwapi\ColorRGBToHLS", UInt,RGB, UIntP,h, UIntP,l, UIntP,s )
loop 100
{
Random,h,0,160
Random,l,80,120
Random,s,180,240
gui,color,% Format("{1:#x}", DllCall( "shlwapi\ColorHLSToRGB", UInt,h, UInt,l, UInt,s ))
Gui, show,w200 h200
sleep 300
}
esc::exitapp
I put this into a Msgbox for testing to avoid conflicting with my gui:
Code: Select all
!F21::
NoName:
RollNum = 0
loop 9
{
++RollNum
Random,h,0,160
Random,l,80,120
Random,s,180,240
c%RollNum% := Format("{1:X}", DllCall( "shlwapi\ColorHLSToRGB", UInt,h, UInt,l, UInt,s ))
; StringMid, HexValue, % Format("{1:#x}", DllCall( "shlwapi\ColorHLSToRGB", UInt,h, UInt,l, UInt,s )), 3, 6
; MsgBox %HexValue%
}
; Update Gui for values
GuiControl, , BG, Under_pick0.png
;
Shift1 = %c1%
Shift2 = %c2%
Shift3 = %c3%
Shift4 = %c4%
Shift5 = %c5%
Shift6 = %c6%
Shift7 = %c7%
Shift8 = %c8%
Shift9 = %c9%
;
Gosub, GuiRoll1B
Return
GuiRoll1B:
GuiControl, +Background%Shift1%, 1shifter
GuiControl, +Background%Shift2%, 2shifter
GuiControl, +Background%Shift3%, 3shifter
GuiControl, +Background%Shift4%, 4shifter
GuiControl, +Background%Shift5%, 5shifter
GuiControl, +Background%Shift6%, 6shifter
GuiControl, +Background%Shift7%, 7shifter
GuiControl, +Background%Shift8%, 8shifter
GuiControl, +Background%Shift9%, 9shifter
;
GuiControl, +Background%Shift1%, Rshifter
GuiControl, , TextA, %Shift1%
GuiControl, +Background%Shift2%, Gshifter
GuiControl, , TextB, %Shift2%
GuiControl, +Background%Shift3%, Bshifter
GuiControl, , TextC, %Shift3%
;
; GuiControl, , BG, Under_pick0.png
Sleep, 300
GuiControl, , BG, Under_rowC.png
Return
It works very well, thank you for it. Occasionally it'll trim what I think is the first 0, and though it works when sent to Illustrator for the color, I notice the digit missing in my gui's edit boxes (seen in the gif at the very top). That hardly qualifies as a problem but I'd be curious to know if it's because I'm doing something wrong here.