Sign in to follow this  
Followers 0
KingBeavii

Looking For Feedback

6 posts in this topic

Hi

Just recently started looking into scripts and decided to give it a go. I decided to attempt to make a scoreboard with a timer. and after a bit of research This is my script. I have said version 4.0 as it has taken me 4 attempts to get this far (Plus a few 1.1, 2.1. 2.2's etc, as i learned new func's and techniques).

;       Beavii's Multi Scorecard
;       BMS v4.0        26-1-2011
$BUILD="BMS v4.0"
#include <Array.au3>
Global $TURNS=0         ;default set for history function   
Global $SCORES[9][2]    ;create scorecard array (with an extra line)
Global $HIST[1000][3]   ;create history array
$H=@DesktopHeight/2     ;used for no centered items
$R=0                    ;timer default, detects timer pauses
SplashTextOn($BUILD,$BUILD&@CRLF&"LOADING",-1,-1,-1,-1,34,"impact",72,500)
sleep(1500)
;       INPUT TEAMS/PLAYERS
$TEAM=InputBox($BUILD,"How Many Players/Teams Should Be Added?","2-8","",250,130)
If $TEAM<2 Then $TEAM=2     ; Prevents Excess
If $TEAM>8 Then $TEAM=8     ; Prevents Short    
If @error=1 then exit
$SCORES[1][1]=InputBox($BUILD,"PLAYER/TEAM 1, Please enter your name.","PLAYER1","",250,130)                    ; Adds Player Name
$SCORES[2][1]=InputBox($BUILD,"PLAYER/TEAM 2, Please enter your name.","PLAYER2","",250,130)                    ; Adds Player Name
If $TEAM>2 Then $SCORES[3][1]=InputBox($BUILD,"PLAYER/TEAM 3, Please enter your name.","PLAYER3","",250,130)    ; Adds Player Name
If $TEAM>3 Then $SCORES[4][1]=InputBox($BUILD,"PLAYER/TEAM 4, Please enter your name.","PLAYER4","",250,130)    ; Adds Player Name
If $TEAM>4 Then $SCORES[5][1]=InputBox($BUILD,"PLAYER/TEAM 5, Please enter your name.","PLAYER5","",250,130)    ; Adds Player Name
If $TEAM>5 Then $SCORES[6][1]=InputBox($BUILD,"PLAYER/TEAM 6, Please enter your name.","PLAYER6","",250,130)    ; Adds Player Name
If $TEAM>6 Then $SCORES[7][1]=InputBox($BUILD,"PLAYER/TEAM 7, Please enter your name.","PLAYER7","",250,130)    ; Adds Player Name
If $TEAM>7 Then $SCORES[8][1]=InputBox($BUILD,"PLAYER/TEAM 8, Please enter your name.","PLAYER8","",250,130)    ; Adds Player Name
;       INPUT TIMER OPTIONS
$RT=InputBox($BUILD,"How Many Minutes Are Allowed Per Turn?"&@CRLF&@CRLF&"0 = No Time Limit","5","",250,150)*60
If $RT<0 Then $RT=0     ;Prevents Negative Time
;       SET USER CONTROLS
HotKeySet("{F1}","Score1")
HotKeySet("{F2}","Score2")
If $TEAM>2 Then HotKeySet("{F3}","Score3")
If $TEAM>3 Then HotKeySet("{F4}","Score4")
If $TEAM>4 Then HotKeySet("{F5}","Score5")
If $TEAM>5 Then HotKeySet("{F6}","Score6")
If $TEAM>6 Then HotKeySet("{F7}","Score7")
If $TEAM>7 Then HotKeySet("{F8}","Score8")
If $RT>0 Then HotKeySet("{F10}","PreTimer")
HotKeySet("{F11}","Pause")
HotKeySet("{ESC}","EndGame")
HotKeySet("!h","History")   ;ALT+h
;       SET SCORES TO 0
$COUNT=0
Do
    $SCORES[$COUNT][0]=0
    $COUNT=$COUNT+1
Until $COUNT=9
 $SCORES[0][0]=999999999999999999999
 $1ST=1
