Bigrob55
Joined: 24 Sep 2007 Posts: 37
|
Posted: Tue Sep 23, 2008 10:38 pm Post subject: Power Hour - A Drinking Game! |
|
|
This is my AHK version of an old drinking game!!
Alls you need is some beer, speakers, these sound files... and a few buddies.
HAVE FUN AND DRINK RESPONSIBLY!!
| Code: |
#SingleInstance Force
#NoTrayIcon
Menu, Tray, Icon, icon.ico
DetectHiddenWindows, on
SoundPlay open.mp3 ;Opening Sound
Gui 1: default
Gui +LastFound +AlwaysOnTop ; +Owner1
Gui Font, s14 w500, Arial
Gui Add, Progress, range0-60 vProgress x10 w480 h24 c0x3040FF
Gui Add, Text, r3 w450 center vtex,
( LTrim
Welcome to Power Hour, press START to begin!
Cntrl+F1 to open Rules
)
GuiControl, Font, tex
Gui Font, Bold
Gui Add, Button, x150 y110 w200 h25 vButtonText, START ; Start Button
Gui Font, s10
Gui Add, Button, x150 y137 w200 h22 ,Test-Horn ;Test Horn Button
Gui, Show, Hide w500 h160, Power Hour!!! ;Creates Window, then hides it
WinSet, Transparent, 0, Power Hour
Gui, Show
sleep, 10
trans = 0
loop, 255
{
sleep 0
trans := trans + 1
winset, transparent, %trans%, Power Hour
}
return
ButtonTest-Horn:
SoundPlay horn.mp3
Return
ButtonSTART:
GuiControlGet, ButtonText
If ( ButtonText = "START" )
{
SetTimer, OnceASecond, 1000
GuiControl,, ButtonText, RESET
}
Else
If ( ButtonText = "RESET" )
{ reload
}
Loop 50
spc .= A_Space
mintimer := sectimer := 0 ; initialize variables
SetTimer, OnceASecond, 1000
return
OnceASecond:
Gui Font, s14 w500, Arial
mintimer += tick := !sectimer := Mod(++sectimer, 60) ; count seconds and minutes
IfEqual, tick, 1
{
GuiControl, , Progress, +1
Gosub ButtonTest-Horn
}
newtext := mintimer " shot" pls(mintimer) " down,"
. "and " 60-mintimer " more to go.`n`nYou have "
. 60-sectimer " seconds until your next shot!"
GuiControl, , Tex, %newtext%
GuiControl, Font, Tex
IfEqual, mintimer, 60
{
SetTimer, onceasecond, off
;SetTimer, Done, -1
SoundPlay done.mp3 ;Ending Sound
newtext := mintimer " shots, in 60 minutes... Now thats a Power Hour!`n"
. " Thanks For Playing! "
GuiControl, , Tex, %newtext%
GuiControl, Font, Tex
sleep, 1000
GoSub GUIClose
}
return
pls(amt)
{
return amt=1 ? "" : "s"
}
RemoveTrayTip:
SetTimer, RemoveTrayTip, Off
TrayTip
return
^F1::
About:
GoSub, RemoveTrayTip
;======================== Pop-Up Window =======================
;TOAST UP!
SysGet, Workspace, MonitorWorkArea
Gui, 2:default
Gui, -Caption +ToolWindow +LastFound +AlwaysOnTop +Border
Gui, Color, 000080
Gui, Font, s10 cwhite
Gui, Add, Text, gFade,Power Hour v2.0
Gui, Font, s8 cgray
Gui, Add, Text, gFade,How To Play:`n(WARNING: This is an Endurance drinking game, which involves mass consumption of alcohol!)`n`n- The game is usually played by taking shots of beer, every minute for one straight hour.`n`n- Any player who vomits, or cannot take there shot soon after the horn sounds is eliminated!
Gui, Font, s7 cwhite underline
Gui, Add, Text, gFade,Created By: Bigrob, with special thanks to [VxE]
Gui, Show, Hide
GUI_ID := WinExist()
WinGetPos, GUIX, GUIY, GUIWidth, GUIHeight, ahk_id %GUI_ID%
NewX := WorkSpaceRight-GUIWidth-5
NewY := WorkspaceBottom-GUIHeight-5
Gui, Show, Hide x%NewX% y%NewY%
DllCall("AnimateWindow","UInt",GUI_ID,"Int",500,"UInt","0x00040008")
return
;TOAST DOWN!
Fade:
DllCall("AnimateWindow","UInt",GUI_ID,"Int",1000,"UInt","0x90000") ; Fade out when clicked
return
;======================== /Pop-Up Window =======================
;======================== Exit Program Fuction =======================
GUIClose:
SoundPlay close.mp3
sleep, 300
loop, 255
winset, transparent, % 255 - A_Index, Power Hour
ExitApp
;======================== /Exit Program Fuction =======================
|
Any feedback is always welcome  _________________ Bigrob
L337 Speak - A Ventrilo Client Side program
Winamp Sound Changer - Change Audio Output on the Fly!
Last edited by Bigrob55 on Wed Sep 24, 2008 6:16 pm; edited 2 times in total |
|