The online racing simulator
Quote from Gai-Luron :$price["XFG"] = 1000;
$price["XRT"] = 2000;

WriteLine( "Price for XFG is " . $price["XFG"] );

ok so do i make 1 global var for $price or 1 for each $price["X"]
GlobalVar $price;

$price is one var with multiple index
Quote from Gai-Luron :GlobalVar $price;

$price is one var with multiple index

Found that out if u would like to come test my cruise insim come to my server
-
(Fire_optikz001) DELETED by Fire_optikz001
In the (not too far away) past I used the RotateEveryNbRaces var to determine the variables in a "Race x of y' display (x being the current race, y being RotateEveryNbRaces).
I've started to implement the rotation-feature again on some of my servers, also using this 'Race x of y' display again, but this doesn't work out as it did before. No matter how I try, but I always seem to end up getting an empty string when trying to use the RotateEveryNbRaces-var (and yes, it has been set in the config.. ). Was this designed to be this way, or might it be a bug? I'm using the 500servers-Lapper, which is at 5.8.4.3 at this moment.
i need to find a way so that when a user gos to buy a car it make sure he still has more then $1 after buying it if he does not have more then 1 then it wont let him buy it... what i have atm is

<?php 
                    
IF( ToNumGetCurrentPlayerVar"Cash" ) - $Price[toupper($argv)] ) >= "1" )
                
THEN
                    privmsg
"You Just Bought The " toupper($argv) . " For " $Price[toupper($argv)] . "." );
                    
SetCurrentPlayerVar"Cash"ToNumGetCurrentPlayerVar"Cash" ) - $Price[toupper($argv)] ) );
                    
SetCurrentPlayerVar"HC_" toupper($argv), "1" );    
            
SetCurrentPlayerVar"HC"ToNumGetCurrentPlayerVar"HC") + ) );
                    
privMsg"You Now Have $" GetCurrentPlayerVar"Cash" ) );
           
                             ELSE
                              
privmsg"Not Enough Cash!");  
                ENDIF 
?>

but it does not work :P
parenthesis issue Tonum apply to GetCurrentPlayerVar, not to all statement, test on num not string not "1" but 1

IF(
ToNum( GetCurrentPlayerVar( "Cash" )) - $Price[toupper($argv)] >= 1 )

Quote from Gai-Luron :parenthesis issue Tonum apply to GetCurrentPlayerVar, not to all statement, test on num not string not "1" but 1

IF(
ToNum( GetCurrentPlayerVar( "Cash" )) - $Price[toupper($argv)] >= 1 )


i just changed "1" to 1 and it worked fine :P

wouldnt it be easier for u to use [php]?
First, thanks for your hard work and dedication on lapper.

I'm using track rotation, which works great, but I want to set different race lengths (in laps) for different tracks. Just for testing I tried this:


Event OnRotateTrack() # Lapper Event
globalMsg(langEngine( "%{main_track_changed1}%") );
globalMsg(langEngine( "%{main_track_changed2}%", getLapperVar( "CurrLongRotateTrack" )));
cmdLFS( "/wind=2" );
cmdLFS( "/qual=0" );

IF( getLapperVar("ShortTrackName") == "KY2" )
THEN
cmdLFS( "/laps=50" );
ENDIF

/
EndEvent



The wind and qual statements work fine, but lapper doesn't like that IF statement where I set the laps. The program goes into standby mode when I use that. I also tried a SWITCH statement with no luck.

Any suggestions?

Thanks
Quote from Danke :First, thanks for your hard work and dedication on lapper.

I'm using track rotation, which works great, but I want to set different race lengths (in laps) for different tracks. Just for testing I tried this:

The wind and qual statements work fine, but lapper doesn't like that IF statement where I set the laps. The program goes into standby mode when I use that. I also tried a SWITCH statement with no luck.

Any suggestions?

Thanks

HI,

Your script looks fine but there is a / to many


Event OnRotateTrack() # Lapper Event
globalMsg(langEngine( "%{main_track_changed1}%") );
globalMsg(langEngine( "%{main_track_changed2}%", getLapperVar( "CurrLongRotateTrack" )));
cmdLFS( "/wind=2" );
cmdLFS( "/qual=0" );

IF( getLapperVar("ShortTrackName") == "KY2" )
THEN
cmdLFS( "/laps=50" );
ENDIF

[COLOR=red]/ #remove this one[/COLOR]
EndEvent