CARD()
;       DRAW TO CARD
Func CARD ()
    If $TEAM=2 Then SplashTextOn($BUILD,$BUILD&"    SCORECARD"&@CRLF&@CRLF&"    "&$SCORES[1][0]&"   -  "&$SCORES[1][1]&" (F1)"&@CRLF&"  "&$SCORES[2][0]&"   -  "&$SCORES[2][1]&" (F2)",-1,-1,-1,-1,6,"impact",22,500)
    If $TEAM=3 Then SplashTextOn($BUILD,$BUILD&"    SCORECARD"&@CRLF&@CRLF&"    "&$SCORES[1][0]&"   -  "&$SCORES[1][1]&" (F1)"&@CRLF&"  "&$SCORES[2][0]&"   -  "&$SCORES[2][1]&" (F2)"&@CRLF&"  "&$SCORES[3][0]&"   -  "&$SCORES[3][1]&" (F3)"&@CRLF,-1,-1,-1,-1,6,"impact",22,500)
    If $TEAM=4 Then SplashTextOn($BUILD,$BUILD&"    SCORECARD"&@CRLF&@CRLF&"    "&$SCORES[1][0]&"   -  "&$SCORES[1][1]&" (F1)"&@CRLF&"  "&$SCORES[2][0]&"   -  "&$SCORES[2][1]&" (F2)"&@CRLF&"  "&$SCORES[3][0]&"   -  "&$SCORES[3][1]&" (F3)"&@CRLF&"  "&$SCORES[4][0]&"   -  "&$SCORES[4][1]&" (F4)",-1,-1,-1,-1,6,"impact",22,500)
    If $TEAM=5 Then SplashTextOn($BUILD,$BUILD&"    SCORECARD"&@CRLF&@CRLF&"    "&$SCORES[1][0]&"   -  "&$SCORES[1][1]&" (F1)"&@CRLF&"  "&$SCORES[2][0]&"   -  "&$SCORES[2][1]&" (F2)"&@CRLF&"  "&$SCORES[3][0]&"   -  "&$SCORES[3][1]&" (F3)"&@CRLF&"  "&$SCORES[4][0]&"   -  "&$SCORES[4][1]&" (F4)"&@CRLF&"  "&$SCORES[5][0]&"   -  "&$SCORES[5][1]&" (F5)",-1,-1,-1,-1,6,"impact",22,500)
    If $TEAM=6 Then SplashTextOn($BUILD,$BUILD&"    SCORECARD"&@CRLF&@CRLF&"    "&$SCORES[1][0]&"   -  "&$SCORES[1][1]&" (F1)"&@CRLF&"  "&$SCORES[2][0]&"   -  "&$SCORES[2][1]&" (F2)"&@CRLF&"  "&$SCORES[3][0]&"   -  "&$SCORES[3][1]&" (F3)"&@CRLF&"  "&$SCORES[4][0]&"   -  "&$SCORES[4][1]&" (F4)"&@CRLF&"  "&$SCORES[5][0]&"   -  "&$SCORES[5][1]&" (F5)"&@CRLF&"  "&$SCORES[6][0]&"   -  "&$SCORES[6][1]&" (F6)",-1,-1,-1,-1,6,"impact",22,500)
    If $TEAM=7 Then SplashTextOn($BUILD,$BUILD&"    SCORECARD"&@CRLF&@CRLF&"    "&$SCORES[1][0]&"   -  "&$SCORES[1][1]&" (F1)"&@CRLF&"  "&$SCORES[2][0]&"   -  "&$SCORES[2][1]&" (F2)"&@CRLF&"  "&$SCORES[3][0]&"   -  "&$SCORES[3][1]&" (F3)"&@CRLF&"  "&$SCORES[4][0]&"   -  "&$SCORES[4][1]&" (F4)"&@CRLF&"  "&$SCORES[5][0]&"   -  "&$SCORES[5][1]&" (F5)"&@CRLF&"  "&$SCORES[6][0]&"   -  "&$SCORES[6][1]&" (F6)"&@CRLF&"  "&$SCORES[7][0]&"   -  "&$SCORES[7][1]&" (F7)",-1,-1,-1,-1,6,"impact",22,500)
    If $TEAM=8 Then SplashTextOn($BUILD,$BUILD&"    SCORECARD"&@CRLF&@CRLF&"    "&$SCORES[1][0]&"   -  "&$SCORES[1][1]&" (F1)"&@CRLF&"  "&$SCORES[2][0]&"   -  "&$SCORES[2][1]&" (F2)"&@CRLF&"  "&$SCORES[3][0]&"   -  "&$SCORES[3][1]&" (F3)"&@CRLF&"  "&$SCORES[4][0]&"   -  "&$SCORES[4][1]&" (F4)"&@CRLF&"  "&$SCORES[5][0]&"   -  "&$SCORES[5][1]&" (F5)"&@CRLF&"  "&$SCORES[6][0]&"   -  "&$SCORES[6][1]&" (F6)"&@CRLF&"  "&$SCORES[7][0]&"   -  "&$SCORES[7][1]&" (F7)"&@CRLF&"  "&$SCORES[8][0]&"   -  "&$SCORES[8][1]&" (F8)",-1,-1,-1,-1,6,"impact",22,500)
global $R=0
if $TURNS=999 then $TURNS=998
If $1ST=1 Then Active()
If $RT>0 Then Timer()
    Active()
EndFunc
;       ACTIVE/WAIT
Func Active()
do 
    $1ST=0
    Sleep(1800000)
    $CONT=MsgBox(36,$BUILD,$BUILD&"Has Been Inactive For 30Mins, Do you want to BMS To Continue Running?")
    If $CONT=6 Then CARD()
    If $CONT=7 Then Exit
Until $CONT=7
EndFunc
;       PLAYER SCORE EDIT
Func Score1()
    $SCO=InputBox($BUILD,"How Many Points Are To Be Added to "&$SCORES[1][1]&"'s Score","","",250,150)
    If @error=1 then Resume()
    $SCORES[1][0]=$SCORES[1][0]+$SCO
    $TURNS=$TURNS+1
    $HIST[$TURNS][0]=$SCORES[1][1]
    $HIST[$TURNS][1]=$SCO
    $HIST[$TURNS][2]=$SCORES[1][0]
    CARD()
