Sub RR_Schedule( $KeyFlags ) $left_right=3; $top_bottom=41; ### Data League13 ### $date_array [1,1]="22-11-09"; $date_array [1,2]="06-12-09"; $date_array [1,3]="20-12-09"; $date_array [1,4]="03-01-10"; $date_array [1,5]="17-01-10"; $date_array [1,6]="31-01-10"; $date_array [1,7]="14-02-10"; $date_array [1,8]="28-02-10"; $date_array [1,9]="14-03-10"; $date_array [1,10]="28-03-10"; #$date_array [1,11]=""; #$date_array [1,12]=""; #$date_array [1,13]=""; #$date_array [1,14]=""; $time_l13="20:00 CET"; $track_schedule_array [1,1]="FE1/FE4/FE3R"; $track_schedule_array [1,2]="FE1R/FE2/FE3"; $track_schedule_array [1,3]="FE5/FE6/FE1"; $track_schedule_array [1,4]="FE2R/FE3/FE5R"; $track_schedule_array [1,5]="FE1R/FE3/FE6"; $track_schedule_array [1,6]="FE2/FE3R/FE5"; $track_schedule_array [1,7]="FE1/FE4/FE6"; $track_schedule_array [1,8]="FE6/FE2R/FE3R"; $track_schedule_array [1,9]="FE1R/FE4/FE3"; $track_schedule_array [1,10]="FE2/FE3R/FE5"; #$track_schedule_array [1,11]=""; #$track_schedule_array [1,12]=""; #$track_schedule_array [1,13]=""; #$track_schedule_array [1,14]=""; $car_array [1,1]="XRT"; $car_array [1,2]="FXO"; $car_array [1,3]="RB4"; $car_array [1,4]="FXO"; $car_array [1,5]="XRT"; $car_array [1,6]="RB4"; $car_array [1,7]="FXO"; $car_array [1,8]="XRT"; $car_array [1,9]="RB4"; $car_array [1,10]="FXO"; #$car_array [1,11]=""; #$car_array [1,12]=""; #$car_array [1,13]=""; #$car_array [1,14]=""; $laps_array [1,1]="13 per race"; $laps_array [1,2]="13 per race"; $laps_array [1,3]="13 per race"; $laps_array [1,4]="13 per race"; $laps_array [1,5]="13 per race"; $laps_array [1,6]="13 per race"; $laps_array [1,7]="13 per race"; $laps_array [1,8]="13 per race"; $laps_array [1,9]="13 per race"; $laps_array [1,10]="13 per race"; #$laps_array [1,11]=; #$laps_array [1,12]=; #$laps_array [1,13]=; #$laps_array [1,14]=; ### End ### ### Data S2 League ### $date_array [2,1]="29-11-09"; $date_array [2,2]="13-12-09"; $date_array [2,3]="10-01-10"; $date_array [2,4]="24-01-10"; $date_array [2,5]="07-02-10"; $date_array [2,6]="21-02-10"; $date_array [2,7]="07-03-10"; $date_array [2,8]="21-03-10"; $date_array [2,9]="04-04-10"; $date_array [2,10]="18-04-10"; $date_array [2,11]="02-05-10"; $date_array [2,12]="16-05-10"; #$date_array [2,13]=""; #$date_array [2,14]=""; $time_s2l="20:00 CET"; $track_schedule_array [2,1]="FE2R"; $track_schedule_array [2,2]="WE1"; $track_schedule_array [2,3]="KY2R"; $track_schedule_array [2,4]="AS1"; $track_schedule_array [2,5]="FE4"; $track_schedule_array [2,6]="AS6"; $track_schedule_array [2,7]="SO4"; $track_schedule_array [2,8]="AS4R"; $track_schedule_array [2,9]="SO1R"; $track_schedule_array [2,10]="KY3"; $track_schedule_array [2,11]="AS7R"; $track_schedule_array [2,12]="SO6"; #$track_schedule_array [2,13]=""; #$track_schedule_array [2,14]=""; $car_array [2,1]="FXO/RB4/XRT"; $car_array [2,2]="FXO/RB4/XRT"; $car_array [2,3]="FXO/RB4/XRT"; $car_array [2,4]="MRT"; $car_array [2,5]="FOX"; $car_array [2,6]="FO8"; $car_array [2,7]="UFR/XFR"; $car_array [2,8]="UFR/XFR"; $car_array [2,9]="UFR/XFR"; $car_array [2,10]="FXR/XRR/FZR"; $car_array [2,11]="FXR/XRR/FZR"; $car_array [2,12]="FXR/XRR/FZR"; #$car_array [2,13]=""; #$car_array [2,14]=""; $laps_array [2,1]="23L-1H"; $laps_array [2,2]="16L-1H"; $laps_array [2,3]="15L-1H"; $laps_array [2,4]="4x20L"; $laps_array [2,5]="12L-1H"; $laps_array [2,6]="12L-1H"; $laps_array [2,7]="18L-1H"; $laps_array [2,8]="11L-1H"; $laps_array [2,9]="39L-1H"; $laps_array [2,10]="14L-1H"; $laps_array [2,11]="17L-1H"; $laps_array [2,12]="31L-1H"; #$laps_array [2,13]=; #$laps_array [2,14]=; ### End ### ### Data ? League ### #$date_array [3,1]=""; #$date_array [3,2]=""; #$date_array [3,3]=""; #$date_array [3,4]=""; #$date_array [3,5]=""; #$date_array [3,6]=""; #$date_array [3,7]=""; #$date_array [3,8]=""; #$date_array [3,9]=""; #$date_array [3,10]=""; #$date_array [3,11]=""; #$date_array [3,12]=""; #$date_array [3,13]=""; #$date_array [3,14]=""; #$time_lem="20:15 CEST"; #$track_schedule_array [3,1]=""; #$track_schedule_array [3,2]=""; #$track_schedule_array [3,3]=""; #$track_schedule_array [3,4]=""; #$track_schedule_array [3,5]=""; #$track_schedule_array [3,6]=""; #$track_schedule_array [3,7]=""; #$track_schedule_array [3,8]=""; #$track_schedule_array [3,9]=""; #$track_schedule_array [3,10]=""; #$track_schedule_array [3,11]=""; #$track_schedule_array [3,12]=""; #$track_schedule_array [3,13]=""; #$track_schedule_array [3,14]=""; #$car_array [3,1]=""; #$car_array [3,2]=""; #$car_array [3,3]=""; #$car_array [3,4]=""; #$car_array [3,5]=""; #$car_array [3,6]=""; #$car_array [3,7]=""; #$car_array [3,8]=""; #$car_array [3,9]=""; #$car_array [3,10]=""; #$car_array [3,11]=""; #$car_array [3,12]=""; #$car_array [3,13]=""; #$car_array [3,14]=""; #$laps_array [3,1]=""; #$laps_array [3,2]=""; #$laps_array [3,3]=""; #$laps_array [3,4]=""; #$laps_array [3,5]=""; #$laps_array [3,6]=""; #$laps_array [3,7]=""; #$laps_array [3,8]=""; #$laps_array [3,9]=""; #$laps_array [3,10]=""; #$laps_array [3,11]=""; #$laps_array [3,12]=""; #$laps_array [3,13]=""; #$laps_array [3,14]=""; ### End ### ### Get current date, set substrings for year/month/day ### $CurrDate = getLapperVar( "ShortDate" ); $Year = subStr( $CurrDate, 6, 2); $Month = subStr( $CurrDate, 3 , 2); $Day = subStr( $CurrDate, 0 , 2); ### End ### ### Open backgroud, title button, leaguename buttons ### openPrivButton( "schedule_bg",$left_right,$top_bottom,193,102,0,-1,16,"" ); openPrivButton( "schedule_title",$left_right+1,$top_bottom+1,191,5,0,-1,32,"^7Scheduled races for ^1Revolution Racing" ); openPrivButton( "schedule_title_s2l",$left_right+1,$top_bottom+11,67,5,0,-1,32,"^7League13" ); openPrivButton( "schedule_title_for",$left_right+68,$top_bottom+11,62,5,0,-1,32,"^7S2 League" ); openPrivButton( "schedule_title_end",$left_right+130,$top_bottom+11,62,5,0,-1,32,"^7" ); ### End ### FOR ($i=1;$i<=3;$i=$i+1) ### Set start value top-bottom coordinate, set $check_next_race value ### $top_bottom=57; $check_next_race = "false"; ### End ### ### Set number of race of each League ### IF ($i == 1) THEN $nbr_races=10; # Number of race League 1 ELSE IF ($i == 2) THEN $nbr_races=12; # Number of race League 2 ELSE IF ($i == 3) THEN $nbr_races=0; # Number of race League 3 ENDIF ENDIF ENDIF ### End ### ### Draw buttons with racenumbers ### IF ($i == 1) THEN openPrivButton( "schedule_nr_" . $i,$left_right+1,$top_bottom,5,5,0,-1,32,"^2Nr" ); $top_bottom_nr=$top_bottom; FOR ($k=1;$k<=14;$k=$k+1) $number=$k; IF ($number < 10) THEN $number="0" . $number; ENDIF $top_bottom_nr=$top_bottom_nr+5; openPrivButton( "schedule_race_" . $i . $k,$left_right+1,$top_bottom_nr,5,5,0,-1,32,"^7" . $number ); ENDFOR ENDIF ### End ### ### Draw buttons with column titles ### openPrivButton( "schedule_date/time_" . $i,$left_right+6,$top_bottom,24,5,0,-1,96,"^2Date - Time" ); openPrivButton( "schedule_track/car_" . $i,$left_right+30,$top_bottom,25,5,0,-1,96,"^2Track(s) - Car(s)" ); openPrivButton( "schedule_lap_" . $i,$left_right+55,$top_bottom,13,5,0,-1,96,"^2Laps" ); ### End ### ### Raise top_bottom value by 5 ### $top_bottom=$top_bottom+5; ### End ### ### Draw buttons for each League ### FOR ($j=1;$j<=$nbr_races;$j=$j+1) ### Set Year, Month, Day again in case it has been changed by the next year check $Year = subStr( $CurrDate, 6, 2); $Month = subStr( $CurrDate, 3 , 2); $Day = subStr( $CurrDate, 0 , 2); ### End ### ### Get values for year/month/day from the actual event date ### $Year_2 = subStr( $date_array[$i,$j], 6, 2); $Month_2 = subStr( $date_array[$i,$j], 3 , 2); $Day_2 = subStr( $date_array[$i,$j], 0 , 2); ### End ### ### Determine if race is in the past, will be next or will be in the future ### IF ($Year_2 == $Year && $Month_2 == $Month && $Day_2 == $Day) THEN $color="^3"; IF ($check_next_race == "false") THEN $check_next_race="true"; ENDIF ELSE IF ($Year_2 == $Year && $Month_2 == $Month && $Day_2 > $Day) THEN IF ($check_next_race == "false") THEN $color="^3"; $check_next_race="true"; ELSE $color="^7"; ENDIF ELSE IF ($Year_2 == $Year && $Month_2 > $Month) THEN IF ($check_next_race == "false") THEN $color="^3"; $check_next_race="true"; ELSE $color="^7"; ENDIF ELSE IF ($Year_2 > $Year) THEN $color="^7"; ELSE $color="^8"; ENDIF ENDIF ENDIF ENDIF ### End ### ### Special case to see weather the next race is scheduled in the next year while current year hasn't ended IF ($check_next_race == "false") THEN IF ($Year_2 > $Year) THEN $Year=$Year+1; $Month="01"; $Day=1; ### Determine if race is in the past, will be next or will be in the future ### IF ($Year_2 == $Year && $Month_2 == $Month && $Day_2 == $Day) THEN $color="^3"; IF ($check_next_race == "false") THEN $check_next_race="true"; ENDIF ELSE IF ($Year_2 == $Year && $Month_2 == $Month && $Day_2 > $Day) THEN IF ($check_next_race == "false") THEN $color="^3"; $check_next_race="true"; ELSE $color="^7"; ENDIF ELSE IF ($Year_2 == $Year && $Month_2 > $Month) THEN IF ($check_next_race == "false") THEN $color="^3"; $check_next_race="true"; ELSE $color="^7"; ENDIF ELSE IF ($Year_2 > $Year) THEN $color="^7"; ELSE $color="^8"; ENDIF ENDIF ENDIF ENDIF ### End ### ENDIF ENDIF ### End ### ### Draw actual event buttons for each League ### IF ($i == 1) THEN openPrivButton( "schedule_race_" . $i . $j . "_date/time",$left_right+6,$top_bottom,24,5,0,-1,96,$color . $date_array[$i,$j] . " - " . $time_l13 ); ELSE IF ($i == 2) THEN openPrivButton( "schedule_race_" . $i . $j . "_date/time",$left_right+6,$top_bottom,24,5,0,-1,96,$color . $date_array[$i,$j] . " - " . $time_s2l ); ELSE IF ($i == 3) THEN openPrivButton( "schedule_race_" . $i . $j . "_date/time",$left_right+6,$top_bottom,24,5,0,-1,96,$color . $date_array[$i,$j] . " - " . $time_lem ); ENDIF ENDIF ENDIF openPrivButton( "schedule_race_" . $i . $j . "_track/car",$left_right+30,$top_bottom,25,5,0,-1,96,$color . $track_schedule_array[$i,$j] . " - " . $car_array[$i,$j] ); openPrivButton( "schedule_race_" . $i . $j . "_laps",$left_right+55,$top_bottom,13,5,0,-1,96,$color . $laps_array[$i,$j] ); ### End ### ### Raise top_bottom value by 5, so every event has own row ### $top_bottom=$top_bottom+5; ### End ### ENDFOR ### Set new left_right coordinate after drawing League 1 and 2 IF ($i == 1) THEN $left_right=65; ELSE IF ($i == 2) THEN $left_right=127; ENDIF ENDIF ### End ### ENDFOR ### Set new left_right and top_bottom coordinate and draw close button $left_right=3; $top_bottom=41; openPrivButton( "schedule_race_close",$left_right+1,$top_bottom+96,191,5,0,-1,32,"^3Close",close_schedule_rr ); ### End ### EndSub Sub close_schedule_rr( $KeyFlags,$id ) closePrivButton("schedule_bg&schedule_title&schedule_title_s2l&schedule_title_for&schedule_title_end&schedule_race_close"); FOR ($i=1;$i<=3;$i=$i+1) IF ($i == 1) THEN $nbr_races=10; ELSE IF ($i == 2) THEN $nbr_races=12; ELSE IF ($i == 3) THEN $nbr_races=0; ENDIF ENDIF ENDIF IF ($i == 1) THEN closePrivButton( "schedule_nr_" . $i ); FOR ($k=1;$k<=14;$k=$k+1) closePrivButton( "schedule_race_" . $i . $k ); ENDFOR ENDIF closePrivButton( "schedule_date/time_" . $i ); closePrivButton( "schedule_track/car_" . $i ); closePrivButton( "schedule_lap_" . $i ); FOR ($j=1;$j<=$nbr_races;$j=$j+1) closePrivButton( "schedule_race_" . $i . $j . "_date/time" ); closePrivButton( "schedule_race_" . $i . $j . "_track/car" ); closePrivButton( "schedule_race_" . $i . $j . "_laps" ); ENDFOR ENDFOR EndSub