I have modified Tims points system code to save data in a monthly set and now have some basic questions I would like to ask.
This records data into monthly results , year by year. ie. This months users total race points data is saved under the key "October 2010" for each user.
When your finished laughing at my messy, long winded way of doing it try to answer my questions
If your wondering why I didn't just use Longdate and reformat it to show MMM/YYYY , it is because I still wanted the whole date to show on Tims race results button and I couln't seem to set differing formats for LongDate in the script for different occasions.
I have been using:
To show this months leaderboard.
I would like to know ,
1. what does $argv actually mean/do?
2. How could I extract just the top 3 drivers each month? (So the top 3 drivers of last month can be announced on lapper start)
3. Is there a script method to delete all rows of a certain key type from the storedvalue.dbs file?
ie. to delete all previous months entries.
<?php
Event OnResult( $userName,$flagConfirm ) # Player event
$month = getLapperVar("ShortDate"); # Get date in dd/mm/yyyy format
$datestrip = substr( $month,3,2 ); # Strip the month from the short date
$year = substr( $month,6,4 ); # Find the year
IF ( $datestrip == "01" ) THEN $newmonth = "January" ; # Start checking short month cycle and turn result into long month
ELSE
IF ( $datestrip == "02" ) THEN $newmonth = "February" ; #
ELSE
IF ( $datestrip == "03" ) THEN $newmonth = "March" ;
ELSE
IF ( $datestrip == "04" ) THEN $newmonth = "April" ;
ELSE
IF ( $datestrip == "05" ) THEN $newmonth = "May" ;
ELSE
IF ( $datestrip == "06" ) THEN $newmonth = "June" ;
ELSE
IF ( $datestrip == "07" ) THEN $newmonth = "July" ;
ELSE
IF ( $datestrip == "08" ) THEN $newmonth = "August" ;
ELSE
IF ( $datestrip == "09" ) THEN $newmonth = "September" ;
ELSE
IF ( $datestrip == "10" ) THEN $newmonth = "October" ;
ELSE
IF ( $datestrip == "11" ) THEN $newmonth = "November" ;
ELSE
IF ( $datestrip == "12" ) THEN $newmonth = "December" ;
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
$champs = ( $newmonth . " " . $year ); # Create a var $champs to hold current month and year
$Username = GetCurrentPlayerVar( "Username" );
SetCurrentPlayerVar( "ps_race_points",(($ps_max_points+1) - GetCurrentPlayerVar( "FinishedPos" ) ) );
SetCurrentPlayerVar( $champs,getUserStoredValue( $champs ) );
IF( GetCurrentPlayerVar( $champs ) == "" )
THEN
SetCurrentPlayerVar( $champs,"0" );
ENDIF
IF( ToNum(GetCurrentPlayerVar( "ps_race_points" )) < 1 )
THEN
SetCurrentPlayerVar( "ps_race_points",0 );
ENDIF
SWITCH( GetCurrentPlayerVar("FinishedPos") ) # variable for race finish order
CASE 1:
IF(( $flagConfirm == 2 )||( $flagConfirm == 18 )||( $flagConfirm == 34 ))
THEN
openGlobalButton( "point900",$point_L,$point_T-4,40,4,4,-1,96,"^7 Race on ^3" . getLapperVar("LongDate") . " @ " . getLapperVar("LongTime") );
openGlobalButton( "point910",$point_L+40,$point_T-4,6,4,4,-1,96,"^7points" );
openGlobalButton( "point001",$point_L,$point_T,40,4,4,-1,96,"^7 1 : " . GetCurrentPlayerVar("NickName") );
openGlobalButton( "point101",$point_L+40,$point_T,6,4,4,-1,32,"^3" . GetCurrentPlayerVar( "ps_race_points" ) );
ENDIF
BREAK;
...
etc
....
CASE 12:
IF(( $flagConfirm == 2 )||( $flagConfirm == 18 )||( $flagConfirm == 34 ))
THEN
openGlobalButton( "point012",$point_L,$point_T+44,40,4,4,-1,96,"^712 : " . GetCurrentPlayerVar("NickName") );
openGlobalButton( "point112",$point_L+40,$point_T+44,6,4,4,-1,32,"^3" . GetCurrentPlayerVar( "ps_race_points" ) );
ENDIF
BREAK;
DEFAULT: # If no value match then do this (in this case, do nothing)
BREAK;
ENDSWITCH
SetCurrentPlayerVar( $champs,ToNum(GetCurrentPlayerVar( $champs ))+ GetCurrentPlayerVar( "ps_race_points" ) );
setUserStoredValue( $champs, GetCurrentPlayerVar( $champs ) );
?>
When your finished laughing at my messy, long winded way of doing it try to answer my questions
If your wondering why I didn't just use Longdate and reformat it to show MMM/YYYY , it is because I still wanted the whole date to show on Tims race results button and I couln't seem to set differing formats for LongDate in the script for different occasions.
I have been using:
<?php
topUser( $champs,$champs,"DESC",$argv );
?>
I would like to know ,
1. what does $argv actually mean/do?
2. How could I extract just the top 3 drivers each month? (So the top 3 drivers of last month can be announced on lapper start)
3. Is there a script method to delete all rows of a certain key type from the storedvalue.dbs file?
ie. to delete all previous months entries.