EndFunc
Func Score2()
    $SCO=InputBox($BUILD,"How Many Points Are To Be Added to "&$SCORES[2][1]&"'s Score","","",250,150)
    If @error=1 then Resume()
    $SCORES[2][0]=$SCORES[2][0]+$SCO
    $TURNS=$TURNS+1
    $HIST[$TURNS][0]=$SCORES[2][1]
    $HIST[$TURNS][1]=$SCO
    $HIST[$TURNS][2]=$SCORES[2][0]
    CARD()
EndFunc
Func Score3()
    $SCO=InputBox($BUILD,"How Many Points Are To Be Added to "&$SCORES[3][1]&"'s Score","","",250,150)
    If @error=1 then Resume()
    $SCORES[3][0]=$SCORES[3][0]+$SCO
    $TURNS=$TURNS+1
    $HIST[$TURNS][0]=$SCORES[3][1]
    $HIST[$TURNS][1]=$SCO
    $HIST[$TURNS][2]=$SCORES[3][0]
    CARD()
EndFunc
Func Score4()
    $SCO=InputBox($BUILD,"How Many Points Are To Be Added to "&$SCORES[4][1]&"'s Score","","",250,150)
    If @error=1 then Resume()
    $SCORES[4][0]=$SCORES[4][0]+$SCO
    $TURNS=$TURNS+1
    $HIST[$TURNS][0]=$SCORES[4][1]
    $HIST[$TURNS][1]=$SCO
    $HIST[$TURNS][2]=$SCORES[4][0]
    CARD()
EndFunc
Func Score5()
    $SCO=InputBox($BUILD,"How Many Points Are To Be Added to "&$SCORES[5][1]&"'s Score","","",250,150)
    If @error=1 then Resume()
    $SCORES[5][0]=$SCORES[5][0]+$SCO
    $TURNS=$TURNS+1
    $HIST[$TURNS][0]=$SCORES[5][1]
    $HIST[$TURNS][1]=$SCO
    $HIST[$TURNS][2]=$SCORES[5][0]
    CARD()
EndFunc
Func Score6()
    $SCO=InputBox($BUILD,"How Many Points Are To Be Added to "&$SCORES[6][1]&"'s Score","","",250,150)
    If @error=1 then Resume()
    $SCORES[6][0]=$SCORES[6][0]+$SCO
    $TURNS=$TURNS+1
    $HIST[$TURNS][0]=$SCORES[6][1]
    $HIST[$TURNS][1]=$SCO
    $HIST[$TURNS][2]=$SCORES[6][0]
    CARD()
EndFunc
Func Score7()
    $SCO=InputBox($BUILD,"How Many Points Are To Be Added to "&$SCORES[7][1]&"'s Score","","",250,150)
    If @error=1 then Resume()
    $SCORES[7][0]=$SCORES[7][0]+$SCO
    $TURNS=$TURNS+1
    $HIST[$TURNS][0]=$SCORES[7][1]
    $HIST[$TURNS][1]=$SCO
    $HIST[$TURNS][2]=$SCORES[7][0]
    CARD()
EndFunc
Func Score8()
    $SCO=InputBox($BUILD,"How Many Points Are To Be Added to "&$SCORES[8][1]&"'s Score","","",250,150)
    If @error=1 then Resume()
    $SCORES[8][0]=$SCORES[8][0]+$SCO
    $TURNS=$TURNS+1
    $HIST[$TURNS][0]=$SCORES[8][1]
    $HIST[$TURNS][1]=$SCO
    $HIST[$TURNS][2]=$SCORES[8][0]
    CARD()
EndFunc
;       START/RESET TIMER
Func PreTimer()
    $R=0
    Timer()
EndFunc
;       BEGIN TIMER FROM $R
Func Timer()
    If $R>0 Then Resume()
    ProgressOn($BUILD,$RT/60&" Minutes ("&$RT&") Seconds","0 Elapsed    "&$RT&" Remaining",-1,$H+200,2)
for $E= 1 to $RT step 1
    If $RT-$E>9 then sleep(1000)
    If $RT-$E=60 Then Beep(1500,500)
    If $RT-$E=9 Then Beep(1100,200)
        If $RT-$E=9 Then Sleep(800)
    If $RT-$E=8 Then Beep(1200,200)
        If $RT-$E=8 Then Sleep(800)
    If $RT-$E=7 Then Beep(1300,200)
        If $RT-$E=7 Then Sleep(800)
    If $RT-$E=6 Then Beep(1400,200)
        If $RT-$E=6 Then Sleep(800)
    If $RT-$E=5 Then Beep(1500,200)
        If $RT-$E=5 Then Sleep(800)
    If $RT-$E=4 Then Beep(1600,200)
        If $RT-$E=4 Then Sleep(800)
    If $RT-$E=3 Then Beep(1700,200)
        If $RT-$E=3 Then Sleep(800)
    If $RT-$E=2 Then Beep(1800,200)
        If $RT-$E=2 Then Sleep(800)
    If $RT-$E=1 Then Beep(1900,200)
        If $RT-$E=1 Then Sleep(800)
    ProgressSet(100/$RT*$E,$E&" Elapsed "&$RT-$E&" Remaining")
    global $R=$E
