Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Power Hour - A Drinking Game!


  • Please log in to reply
2 replies to this topic
Bigrob55
  • Members
  • 41 posts
  • Last active: Sep 27 2013 06:42 PM
  • Joined: 24 Sep 2007
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!!


#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 :D

Leroxy
  • Members
  • 54 posts
  • Last active: May 10 2013 07:05 PM
  • Joined: 06 Dec 2007
Lmao 8) This is gonna be fun. Thx

On reset statusbar wont reset and I ussualy have multiple windows open did lost the main window in the crowd.
:roll: After a few minutes ill bet I can't find it at all. :twisted:

Thanks for sharing!

Bigrob55
  • Members
  • 41 posts
  • Last active: Sep 27 2013 06:42 PM
  • Joined: 24 Sep 2007

Lmao 8) This is gonna be fun. Thx

On reset statusbar wont reset and I ussualy have multiple windows open did lost the main window in the crowd.
:roll: After a few minutes ill bet I can't find it at all. :twisted:

Thanks for sharing!

:idea: SCRIPT ABOVE HAS BEEN UPDATED:idea:

Yea i could not agree with you more on the easy to lose window, and sadly i don't even know how to make the timer "Stop", or "Reset", that part of the code was contributed by [VxE]

- But I did make the GUI back to a simple one so that it has a taskbar tab, making the window easier to bring up.
- Secondly, since I do not know how to correctly incorporate a STOP or RESET fuction, i just simply made the reset button reload the script from the top. :-\

As always, feel free to add your two cents in... so that we can have a nicely put together finished game. Although with the right amount of booze any minor program flaw is unnoticable :wink: