Jump to content
Sign in to follow this  
Guest tpuniak

Help With Functions and GUI

Recommended Posts

Guest tpuniak

;
#include <GUIConstants.au3>
;
Opt ("GUIOnEventMode", 1); Change to OnEvent mode
;
$mainwindow = GUICreate("Menu", 200, 300)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEWINDOW")
Dim $perfect,$great,$good,$boo,$ok,$total
;
GUICtrlCreateLabel("Please choose an option", 40, 10)
$NewID = GUICtrlCreateButton("DDR Score Calc", 50, 50, 100)
GUICtrlSetOnEvent($NewID, "NewID")
;
GUISetState(@SW_SHOW)
;
While 1
Sleep(100); Idle around
WEnd
;
Func CLOSEWINDOW()
MsgBox(0, "Thanks for using our calc", "Cya")
Exit
EndFunc;==>CLOSEWINDOW
;
Func NEWID($total,$perfect,$great,$boo,$good,$ok)
$Newidwindow = GUICreate("DDR Calculator", 300, 300)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSENEWID")
GUICtrlCreateLabel("Please enter your scores", 100, 10, 300)
GUICtrlCreateLabel("Pefects", 70, 50)
$perfect = GUICtrlCreateInput("perfects", 130, 50, 100)
GUICtrlCreateLabel("Greats", 70, 75)
$great = GUICtrlCreateInput("greats", 130, 72, 100)
GUICtrlCreateLabel("Goods", 70, 97)
$good = GUICtrlCreateInput("goods", 130, 94, 100)
GUICtrlCreateLabel("Boos", 70, 118)
$boo = GUICtrlCreateInput("boos", 130, 116, 100)
GUICtrlCreateLabel("Oks", 70, 142)
$ok = GUICtrlCreateInput("oks", 130, 138, 100)
GUICtrlCreateLabel("Greats", 70, 75)
;
$total = GUICtrlCreateButton("SCORE", 110, 190, 100)
GUICtrlSetOnEvent($total, "SCORE")
$total = ($perfect*2)+($great*1)+($good*0)+($boo*-8)+($ok*6)
GUISetState(@SW_SHOW, $Newidwindow)
EndFunc;==>NEWID
;
Func CLOSENEWID()
Exit
EndFunc;==>CLOSENEWID
;DIM
Func SCORE($total,$perfect,$great,$boo,$good,$ok)
    
MsgBox(0, "DDR Calculator", "Your Score Is..."& $total)
EndFunc;==>CREATE
;

Ok what i want to do here is , have a user input the # of each ranking they got

perf = 2, great = 1, good = 0, boo =-8, ok =6

i want it to calculate the score, but right now it just says every score is 4106.

Thankx for any help, sorry this code is very bad. If you have alot of time and want to make me a brand new calc it would be appreciated!

Share this post


Link to post
Share on other sites
zcoacoaz

RTFM

;
#include <GUIConstants.au3>
;
Opt ("GUIOnEventMode", 1); Change to OnEvent mode
;
$mainwindow = GUICreate("Menu", 200, 300)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEWINDOW")
Dim $perfect,$great,$good,$boo,$ok,$total
;
GUICtrlCreateLabel("Please choose an option", 40, 10)
$NewID = GUICtrlCreateButton("DDR Score Calc", 50, 50, 100)
GUICtrlSetOnEvent($NewID, "NewID")
;
GUISetState(@SW_SHOW)
;
While 1
Sleep(100); Idle around
WEnd
;
Func CLOSEWINDOW()
MsgBox(0, "Thanks for using our calc", "Cya")
Exit
EndFunc;==>CLOSEWINDOW
;
Func NEWID($total,$perfect,$great,$boo,$good,$ok)
$Newidwindow = GUICreate("DDR Calculator", 300, 300)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSENEWID")
GUICtrlCreateLabel("Please enter your scores", 100, 10, 300)
GUICtrlCreateLabel("Pefects", 70, 50)
$perfect = GUICtrlCreateInput("perfects", 130, 50, 100)
GUICtrlCreateLabel("Greats", 70, 75)
$great = GUICtrlCreateInput("greats", 130, 72, 100)
GUICtrlCreateLabel("Goods", 70, 97)
$good = GUICtrlCreateInput("goods", 130, 94, 100)
GUICtrlCreateLabel("Boos", 70, 118)
$boo = GUICtrlCreateInput("boos", 130, 116, 100)
GUICtrlCreateLabel("Oks", 70, 142)
$ok = GUICtrlCreateInput("oks", 130, 138, 100)
GUICtrlCreateLabel("Greats", 70, 75)
;
$score = GUICtrlCreateButton("SCORE", 110, 190, 100)
GUICtrlSetOnEvent($score, "SCORE")
GUISetState(@SW_SHOW, $Newidwindow)
EndFunc;==>NEWID
;
Func CLOSENEWID()
Exit
EndFunc;==>CLOSENEWID
;DIM
Func SCORE()
    
$total = (GuiCtrlRead ($perfect)*2)+(GuiCtrlRead ($great)*1)+(GuiCtrlRead ($good)*0)+(GuiCtrlRead ($boo)*-8)+(GuiCtrlRead ($ok)*-6)
MsgBox(0, "DDR Calculator", "Your Score Is..."& $total)
EndFunc;==>CREATE

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.