Next
    if $RT>0 Then ProgressSet(100,$RT-1&" Elapsed   1 Remaining")
    if $RT>0 Then Beep(2000,1000)
    if $RT>0 Then ProgressSet(100,"PLAYER HAS TIMED OUT")
    if $RT>0 Then MsgBox(0,$BUILD,"Player Has Timed Out")
    ProgressOff()
    global $R=0
    Active()
EndFunc 
;       CONTINUE TIMER AFTER CANCELED SCORE
func Resume()
    IF $RT=0 Then CARD()
    $A=$R
    ProgressOn($BUILD,$RT/60&" Minutes ("&$RT&") Seconds",$A&" Elapsed  "&$RT-$A&" Remaining",-1,$H+200,2)
For $E= 1+$A to $RT step 1
    If $RT-$E>9 then sleep(1000)
    If $RT-$E=60 Then Beep(1500,500)
    If $RT-$E=9 Then Beep(1100,200)
        If $RT-$E=9 Then Sleep(800)
    If $RT-$E=8 Then Beep(1200,200)
        If $RT-$E=8 Then Sleep(800)
    If $RT-$E=7 Then Beep(1300,200)
        If $RT-$E=7 Then Sleep(800)
    If $RT-$E=6 Then Beep(1400,200)
        If $RT-$E=6 Then Sleep(800)
    If $RT-$E=5 Then Beep(1500,200)
        If $RT-$E=5 Then Sleep(800)
    If $RT-$E=4 Then Beep(1600,200)
        If $RT-$E=4 Then Sleep(800)
    If $RT-$E=3 Then Beep(1700,200)
        If $RT-$E=3 Then Sleep(800)
    If $RT-$E=2 Then Beep(1800,200)
        If $RT-$E=2 Then Sleep(800)
    If $RT-$E=1 Then Beep(1900,200)
        If $RT-$E=1 Then Sleep(800)
    ProgressSet(100/$RT*$E,$E&" Elapsed "&$RT-$E&" Remaining")
    global $R=$E
Next
    if $RT>0 Then ProgressSet(100,$RT-1&" Elapsed   1 Remaining")
    if $RT>0 Then Beep(2000,1000)
    if $RT>0 Then ProgressSet(100,"PLAYER HAS TIMED OUT")
    if $RT>0 Then MsgBox(0,$BUILD,"Player Has Timed Out")
    ProgressOff()
    global $R=0
Active()
EndFunc
;       END GAME
Func EndGame()
    $CHECK=MsgBox(52,$BUILD,"Are You Sure You Want To End The Game")
    If $CHECK=7 then Resume ()
    $TURNS=$TURNS+1
    $HIST[$TURNS][1]="END GAME"
    ProgressOff()
    $WIN="TIE GAME"
    _ArraySort($SCORES,1)
    if $SCORES[1][0]=$SCORES[2][0] Then SplashTextOn($BUILD,"TIE GAME",-1,-1,-1,-1,34,"impact",72,500)
    if $SCORES[1][0]=$SCORES[2][0] Then MyExit()
    SplashTextOn($BUILD,"WINNER"&@CRLF&$SCORES[1][1]&@CRLF&@CRLF&"2nd  "&$SCORES[2][1],-1,-1,-1,-1,34,"impact",48,500)
Sleep(5000)
MyExit()
EndFunc
;       PAUSE TIMER
Func Pause()
    If $R>0 Then MsgBox(0,$BUILD,"PAUSED, Press 'Ok' To Continue")
    Resume()
EndFunc
;       EXIT/RESTART
Func MyExit()
    $END=MsgBox(4,$BUILD,"Do You Want To Return To The Scorecard")  
If $END=6 Then ProgressOff()
If $END=6 Then $RT=0
If $END=6 Then  CARD()
$SCORES[1][0]=0
$SCORES[2][0]=0
$SCORES[3][0]=0
$SCORES[4][0]=0
$SCORES[5][0]=0
$SCORES[6][0]=0
$SCORES[7][0]=0
$SCORES[8][0]=0
    $EXIT=MsgBox(36,$BUILD,"Do You Want To Play Again?")
    If $EXIT=7 then Exit
    $TURNS=$TURNS+1
    $HIST[$TURNS][1]="NEW GAME"
    If $EXIT=6 Then CARD()
    If $EXIT=7 then Exit
EndFunc
;       SHOW HISTORY
Func History()
    _ArrayDisplay($HIST,$BUILD)
EndFunc

Share this post


Link to post
Share on other sites



Just noticed that i submitted the wrong code.

the $SCORES array on this one doesnt reset properly. i fixed it before compiling but that was on another pc. will edit later

Share this post


Link to post
Share on other sites

Might be useful to include a little bit of information about yourself in relation to your personal coding history/experience/skills/etc.

And maybe what kind of feedback your interested in. Like ... program usefulness, code style(readability), code flow(effectiveness), etc. (just to give the reader some hints.)


"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thanks,

I have absloutley no experience whatso ever. I came across AutoIt by chance and just started messin around. The need for a timed scorebored came up and i very quickly wrote a sleep and beep script and opened a text file.After afew days, i had to use the sleep and beep again, so i decided to take it a step further and here is where i'm at. this is the real code. (The first one doesnt like new game option). I'm really looking for a few folk to have a wee look, or a wee test. let me know if i'm coding correctly, or if i could make some parts better.