Quote from Tim NL :HI,

Your script looks fine but there is a / to many


Event OnRotateTrack() # Lapper Event
globalMsg(langEngine( "%{main_track_changed1}%") );
globalMsg(langEngine( "%{main_track_changed2}%", getLapperVar( "CurrLongRotateTrack" )));
cmdLFS( "/wind=2" );
cmdLFS( "/qual=0" );

IF( getLapperVar("ShortTrackName") == "KY2" )
THEN
cmdLFS( "/laps=50" );
ENDIF

[COLOR=red]/ #remove this one[/COLOR]
EndEvent


Thanks for the quick response.

I'm not sure where that extra "/" came from, but even after I took it out, lapper still goes into standby mode with that IF statement. I'm not sure what I'm doing wrong, but it's probably something silly.
Take a look in logs err file
Maybe the track is still changing and then you cant set the number of laps yet
-
(Fire_optikz001) DELETED by Fire_optikz001
Quote from Tim NL :Maybe the track is still changing and then you cant set the number of laps yet

I thought that could be a possibility, but in this case, lapper goes straight to standby mode when I reload the config with those lines.

Although if I was able to load the config, you're probably right, I might have to set a delay before setting laps.

Quote from Gai-Luron :Take a look in logs err file

I hadn't though of that, thanks. The ERR log shows an error in mscorlib. That probably points to an issue with mono. I'll check on my mono install. Thanks to both of you.
Exact at boot, LFSLapper change track, but LFS don't send the new state at this moment.
In this case the track is not set, I make a modification in LFSLapper

Download this 914 exe and replace your LFSLapper.exe. This exe enable a delay between start of LFSLapper and change track


i tested your script and now it work!

Gai-Luron
Attached files
LFSLapper.zip - 125.9 KB - 291 views
Quote from Gai-Luron :Exact at boot, LFSLapper change track, but LFS don't send the new state at this moment.
In this case the track is not set, I make a modification in LFSLapper

Download this 914 exe and replace your LFSLapper.exe. This exe enable a delay between start of LFSLapper and change track


i tested your script and now it work!

Gai-Luron

Wow that's fast work! I did get it to start and it set the laps correctly with that version.

Unfortunately that exe didn't show the initial display message, and it doesn't respond to reload commands. Plus when I issued a !stop, the lapper process on the server stopped as well. I also tried putting the lap change as a delayed command after the rotation, but that had similar effects. It could be that the exe is fine and I've messed something else up in the config in the process.

What I've done for now is to put the lap change in the race start event. That works great. I'm fine with using that method. I'll be offline for a week or so, so please don't spend any more of your valuable time on this.

Thanks again
you seem to have a 5.8 version of LFSLapper. What is your previous LFSLapper install? more change in configs files between 5.8 and 5.9. Start with a freshen release 5.9.1.3 and change the exe to 5.9.1.4

Gai-Luron
Quote from Gai-Luron :you seem to have a 5.8 version of LFSLapper. What is your previous LFSLapper install? more change in configs files between 5.8 and 5.9. Start with a freshen release 5.9.1.3 and change the exe to 5.9.1.4

Gai-Luron

You're right, I was using 5.846. When I get a chance in a few weeks I'll try with a 5.9x version.

Thanks
Is there a way lfor lapper to check wich version of lfs it is like demo s1 s2?
Hi Gai,

I have a pointdatabase in lapper 5.844 in the storedvalue.dbs
All points are stored as a integer.
When i copy this storedvalue.dbs from a lapper 5.844 into lapper 5.914 then lapper copied all values from strval into numval
So then are the points lost.

StoredValue.dbs in 5.844 fi_user_value

id key username nickname nicknameStripped numval strval
2 ps_points_total tim nl ^1[^7NLR^4]^6Tim [NLR]Tim 2961

After a start of lapper 5.914 the database is look like this. (all points are gone)
fi_user_value

id key username nickname nicknameStripped numval strval
2 ps_points_total tim nl ^1[^7NLR^4]^6Tim [NLR]Tim

Is there a easyway in SQL to copy all numval values into strval? (I use SQLite Manager in Firefox)
So when lapper startup the strval with points is then copied into numval and no points are lost.

Like:

fi_user_value

id key username nickname nicknameStripped numval strval
2 ps_points_total tim nl ^1[^7NLR^4]^6Tim [NLR]Tim 2961

