The online racing simulator
[Solved] How can I do i++ function in LFSLapper
help me please, how can I do i++ function in LFSLapper.lpr file.
I need to add +1 at a certain action.
$testvar=0; //just for this example to give it any value

$testvar=$testvar+1;

Quote from Yisc[NL] :
$testvar=0; //just for this example to give it any value

$testvar=$testvar+1;


do this,but in game its not working....returned "1", perhaps i do this many times
Can you show (some) of your code please?
I'm sure I will be able to help you.
Quote from Yisc[NL] :Can you show (some) of your code please?
I'm sure I will be able to help you.

sure

$testvar=0;
Event OnCrossingChecker($userName,$Flags,$Time,$Object,$UserSpeed,$CircleIndex)
IF($Flags==0)THEN
$testvar=$testvar+1;
globalMsg($testvar);
ENDIF
Have you declared $testvar as a GlobalVar in the OnLapperStart event?
Like this:


### Declare global variables ###
GlobalVar $testvar;
### End ###

### Give global variables an empty value ###
$testvar=0;
### End ###

This way you can use the variable anywhere in your script.

*edit*

There an error in your GlobalMsg syntax as well.
That should be:


GlobalMsg ("Debug: ".$testvar);

Quote from Yisc[NL] :Have you declared $testvar as a GlobalVar in the OnLapperStart event?
Like this:


### Declare global variables ###
GlobalVar $testvar;
### End ###

### Give global variables an empty value ###
$testvar=0;
### End ###

This way you can use the variable anywhere in your script.

*edit*

There an error in your GlobalMsg syntax as well.
That should be:


GlobalMsg ("Debug: ".$testvar);


OH! thx you very muth

FGED GREDG RDFGDR GSFDG