;       Beavii's Multi Scorecard
;       BMS v4.0        26-1-2011
$BUILD="BMS v4.0"
#include <Array.au3>
Global $TURNS=0         ;default set for history function   
Global $SCORES[9][2]    ;create scorecard array (with an extra line)
Global $HIST[1000][3]   ;create history array
$H=@DesktopHeight/2     ;used for no centered items
$R=0                    ;timer default, detects timer pauses
SplashTextOn($BUILD,$BUILD&@CRLF&"LOADING",-1,-1,-1,-1,34,"impact",72,500)
sleep(1500)
;       INPUT TEAMS/PLAYERS
$TEAM=InputBox($BUILD,"How Many Players/Teams Should Be Added?","2-8","",250,130)
If $TEAM<2 Then $TEAM=2     ; Prevents Excess
If $TEAM>8 Then $TEAM=8     ; Prevents Short    
If @error=1 then exit
$SCORES[1][1]=InputBox($BUILD,"PLAYER/TEAM 1, Please enter your name.","PLAYER1","",250,130)                    ; Adds Player Name
$SCORES[2][1]=InputBox($BUILD,"PLAYER/TEAM 2, Please enter your name.","PLAYER2","",250,130)                    ; Adds Player Name
If $TEAM>2 Then $SCORES[3][1]=InputBox($BUILD,"PLAYER/TEAM 3, Please enter your name.","PLAYER3","",250,130)    ; Adds Player Name
If $TEAM>3 Then $SCORES[4][1]=InputBox($BUILD,"PLAYER/TEAM 4, Please enter your name.","PLAYER4","",250,130)    ; Adds Player Name
If $TEAM>4 Then $SCORES[5][1]=InputBox($BUILD,"PLAYER/TEAM 5, Please enter your name.","PLAYER5","",250,130)    ; Adds Player Name
If $TEAM>5 Then $SCORES[6][1]=InputBox($BUILD,"PLAYER/TEAM 6, Please enter your name.","PLAYER6","",250,130)    ; Adds Player Name
If $TEAM>6 Then $SCORES[7][1]=InputBox($BUILD,"PLAYER/TEAM 7, Please enter your name.","PLAYER7","",250,130)    ; Adds Player Name
If $TEAM>7 Then $SCORES[8][1]=InputBox($BUILD,"PLAYER/TEAM 8, Please enter your name.","PLAYER8","",250,130)    ; Adds Player Name
;       INPUT TIMER OPTIONS
$RT=InputBox($BUILD,"How Many Minutes Are Allowed Per Turn?"&@CRLF&@CRLF&"0 = No Time Limit","5","",250,150)*60
If $RT<0 Then $RT=0     ;Prevents Negative Time
;       SET USER CONTROLS
HotKeySet("{F1}","Score1")
HotKeySet("{F2}","Score2")
If $TEAM>2 Then HotKeySet("{F3}","Score3")
If $TEAM>3 Then HotKeySet("{F4}","Score4")
If $TEAM>4 Then HotKeySet("{F5}","Score5")
If $TEAM>5 Then HotKeySet("{F6}","Score6")
If $TEAM>6 Then HotKeySet("{F7}","Score7")
If $TEAM>7 Then HotKeySet("{F8}","Score8")
If $RT>0 Then HotKeySet("{F10}","PreTimer")
HotKeySet("{F11}","Pause")
HotKeySet("{ESC}","EndGame")
HotKeySet("!h","History")   ;ALT+h
;       SET SCORES TO 0
$COUNT=0
Do
    $SCORES[$COUNT][0]=0
    $COUNT=$COUNT+1
Until $COUNT=9
 $SCORES[0][0]=999999999999999999999
 $1ST=1
 global $COPY=$SCORES