So then it will look like this in 5.914
fi_user_value

id key username nickname nicknameStripped numval strval
2 ps_points_total tim nl ^1[^7NLR^4]^6Tim [NLR]Tim 2961 2961

What is it?

I do nothing on stored dbs in 9.1.4

can you send me your dbs the 5.8

it's not normal

Gai-Luron


Edit:
Arghhhhhhh, enormous bug on migration!!!
i fix it soon
lol its in your e-mail
To late, already fixed , take release 5.9.1.5
having a little problem... i tried this...

<?php 
$Refund
["1"] = "13200";
$Refund["2"] = "26400";
$Refund["3"] = "39600";
$Refund["4"] = "52800";
$Refund["5"] = "66000";
?>


<?php 
        
IF( GetCurrentPlayerVar("TotDistMeter") == $RefundGetCurrentPlayerVar("Refund") ] )
    
THEN
  SetCurrentPlayerVar
("Refund"ToNumGetCurrentPlayerVar("Refund") +  "1" ) );  
             
globalMsg"^7" $userName " Recived $2500 ^1Reason: ^7Distance bonus" );
            
SetCurrentPlayerVar"Cash"ToNumGetCurrentPlayerVar"Cash" ) + "2500" ) );           
  ENDIF
?>

but does not work :/
was thinking about doin (HAVENT TESTED THIS YET)

<?php 
$Refund 
"13200";
?>


<?php 
        
IF( GetCurrentPlayerVar("TotDistMeter") == ToNum$Refund GetCurrentPlayerVar("Refund") ) )
    
THEN
  SetCurrentPlayerVar
("Refund"ToNumGetCurrentPlayerVar("Refund") +  "1" ) );  
             
globalMsg"^7" $userName " Recived $2500 ^1Reason: ^7Distance bonus" );
            
SetCurrentPlayerVar"Cash"ToNumGetCurrentPlayerVar"Cash" ) + "2500" ) );           
  ENDIF
?>


<?php 
$Refund
[1] = 13200;
$Refund[2] = 26400;
$Refund[3] = 39600;
$Refund[4] = 52800;
$Refund[5] = 66000;
?>


<?php 
IF( GetCurrentPlayerVar("TotDistMeter") >= $RefundGetCurrentPlayerVar("Refund") ] )
THEN
    SetCurrentPlayerVar
("Refund"ToNumGetCurrentPlayerVar("Refund") +  ) );  
    
globalMsg"^7" $userName " Recived $2500 ^1Reason: ^7Distance bonus" );
    
SetCurrentPlayerVar"Cash"ToNumGetCurrentPlayerVar"Cash" ) + 2500 ) );           
ENDIF
?>

Or


<?php 
$Refund 
13200;
?>


<?php 
IF( GetCurrentPlayerVar("TotDistMeter") >= ToNum$Refund GetCurrentPlayerVar("Refund") ) )
THEN
    SetCurrentPlayerVar
("Refund"ToNumGetCurrentPlayerVar("Refund") +  ) );  
    
globalMsg"^7" $userName " Recived $2500 ^1Reason: ^7Distance bonus" );
    
SetCurrentPlayerVar"Cash"ToNumGetCurrentPlayerVar"Cash" ) + 2500 ) );           
ENDIF
?>

Don't forget to initialize SetCurrentPlayerVar("Refund", 1 ) ); on player connection


Don't forgot to use WriteLine to trace your code in console. WriteLine display a message in console screen
For debugging code is usefull. When your code is good remove lines

example:

<?php 
WriteLine
GetCurrentPlayerVar("UserName") . ":" GetCurrentPlayerVar("TotDistMeter") );
IF( 
GetCurrentPlayerVar("TotDistMeter") >= ToNum$Refund GetCurrentPlayerVar("Refund") ) )
THEN
    WriteLine
GetCurrentPlayerVar("UserName") . ": Refunded with $2500" );
    
SetCurrentPlayerVar("Refund"ToNumGetCurrentPlayerVar("Refund") +  ) );  
    
globalMsg"^7" $userName " Recived $2500 ^1Reason: ^7Distance bonus" );
    
SetCurrentPlayerVar"Cash"ToNumGetCurrentPlayerVar"Cash" ) + 2500 ) );           
ENDIF

?>

This thread is closed

Config help
(1112 posts, closed, started )
FGED GREDG RDFGDR GSFDG