Monthly championship results.
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.


<?php 
Event OnResult
$userName,$flagConfirm # Player event
  
$month getLapperVar("ShortDate");  # Get date in dd/mm/yyyy format
  
$datestrip substr$month,3,);   # Strip the month from the short date
  
$year substr$month,6,);        # 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" )) < )
  
THEN
    SetCurrentPlayerVar
"ps_race_points",);
  ENDIF
SWITCH( 
GetCurrentPlayerVar("FinishedPos") )   # variable for race finish order
  
CASE 1:
   IF(( 
$flagConfirm == )||( $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 == )||( $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$champsGetCurrentPlayerVar$champs ) );
?>

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:

<?php 
topUser
$champs,$champs,"DESC",$argv );
?>

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.
Quote from Austin Hedley :
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.

Hi,

1: I dont know.
2: I dont think its posible. topuser and nearuser are hardcoded to show the top 18 and your place in the database white 8 places above and 9 places below your points.
3: You can manualy delete entries in the database by using a sqlite-manager like the free one for Firefox http://code.google.com/p/sqlite-manager/

I think its more easy to use for the key in database Year_Month_Day
Then its more to find and delete the old months in the database.

topUser( title,key,DESC,argv );

key="2010_october_01%" // Find result for all races on october 01 2010
key="2010_october%" // Find result for all races in october 2010
key="2010%" // Find result for all races in 2010
key="%" // All cumulated result
#3 - Krayy
1. argv is the rest of the command line that comes after the actual Lapper command. e.g. with the command "!top xfg", argv would equal "xfg", with "!msg I'm a coconut" argv would de "I'm a coconut" and would be used in the !msg command

2. Depends on how you've stored the data. Your problem will be looping through 200 (or however many racers you have) records to sort out the top 3. One way around this is to store a comma delimited list of results in a single database entry then use SplitToArray to split them into an array (god, I KILL me :spin and then process them from there. Psuedo code:
OnLapperStart
GetStoredValue("top5")
$TOP5 = SplitTOArray( GetStoredValue("top5") , "," );
privmsg("Top racer is " . $TOP5[0]);
...

I'll expand on this later on,

This goes back to the discussion that was going on about a common points system for Lapper which has sort of defaulted to Tim's system. It's a good start, although it's fairly basic at the moment. The codes a bit gnarly too, although a rewrite of some of it to use shorter loops and arrays for lookups etc could go a long way. Storing the data and reporting on it is another thing that would need looking at, and if we could come up with a good design document for the scoring system which goes into what functionality you would need, then I don't see any reason why the Top system couldn't be expanded to support race points, drift points etc.

So to throw the cat amongst the pigeons, what exactly do we need a points system to do?
Quote from Austin Hedley :

<?php 
Event OnResult
$userName,$flagConfirm # Player event
  
$month getLapperVar("ShortDate");  # Get date in dd/mm/yyyy format
  
$datestrip substr$month,3,);   # Strip the month from the short date
  
$year substr$month,6,);        # 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" )) < )
  
THEN
    SetCurrentPlayerVar
"ps_race_points",);
  ENDIF
SWITCH( 
GetCurrentPlayerVar("FinishedPos") )   # variable for race finish order
  
CASE 1:
   IF(( 
$flagConfirm == )||( $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 == )||( $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$champsGetCurrentPlayerVar$champs ) );
?>


What is this written in?


<?php 
Event OnResult
($userName$flagConfirm)    # Player event
    
$date getLapperVar("ShortDate");    # Get date in dd/mm/yyyy format
    
$month substr($date32);        # Strip the month from the short date
    
$year substr($date64);        # Find the year
    
SWITCH ($month)
        CASE 
"01":
            
$newmonth "January";
            BREAK;
        CASE 
"02":
            
$newmonth "February";
            BREAK;
        CASE 
"03":
            
$newmonth "March";
            BREAK;
        CASE 
"04":
            
$newmonth "April";
            BREAK;
        CASE 
"05":
            
$newmonth "May";
            BREAK;
        CASE 
"06":
            
$newmonth "June";
            BREAK;
        CASE 
"07":
            
$newmonth "July";
            BREAK;
        CASE 
"08":
            