CARD()
;       DRAW TO CARD
Func CARD ()
    If $TEAM=2 Then SplashTextOn($BUILD,$BUILD&"    SCORECARD"&@CRLF&@CRLF&"    "&$SCORES[1][0]&"   -  "&$SCORES[1][1]&" (F1)"&@CRLF&"  "&$SCORES[2][0]&"   -  "&$SCORES[2][1]&" (F2)",-1,-1,-1,-1,6,"impact",22,500)
    If $TEAM=3 Then SplashTextOn($BUILD,$BUILD&"    SCORECARD"&@CRLF&@CRLF&"    "&$SCORES[1][0]&"   -  "&$SCORES[1][1]&" (F1)"&@CRLF&"  "&$SCORES[2][0]&"   -  "&$SCORES[2][1]&" (F2)"&@CRLF&"  "&$SCORES[3][0]&"   -  "&$SCORES[3][1]&" (F3)"&@CRLF,-1,-1,-1,-1,6,"impact",22,500)
    If $TEAM=4 Then SplashTextOn($BUILD,$BUILD&"    SCORECARD"&@CRLF&@CRLF&"    "&$SCORES[1][0]&"   -  "&$SCORES[1][1]&" (F1)"&@CRLF&"  "&$SCORES[2][0]&"   -  "&$SCORES[2][1]&" (F2)"&@CRLF&"  "&$SCORES[3][0]&"   -  "&$SCORES[3][1]&" (F3)"&@CRLF&"  "&$SCORES[4][0]&"   -  "&$SCORES[4][1]&" (F4)",-1,-1,-1,-1,6,"impact",22,500)
    If $TEAM=5 Then SplashTextOn($BUILD,$BUILD&"    SCORECARD"&@CRLF&@CRLF&"    "&$SCORES[1][0]&"   -  "&$SCORES[1][1]&" (F1)"&@CRLF&"  "&$SCORES[2][0]&"   -  "&$SCORES[2][1]&" (F2)"&@CRLF&"  "&$SCORES[3][0]&"   -  "&$SCORES[3][1]&" (F3)"&@CRLF&"  "&$SCORES[4][0]&"   -  "&$SCORES[4][1]&" (F4)"&@CRLF&"  "&$SCORES[5][0]&"   -  "&$SCORES[5][1]&" (F5)",-1,-1,-1,-1,6,"impact",22,500)
    If $TEAM=6 Then SplashTextOn($BUILD,$BUILD&"    SCORECARD"&@CRLF&@CRLF&"    "&$SCORES[1][0]&"   -  "&$SCORES[1][1]&" (F1)"&@CRLF&"  "&$SCORES[2][0]&"   -  "&$SCORES[2][1]&" (F2)"&@CRLF&"  "&$SCORES[3][0]&"   -  "&$SCORES[3][1]&" (F3)"&@CRLF&"  "&$SCORES[4][0]&"   -  "&$SCORES[4][1]&" (F4)"&@CRLF&"  "&$SCORES[5][0]&"   -  "&$SCORES[5][1]&" (F5)"&@CRLF&"  "&$SCORES[6][0]&"   -  "&$SCORES[6][1]&" (F6)",-1,-1,-1,-1,6,"impact",22,500)
    If $TEAM=7 Then SplashTextOn($BUILD,$BUILD&"    SCORECARD"&@CRLF&@CRLF&"    "&$SCORES[1][0]&"   -  "&$SCORES[1][1]&" (F1)"&@CRLF&"  "&$SCORES[2][0]&"   -  "&$SCORES[2][1]&" (F2)"&@CRLF&"  "&$SCORES[3][0]&"   -  "&$SCORES[3][1]&" (F3)"&@CRLF&"  "&$SCORES[4][0]&"   -  "&$SCORES[4][1]&" (F4)"&@CRLF&"  "&$SCORES[5][0]&"   -  "&$SCORES[5][1]&" (F5)"&@CRLF&"  "&$SCORES[6][0]&"   -  "&$SCORES[6][1]&" (F6)"&@CRLF&"  "&$SCORES[7][0]&"   -  "&$SCORES[7][1]&" (F7)",-1,-1,-1,-1,6,"impact",22,500)
    If $TEAM=8 Then SplashTextOn($BUILD,$BUILD&"    SCORECARD"&@CRLF&@CRLF&"    "&$SCORES[1][0]&"   -  "&$SCORES[1][1]&" (F1)"&@CRLF&"  "&$SCORES[2][0]&"   -  "&$SCORES[2][1]&" (F2)"&@CRLF&"  "&$SCORES[3][0]&"   -  "&$SCORES[3][1]&" (F3)"&@CRLF&"  "&$SCORES[4][0]&"   -  "&$SCORES[4][1]&" (F4)"&@CRLF&"  "&$SCORES[5][0]&"   -  "&$SCORES[5][1]&" (F5)"&@CRLF&"  "&$SCORES[6][0]&"   -  "&$SCORES[6][1]&" (F6)"&@CRLF&"  "&$SCORES[7][0]&"   -  "&$SCORES[7][1]&" (F7)"&@CRLF&"  "&$SCORES[8][0]&"   -  "&$SCORES[8][1]&" (F8)",-1,-1,-1,-1,6,"impact",22,500)
global $R=0
if $TURNS=999 then $TURNS=998
If $1ST=1 Then Active()
If $RT>0 Then Timer()
    Active()
EndFunc
;       ACTIVE/WAIT
Func Active()
do 
    $1ST=0
    Sleep(1800000)
    $CONT=MsgBox(36,$BUILD,$BUILD&"Has Been Inactive For 30Mins, Do you want to BMS To Continue Running?")
    If $CONT=6 Then CARD()
    If $CONT=7 Then Exit
Until $CONT=7
EndFunc
;       PLAYER SCORE EDIT
Func Score1()
    $SCO=InputBox($BUILD,"How Many Points Are To Be Added to "&$SCORES[1][1]&"'s Score","","",250,150)
    If @error=1 then Resume()
    $SCORES[1][0]=$SCORES[1][0]+$SCO
    $TURNS=$TURNS+1
    $HIST[$TURNS][0]=$SCORES[1][1]
    $HIST[$TURNS][1]=$SCO
    $HIST[$TURNS][2]=$SCORES[1][0]
    CARD()
EndFunc
Func Score2()
    $SCO=InputBox($BUILD,"How Many Points Are To Be Added to "&$SCORES[2][1]&"'s Score","","",250,150)
    If @error=1 then Resume()
    $SCORES[2][0]=$SCORES[2][0]+$SCO
    $TURNS=$TURNS+1
    $HIST[$TURNS][0]=$SCORES[2][1]
    $HIST[$TURNS][1]=$SCO
    $HIST[$TURNS][2]=$SCORES[2][0]
    CARD()
