############################################################################# # Lapper Arrays ############################################################################# # # This "script" is a common place to define any arrays and global # indexing variables for those arrays to help make custom scripts # more portable. The main benefit of these arrays is to save multiple calls # to external functions when creating large arrays of buttons. # ############################################################################ # Ver 1.0.0 Initial version includes arrays for: # user_array, tyre_shortname, penalty_shortname # ############################################################################ Sub OnLapperStart_LapperArray() ### Pitboard #### GlobalVar $user_array; GlobalVar $uaUserName = 1; GlobalVar $uaNumStops1 = 2; GlobalVar $uaNumStops2 = 3; GlobalVar $uaNumStops3 = 4; GlobalVar $uaNickname = 5; GlobalVar $uaStatus = 6; # Initial value for player status (0 = ready , 1 = not ready , 2 = spectator) GlobalVar $uaPitlaneExit = 7; # Initial value for pitlane exit (0 = not done , 1 = done) GlobalVar $uaStartQualify = 8; # Initial value for start qualify (0 = not done , 1 = done) GlobalVar $uaPB = 9; # Used to store the current track/car PB GlobalVar $uaPenalty = 10; # Current penalty, if any ### End ### ### Global array for tyre short names #### GlobalVar $tyre_shortnames; $tyre_shortnames[0] = "R1"; $tyre_shortnames[1] = "R2"; $tyre_shortnames[2] = "R3"; $tyre_shortnames[3] = "R4"; $tyre_shortnames[4] = "RS"; $tyre_shortnames[5] = "RN"; $tyre_shortnames[6] = "Hy"; $tyre_shortnames[7] = "Kn"; $tyre_shortnames[8] = ""; $tyre_shortnames[9] = ""; ### Global array for penalty short names #### GlobalVar $penalty_shortnames; $penalty_shortnames[0] = ""; $penalty_shortnames[1] = "DT"; $penalty_shortnames[2] = "DT"; $penalty_shortnames[3] = "SG"; $penalty_shortnames[4] = "SG"; $penalty_shortnames[5] = "30"; $penalty_shortnames[6] = "45"; $penalty_shortnames[7] = ""; EndSub Sub OnConnect_UserArray() # Player event ### Add UserName to $user_array together with $number_of_stops ### FOR ($i=1;$i<=32;$i=$i+1) IF ($user_array[$i,1] == "") THEN $user_array[$i,1] = GetCurrentPlayerVar( "UserName" ); $user_array[$i,2] = $number_of_stops_w1; $user_array[$i,3] = $number_of_stops_w2; $user_array[$i,4] = $number_of_stops_w3; $user_array[$i,5] = GetCurrentPlayerVar( "Nickname" ); # Store Nickname to be used in the !connected event $user_array[$i,6] = 1; # Initial value for player status (0 = ready , 1 = not ready , 2 = spectator) $user_array[$i,7] = 0; # Initial value for pitlane exit (0 = not done , 1 = done) $user_array[$i,8] = 0; # Initial value for start qualify (0 = not done , 1 = done) BREAK; ENDIF ENDFOR ### End ### EndSub Sub OnDisConnect_UserArray() # Player event ### Search for UserName in $user_array and erase values when found ### FOR ($i=1;$i<=32;$i=$i+1) IF ($user_array[$i,1] == GetCurrentPlayerVar( "UserName" ) ) THEN $user_array[$i,$uaUserName] = ""; $user_array[$i,2] = ""; $user_array[$i,3] = ""; $user_array[$i,4] = ""; $user_array[$i,5] = ""; $user_array[$i,6] = ""; $user_array[$i,7] = ""; $user_array[$i,8] = ""; BREAK; ENDIF ENDFOR ### End ### EndSub