Jump to content

Help With Functions and GUI


Guest tpuniak
 Share

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!

Link to comment
Share on other sites

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]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...