EndFunc
Func Score3()
    $SCO=InputBox($BUILD,"How Many Points Are To Be Added to "&$SCORES[3][1]&"'s Score","","",250,150)
    If @error=1 then Resume()
    $SCORES[3][0]=$SCORES[3][0]+$SCO
    $TURNS=$TURNS+1
    $HIST[$TURNS][0]=$SCORES[3][1]
    $HIST[$TURNS][1]=$SCO
    $HIST[$TURNS][2]=$SCORES[3][0]
    CARD()
EndFunc
Func Score4()
    $SCO=InputBox($BUILD,"How Many Points Are To Be Added to "&$SCORES[4][1]&"'s Score","","",250,150)
    If @error=1 then Resume()
    $SCORES[4][0]=$SCORES[4][0]+$SCO
    $TURNS=$TURNS+1
    $HIST[$TURNS][0]=$SCORES[4][1]
    $HIST[$TURNS][1]=$SCO
    $HIST[$TURNS][2]=$SCORES[4][0]
    CARD()
EndFunc
Func Score5()
    $SCO=InputBox($BUILD,"How Many Points Are To Be Added to "&$SCORES[5][1]&"'s Score","","",250,150)
    If @error=1 then Resume()
    $SCORES[5][0]=$SCORES[5][0]+$SCO
    $TURNS=$TURNS+1
    $HIST[$TURNS][0]=$SCORES[5][1]
    $HIST[$TURNS][1]=$SCO
    $HIST[$TURNS][2]=$SCORES[5][0]
    CARD()
EndFunc
Func Score6()
    $SCO=InputBox($BUILD,"How Many Points Are To Be Added to "&$SCORES[6][1]&"'s Score","","",250,150)
    If @error=1 then Resume()
    $SCORES[6][0]=$SCORES[6][0]+$SCO
    $TURNS=$TURNS+1
    $HIST[$TURNS][0]=$SCORES[6][1]
    $HIST[$TURNS][1]=$SCO
    $HIST[$TURNS][2]=$SCORES[6][0]
    CARD()
EndFunc
Func Score7()
    $SCO=InputBox($BUILD,"How Many Points Are To Be Added to "&$SCORES[7][1]&"'s Score","","",250,150)
    If @error=1 then Resume()
    $SCORES[7][0]=$SCORES[7][0]+$SCO
    $TURNS=$TURNS+1
    $HIST[$TURNS][0]=$SCORES[7][1]
    $HIST[$TURNS][1]=$SCO
    $HIST[$TURNS][2]=$SCORES[7][0]
    CARD()
EndFunc
Func Score8()
    $SCO=InputBox($BUILD,"How Many Points Are To Be Added to "&$SCORES[8][1]&"'s Score","","",250,150)
    If @error=1 then Resume()
    $SCORES[8][0]=$SCORES[8][0]+$SCO
    $TURNS=$TURNS+1
    $HIST[$TURNS][0]=$SCORES[8][1]
    $HIST[$TURNS][1]=$SCO
    $HIST[$TURNS][2]=$SCORES[8][0]
    CARD()
EndFunc
;       START/RESET TIMER
Func PreTimer()
    $R=0
    Timer()
EndFunc
;       BEGIN TIMER FROM $R
Func Timer()
    If $R>0 Then Resume()
    ProgressOn($BUILD,$RT/60&" Minutes ("&$RT&") Seconds","0 Elapsed    "&$RT&" Remaining",-1,$H+200,2)
for $E= 1 to $RT step 1
    If $RT-$E>9 then sleep(1000)
    If $RT-$E=60 Then Beep(1500,500)
    If $RT-$E=9 Then Beep(1100,200)
        If $RT-$E=9 Then Sleep(800)
    If $RT-$E=8 Then Beep(1200,200)
        If $RT-$E=8 Then Sleep(800)
    If $RT-$E=7 Then Beep(1300,200)
        If $RT-$E=7 Then Sleep(800)
    If $RT-$E=6 Then Beep(1400,200)
        If $RT-$E=6 Then Sleep(800)
    If $RT-$E=5 Then Beep(1500,200)
        If $RT-$E=5 Then Sleep(800)
    If $RT-$E=4 Then Beep(1600,200)
        If $RT-$E=4 Then Sleep(800)
    If $RT-$E=3 Then Beep(1700,200)
        If $RT-$E=3 Then Sleep(800)
    If $RT-$E=2 Then Beep(1800,200)
        If $RT-$E=2 Then Sleep(800)
    If $RT-$E=1 Then Beep(1900,200)
        If $RT-$E=1 Then Sleep(800)
    ProgressSet(100/$RT*$E,$E&" Elapsed "&$RT-$E&" Remaining")
    global $R=$E
Next
    if $RT>0 Then ProgressSet(100,$RT-1&" Elapsed   1 Remaining")
    if $RT>0 Then Beep(2000,1000)
    if $RT>0 Then ProgressSet(100,"PLAYER HAS TIMED OUT")
    if $RT>0 Then MsgBox(0,$BUILD,"Player Has Timed Out")
    ProgressOff()
    global $R=0
    Active()