$newmonth "August";
            BREAK;
        CASE 
"09":
            
$newmonth "September";
            BREAK;
        CASE 
"10":
            
$newmonth "October";
            BREAK;
        CASE 
"11":
            
$newmonth "November";
            BREAK;
        CASE 
"12":
            
$newmonth "December";
            BREAK;
    ENDSWITCH
    
$champs $newmonth " " $year;
    
SetCurrentPlayerVar("ps_race_points", ($ps_max_points 1) - GetCurrentPlayerVar("FinishedPos"));
    
SetCurrentPlayerVar($champsgetUserStoredValue($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 == || $flagConfirm == 18 || $flagConfirm == 34)
            
THEN
                openGlobalButton
("point900"$point_L$point_T 44044, -196"^7 Race on ^3" getLapperVar("LongDate") . " @ " getLapperVar("LongTime"));
                
openGlobalButton("point910"$point_L 40$point_T 4644, -196"^7points");
                
openGlobalButton("point001"$point_L$point_T4044, -196"^7 1 : " GetCurrentPlayerVar("NickName"));
                
openGlobalButton("point101"$point_L 40$point_T644, -132"^3" GetCurrentPlayerVar("ps_race_points"));
            ENDIF
        BREAK;
# ...

# ...
        
CASE 12:
            IF(
$flagConfirm == || $flagConfirm == 18 || $flagConfirm == 34)
            
THEN
                openGlobalButton
("point012"$point_L$point_T 444044, -196"^712 : " GetCurrentPlayerVar("NickName"));
                
openGlobalButton("point112"$point_L 40$point_T 44644, -132"^3" GetCurrentPlayerVar("ps_race_points"));
            ENDIF
        BREAK;
        DEFAULT:
            
# We do nothing.
        
BREAK;
    ENDSWITCH
    
SetCurrentPlayerVar($champsToNum(GetCurrentPlayerVar($champs)) + GetCurrentPlayerVar("ps_race_points"));
    
setUserStoredValue($champsGetCurrentPlayerVar($champs));
?>

Quote from Dygear :What is this written in?

It is written in Austins tenuous grasp of GLScript

Thanks for the suggestions guys. I can see now how to tidy up some the code I had made. Plenty of food for thought.
Unfortunately I have major eye surgery tomorrow and will be unable to look at a pc screen for 2-3 weeks at least. I'm sure when I get back online I will have some fresh code to look through and some exciting new questions

Regarding the points system, my own needs were quite simple, I wanted a monthly points challenge , solely based on one track one car (initially for the GLScript learning experience on our demo server). Now this is nearly complete I am starting to think about how to expand it for our S2 server. A rewards system immediately comes to mind, maybe allowing alternate cars/tracks/championships. The accumulated points could be used as a skill level indicator to keep different experience levels in graded championships. I know this is a fairly simplistic view of skill but accumulating points should, in theory, reflect the users effort and increasing ability.

Now would be a good time for others to suggest ideas for the points system, so it can all be incorporated into a flexible system.

Good luck with the CIF Krayy, and huge thanks to all of you willing to help/put up with, a clueless newbie.
Quote from DarkTimes :I think it's GLScript.

Thank you.

Quote from Austin Hedley :It is written in Austins tenuous grasp of GLScript

And thank you.

Quote from Austin Hedley :Thanks for the suggestions guys. I can see now how to tidy up some the code I had made. Plenty of food for thought.

No problem, I would love to see the rest of that SWITCH block that you have, because I'm pretty sure it can be made more general ...

Quote from Austin Hedley :Unfortunately I have major eye surgery tomorrow and will be unable to look at a pc screen for 2-3 weeks at least. I'm sure when I get back online I will have some fresh code to look through and some exciting new questions

Wow, dude, good luck! I want Lasix as I ware glasses, but that shit scares me.

[edit]

Just read over the GLScript Wiki and there are some things that I don't like about it, like it being very strict when it comes to parsing the source file. But it offers some interesting ideas and insights. I wonder what it's like to implement within a C/C++ application with these as plugins. I was thinking myself of using PAWN or Source:PAWN as the basis for the plugins of a C++ version of PRISM.
Quote from Dygear :I would love to see the rest of that SWITCH block that you have, because I'm pretty sure it can be made more general ...

It is Tims code I believe. There may be a bit of sinanjus in there also


<?php 
SWITCH( GetCurrentPlayerVar("FinishedPos") )   # variable for race finish order
  
CASE 1:
   IF(( 
$flagConfirm == )||( $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; 
  CASE 
2:
     IF(( 
$flagConfirm == )||( $flagConfirm == 18 )||( $flagConfirm == 34 ))
   
THEN
      openGlobalButton
"point002",$point_L,$point_T+4,40,4,4,-1,96,"^7 2 : " GetCurrentPlayerVar("NickName") );
      
openGlobalButton"point102",$point_L+40,$point_T+4,6,4,4,-1,32,"^3" GetCurrentPlayerVar"ps_race_points" ) ); 
  ENDIF
  BREAK;
  CASE 
