AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Power Hour - A Drinking Game!

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Bigrob55



Joined: 24 Sep 2007
Posts: 37

PostPosted: Tue Sep 23, 2008 10:38 pm    Post subject: Power Hour - A Drinking Game! Reply with quote

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 Very Happy
_________________
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
Back to top
View user's profile Send private message
Leroxy



Joined: 06 Dec 2007
Posts: 52

PostPosted: Tue Sep 23, 2008 10:54 pm    Post subject: Reply with quote

Lmao Cool 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.
Rolling Eyes After a few minutes ill bet I can't find it at all. Twisted Evil

Thanks for sharing!
Back to top
View user's profile Send private message
Bigrob55



Joined: 24 Sep 2007
Posts: 37

PostPosted: Wed Sep 24, 2008 6:21 pm    Post subject: Reply with quote

Leroxy wrote:
Lmao Cool 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.
Rolling Eyes After a few minutes ill bet I can't find it at all. Twisted Evil

Thanks for sharing!

Idea SCRIPT ABOVE HAS BEEN UPDATEDIdea

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
_________________
Bigrob

L337 Speak - A Ventrilo Client Side program

Winamp Sound Changer - Change Audio Output on the Fly!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group