EndFunc 
;       CONTINUE TIMER AFTER CANCELED SCORE
func Resume()
    IF $RT=0 Then CARD()
    $A=$R
    ProgressOn($BUILD,$RT/60&" Minutes ("&$RT&") Seconds",$A&" Elapsed  "&$RT-$A&" Remaining",-1,$H+200,2)
For $E= 1+$A to $RT step 1
    If $RT-$E>9 then sleep(1000)
    If $RT-$E=60 Then Beep(1500,500)
    If $RT-$E=9 Then Beep(1100,200)
        If $RT-$E=9 Then Sleep(800)
    If $RT-$E=8 Then Beep(1200,200)
        If $RT-$E=8 Then Sleep(800)
    If $RT-$E=7 Then Beep(1300,200)
        If $RT-$E=7 Then Sleep(800)
    If $RT-$E=6 Then Beep(1400,200)
        If $RT-$E=6 Then Sleep(800)
    If $RT-$E=5 Then Beep(1500,200)
        If $RT-$E=5 Then Sleep(800)
    If $RT-$E=4 Then Beep(1600,200)
        If $RT-$E=4 Then Sleep(800)
    If $RT-$E=3 Then Beep(1700,200)
        If $RT-$E=3 Then Sleep(800)
    If $RT-$E=2 Then Beep(1800,200)
        If $RT-$E=2 Then Sleep(800)
    If $RT-$E=1 Then Beep(1900,200)
        If $RT-$E=1 Then Sleep(800)
    ProgressSet(100/$RT*$E,$E&" Elapsed "&$RT-$E&" Remaining")
    global $R=$E
Next
    if $RT>0 Then ProgressSet(100,$RT-1&" Elapsed   1 Remaining")
    if $RT>0 Then Beep(2000,1000)
    if $RT>0 Then ProgressSet(100,"PLAYER HAS TIMED OUT")
    if $RT>0 Then MsgBox(0,$BUILD,"Player Has Timed Out")
    ProgressOff()
    global $R=0
Active()
EndFunc
;       END GAME
Func EndGame()
    $CHECK=MsgBox(52,$BUILD,"Are You Sure You Want To End The Game")
    If $CHECK=7 then Resume ()
    $TURNS=$TURNS+1
    $HIST[$TURNS][1]="END GAME"
    ProgressOff()
    $WIN="TIE GAME"
    if $SCORES[3][1]="" Then $SCORES[3][0]=-1
    if $SCORES[4][1]="" Then $SCORES[4][0]=-1
    if $SCORES[5][1]="" Then $SCORES[5][0]=-1
    if $SCORES[6][1]="" Then $SCORES[6][0]=-1
    if $SCORES[7][1]="" Then $SCORES[7][0]=-1
    if $SCORES[8][1]="" Then $SCORES[8][0]=-1 
    _ArraySort($SCORES,1)
    if $SCORES[1][0]=$SCORES[2][0] Then SplashTextOn($BUILD,"TIE GAME",-1,-1,-1,-1,34,"impact",72,500)
    if $SCORES[1][0]=$SCORES[2][0] Then MyExit()
    SplashTextOn($BUILD,"WINNER"&@CRLF&$SCORES[1][1]&@CRLF&@CRLF&"2nd  "&$SCORES[2][1],-1,-1,-1,-1,34,"impact",48,500)
Sleep(5000)
MyExit()
EndFunc
;       PAUSE TIMER
Func Pause()
    If $R>0 Then MsgBox(0,$BUILD,"PAUSED, Press 'Ok' To Continue")
    Resume()
EndFunc
;       EXIT/RESTART
Func MyExit()
    $END=MsgBox(4,$BUILD,"Do You Want To Return To The Scorecard")  
    If $END=6 Then ProgressOff()
    If $END=6 Then $RT=0
    If $END=6 Then  CARD()
    $SCORES=$COPY
    $EXIT=MsgBox(36,$BUILD,"Do You Want To Play Again?")
    If $EXIT=7 then Exit
    $TURNS=$TURNS+1
    $HIST[$TURNS][1]="NEW GAME"
    If $EXIT=6 Then CARD()
    If $EXIT=7 then Exit
EndFunc
;       SHOW HISTORY
Func History()
    _ArrayDisplay($HIST,$BUILD)
EndFunc
Edited by KingBeavii

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Checkout the Help documentation on the different ways the If command can be used.

;;...
    if $RT>0 Then ProgressSet(100,$RT-1&" Elapsed   1 Remaining")
    if $RT>0 Then Beep(2000,1000)
    if $RT>0 Then ProgressSet(100,"PLAYER HAS TIMED OUT")
    if $RT>0 Then MsgBox(0,$BUILD,"Player Has Timed Out")
;;...

;;...
    if $RT>0 Then
        ProgressSet(100,$RT-1&" Elapsed   1 Remaining")
        Beep(2000,1000)
        ProgressSet(100,"PLAYER HAS TIMED OUT")
        MsgBox(0,$BUILD,"Player Has Timed Out")
    EndIf
;;...

Also check out the Select and Switch commands. It seems you could use them to to eliminate some unneeded code processing.

Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites

@MvGulik

Thanks, thats exactly the kind of response i wanted. that will make my coding so much easier to read

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  
Followers 0