3:
     IF(( 
$flagConfirm == )||( $flagConfirm == 18 )||( $flagConfirm == 34 ))
   
THEN
      openGlobalButton
"point003",$point_L,$point_T+8,40,4,4,-1,96,"^7 3 : " GetCurrentPlayerVar("NickName") );
      
openGlobalButton"point103",$point_L+40,$point_T+8,6,4,4,-1,32,"^3" GetCurrentPlayerVar"ps_race_points" ) ); 
  ENDIF
  BREAK;
  CASE 
4:
     IF(( 
$flagConfirm == )||( $flagConfirm == 18 )||( $flagConfirm == 34 ))
   
THEN
      openGlobalButton
"point004",$point_L,$point_T+12,40,4,4,-1,96,"^7 4 : " GetCurrentPlayerVar("NickName") );
      
openGlobalButton"point104",$point_L+40,$point_T+12,6,4,4,-1,32,"^3" GetCurrentPlayerVar"ps_race_points" ) ); 
  ENDIF
  BREAK;
  CASE 
5:
     IF(( 
$flagConfirm == )||( $flagConfirm == 18 )||( $flagConfirm == 34 ))
   
THEN
      openGlobalButton
"point005",$point_L,$point_T+16,40,4,4,-1,96,"^7 5 : " GetCurrentPlayerVar("NickName") );
      
openGlobalButton"point105",$point_L+40,$point_T+16,6,4,4,-1,32,"^3" GetCurrentPlayerVar"ps_race_points" ) ); 
  ENDIF
  BREAK;
  CASE 
6:
    IF(( 
$flagConfirm == )||( $flagConfirm == 18 )||( $flagConfirm == 34 ))
    
THEN 
      openGlobalButton
"point006",$point_L,$point_T+20,40,4,4,-1,96,"^7 6 : " GetCurrentPlayerVar("NickName") );
      
openGlobalButton"point106",$point_L+40,$point_T+20,6,4,4,-1,32,"^3" GetCurrentPlayerVar"ps_race_points" ) ); 
    ENDIF
    BREAK;
  CASE 
7:
    IF(( 
$flagConfirm == )||( $flagConfirm == 18 )||( $flagConfirm == 34 ))
    
THEN 
      openGlobalButton
"point007",$point_L,$point_T+24,40,4,4,-1,96,"^7 7 : " GetCurrentPlayerVar("NickName") );
      
openGlobalButton"point107",$point_L+40,$point_T+24,6,4,4,-1,32,"^3" GetCurrentPlayerVar"ps_race_points" ) ); 
    ENDIF
    BREAK;
  CASE 
8:
    IF(( 
$flagConfirm == )||( $flagConfirm == 18 )||( $flagConfirm == 34 ))
    
THEN 
      openGlobalButton
"point008",$point_L,$point_T+28,40,4,4,-1,96,"^7 8 : " GetCurrentPlayerVar("NickName") );
      
openGlobalButton"point108",$point_L+40,$point_T+28,6,4,4,-1,32,"^3" GetCurrentPlayerVar"ps_race_points" ) ); 
    ENDIF
    BREAK;
  CASE 
9:
    IF(( 
$flagConfirm == )||( $flagConfirm == 18 )||( $flagConfirm == 34 ))
    
THEN 
      openGlobalButton
"point009",$point_L,$point_T+32,40,4,4,-1,96,"^7 9 : " GetCurrentPlayerVar("NickName") );
      
openGlobalButton"point109",$point_L+40,$point_T+32,6,4,4,-1,32,"^3" GetCurrentPlayerVar"ps_race_points" ) ); 
    ENDIF
    BREAK;
  CASE 
10:
    IF(( 
$flagConfirm == )||( $flagConfirm == 18 )||( $flagConfirm == 34 ))
    
THEN 
      openGlobalButton
"point010",$point_L,$point_T+36,40,4,4,-1,96,"^710 : " GetCurrentPlayerVar("NickName") );
      
openGlobalButton"point110",$point_L+40,$point_T+36,6,4,4,-1,32,"^3" GetCurrentPlayerVar"ps_race_points" ) ); 
    ENDIF
    BREAK;
  CASE 
11:
    IF(( 
$flagConfirm == )||( $flagConfirm == 18 )||( $flagConfirm == 34 ))
    
THEN 
      openGlobalButton
"point011",$point_L,$point_T+40,40,4,4,-1,96,"^711 : " GetCurrentPlayerVar("NickName") );
      
openGlobalButton"point111",$point_L+40,$point_T+40,6,4,4,-1,32,"^3" GetCurrentPlayerVar"ps_race_points" ) ); 
    ENDIF
    BREAK;
  CASE 
12:
    IF(( 
$flagConfirm == )||( $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
?>

As for the Lasix, all my problems started after having a lens transplant and laser treatment. Dont want to put anyone off thinking of having it done, but there can be repercussions later on down the road.

Also the GLScript wiki link looks like something else altogether. This GLScript is made by Gai Luron the coder of Lapper I think http://www.lfs-lapper.org/help/en/

<?php 
Event OnResult
($userName$flagConfirm)    # Player event
    
$date getLapperVar("ShortDate");    # Get date in dd/mm/yyyy format
    
$year substr($date64);        # Find the year
    
SWITCH (substr($date32))        # Strip the month from the short date
        
CASE "01"$month "January"; BREAK;
        CASE 
"02"$month "February"; BREAK;
        CASE 
"03"$month "March"; BREAK;
        CASE 
"04"$month "April"; BREAK;
        CASE 
"05"$month "May"; BREAK;
        CASE 
"06"$month "June"; BREAK;
        CASE 
"07"$month "July"; BREAK;
        CASE 
"08"$month "August"; BREAK;
        CASE 
"09"$month "September"; BREAK;
        CASE 
"10"$month "October"; BREAK;
        CASE 
"11"$month "November"; BREAK;
        CASE 
"12"$month "December"; BREAK;
    ENDSWITCH

    
$champs $month " " $year;
    
SetCurrentPlayerVar($champsgetUserStoredValue($champs));
    IF (
GetCurrentPlayerVar($champs) == ""THEN
        SetCurrentPlayerVar
($champs"0");
    ENDIF


    
$Pos GetCurrentPlayerVar("FinishedPos");
    IF ((
$Points = (($ps_max_points 1) - $Pos)) < 1THEN
        $Points 
0;
    ENDIF
    
SetCurrentPlayerVar("ps_race_points"$Points);

    
# Print Header
    
IF ($Pos == 1THEN
        openGlobalButton
("PointHeaderName"$point_L$point_T 44044, -196"^7 Race on ^3" getLapperVar("LongDate") . " @ " getLapperVar("LongTime"));
        
openGlobalButton("PointHeaderPoints"$point_L 40$point_T 4644, -196"^7points");
    ENDIF

    IF 
$flagConfirm 2 THEN # 2 means that the result is confirmed. (As CONF_CONFIRMED = 2);
        
openGlobalButton("PointBodyName" $Pos$point_L$point_T + ($Pos 4), 4044, -196"^7" $Pos " : " GetCurrentPlayerVar("NickName"));
        
openGlobalButton("PointBodyPoints" $Pos$point_L 40$point_T + ($Pos 4), 644, -132"^3" $Points);
    ENDIF
End Event
?>


That should be easier to debug, and maintain.
Quote from Dygear :That should be easier to debug, and maintain.

Use an array for the date conversion instead of huge IF loops which are inefficient and can become hard to maintain. It also means that you only need to define the months or whatever data you're using once and it can be reused any time. Also, you can use the language functiosn to make your months language specific:

This goes in utils.lpr:

<?php 
CatchEvent OnLapperStart
()
    
GlobalVar $MONTHS;
    
$MONTHS[1] = "January";
    
$MONTHS[2] = "February";
    
$MONTHS[3] = "March";
    
$MONTHS[4] = "April";
    
$MONTHS[5] = "May";
    
$MONTHS[6] = "June";
    
$MONTHS[7] = "July";
    
$MONTHS[8] = "August";
    
$MONTHS[9] = "September";
    
$MONTHS[10] = "October";
    
$MONTHS[11] = "November";
    
$MONTHS[12] = "December";
EndCatchEvent

Sub GetMonth
()
    
$date getLapperVar("ShortDate");    # Get date in dd/mm/yyyy format
    
return($MONTHS[ToNum((substr($date32)))]);        # Strip the month from the short date
EndSub
?>


Now you can get the current Month by calling that function like:

<?php 
$month 
GetMonth();
?>

This goes in whatever .lpr file you're using the function in:

<?php 
Event OnResult
($userName$flagConfirm)    # Player event
    
$date getLapperVar("ShortDate");    # Get date in dd/mm/yyyy format
    
$year substr($date64);        # Find the year
    
$month GetMonth();        # Strip the month from the short date

    
$champs $month " " $year;
    
SetCurrentPlayerVar($champsgetUserStoredValue($champs));
    IF (
GetCurrentPlayerVar($champs) == ""THEN
        SetCurrentPlayerVar
($champs"0");
    ENDIF

    
$Pos GetCurrentPlayerVar("FinishedPos");
    IF ((
$Points = (($ps_max_points 1) - $Pos)) < 1THEN
        $Points 
0;
    ENDIF
    
SetCurrentPlayerVar("ps_race_points"$Points);

    
# Print Header
    
IF ($Pos == 1THEN
        openGlobalButton
("PointHeaderName"$point_L$point_T 44044, -196"^7 Race on ^3" getLapperVar("LongDate") . " @ " getLapperVar("LongTime"));
        
openGlobalButton("PointHeaderPoints"$point_L 40$point_T 4644, -196"^7points");
    ENDIF

    IF 
$flagConfirm 2 THEN # 2 means that the result is confirmed. (As CONF_CONFIRMED = 2);
        
openGlobalButton("PointBodyName" $Pos$point_L$point_T + ($Pos 4), 4044, -196"^7" $Pos " : " GetCurrentPlayerVar("NickName"));
        
openGlobalButton("PointBodyPoints" $Pos$point_L 40$point_T + ($Pos 4), 644, -132"^3" $Points);
    ENDIF
EndEvent
?>


Last post before I go under the knife.
Tried the above code but get:-
-> Syntax error in cfg file "LFSLapper.lpr" at line #1025 suspected error in order of the operators Function 'onresult' script aborted

Which in my lapper file is this line

<?php 
 
IF $flagConfirm 2 THEN # 2 means that the result is confirmed.
?>

Not sure why this is happening.
Quote from Austin Hedley :

<?php 
 
IF $flagConfirm 2 THEN # 2 means that the result is confirmed.
?>

Not sure why this is happening.

I was hoping that GLScript would have some Bitwise operators, maybe someone with more knowledge could help with that.

You can replace that with this until then:


<?php 
IF $flagConfirm == || $flagConfirm == 18 || $flagConfirm == 34 THEN
?>


Yes, I almost murdered myself opening this thread and seeing a massive nested if.

Sometimes I wonder.
-
(Franky.S) DELETED by Gai-Luron : Swear Word
Quote from Dygear :I was hoping that GLScript would have some Bitwise operators, maybe someone with more knowledge could help with that.

You can replace that with this until then:


<?php 
IF $flagConfirm == || $flagConfirm == 18 || $flagConfirm == 34 THEN
?>



It does indeed have both Bitwise and boolean operators which are:

|| = Boolean OR
&& = Boolean AND
| = Botwise OR
& = Bitwise AND

So the shorthand for (which is incorrect btw:

<?php 
     
IF(( $flagConfirm == )||( $flagConfirm == 18 )||( $flagConfirm == 34 ))
?>

Would be:

<?php 
IF ( $flagConfirm 50 )
THEN
...
?>

There is no XOR operator though, so you'll need to fake that if you want to.
Quote from Krayy :

<?php 
IF ( $flagConfirm 50 )
?>


Ahh, I see what you did there.

For those who don't:
10000000 = 1
01000000 = 2
00100000 = 4
00010000 = 8
00001000 = 16
00000100 = 32
00000010 = 64
00000001 = 128

01000000 = 2
01001000 = 18
01000100 = 34

01001100 = 50

However, I only care about 2. Two is the confirm flag, the 18 & 34 only tell me that the client also has a penalty with their result. I don't think that matter in this case.

Quote from Franky.S :my butt hurts.

Quote from dawesdust_12 :Yes, I almost murdered myself opening this thread and seeing a massive nested if.

Thank you for that insightful comment. I'm just waiting for the ban hammer to drop on your heads so you don't randomly spam messages for no good reason.
// Confirmation flags

#define CONF_MENTIONED 1
#define CONF_CONFIRMED 2
#define CONF_PENALTY_DT 4
#define CONF_PENALTY_SG 8
#define CONF_PENALTY_30 16
#define CONF_PENALTY_45 32
#define CONF_DID_NOT_PIT 64

#define CONF_DISQ (CONF_PENALTY_DT | CONF_PENALTY_SG | CONF_DID_NOT_PIT)
#define CONF_TIME (CONF_PENALTY_30 | CONF_PENALTY_45)
Quote from DarkTimes :I think it's GLScript.

This is probably wrong GLScript.

GL is Gai-Luron, who is the LFSLapper developer.

LFSLapper (or lapper) is really a front end bit of programming which gives us non programming type people access to insim in an easier way to make up our own scripts, without having to know about UCIDS, PLIDS, etc.

Lapper comes with list of built in functions and player variables that make it fairly easy to use (download lapper and look in DOCS folder for Changes and Playervar docs to see what I mean).

Think of it like Airio, but with more freedom for the users to make their own little bits of script and to layout how we would like. Of course, some of us go a little bit mad and have almost everything (pitboard, leaderboard, winnerflags, marshall, marshall boards, driftmeter, driftskill meter, server logo, etc)!

The users of lapper range from people who don't even read the comments in the scripts, to people like me who can make scripts that basically open and close buttons (and is quite happy to use huge nested IF - ENDIF bits of code) to people like Krayy who are able to make and use arrays (arrays to me are transmitter antennae on towers and masts), etc.

Regarding the comment about penalties (...However, I only care about 2. Two is the confirm flag, the 18 & 34 only tell me that the client also has a penalty with their result. I don't think that matter in this case....), this makes a difference to how points are awarded at end of a race. If the penalties weren't used, then people who jumped the start, or didn't pit (if that was set) would likely be classed as winners and get maximum points, rather than the drivers who followed the rules and came behind the others.
OK it might not be the same language, they may just have the same name (they do look similar at a cursory glance).

Incidentally you are confusing a language with its library. When I talk about a language I'm talking about its syntax and grammar, that has nothing to do with what functions have been implemented for it.

language != library
Quote from Dygear :
Thank you for that insightful comment. I'm just waiting for the ban hammer to drop on your heads so you don't randomly spam messages for no good reason.

Mark, you may be waiting a long time. I was just commenting on the code block I saw initially.
Quote from DarkTimes :OK it might not be the same language, they may just have the same name (they do look similar at a cursory glance).

It's remarkable on how close they are tho, I find it hard to believe they are not one and the same as the syntax is about equal.

Quote from dawesdust_12 :Mark, you may be waiting a long time. I was just commenting on the code block I saw initially.

And it does not add anything to the thread, so knock it off, this is not the Off Topic forum.
Hello,

GLScript it's an invented language that builds on the syntax of many languages such as:
C, C++, C#, PHP, VB, INFORMIX and other that i have used in my life.

it has nothing to do with GLScript for creating 3D games. I did not know what language was.

In fact all languages are similar with test statements, loop statements and vars.

Gai-Luron
You made your own programming language ... Cool.

FGED GREDG RDFGDR GSFDG