The online racing simulator
A question ... just let lapper put 3 buttons at most?

Since I have the traffic light system and drag when the light begins close to me several buttons leaving only 2: s
Can you post a couple of screenshots of what is happening?
To close a button in Lapper, the ID of that button is used.
Maybe the close routine isn't refering to all the correct ID's.
Make a copy of the LPR file, then rename that copy to .txt and upload it to the forum as well.
Hello, is there anyone who could explain to me why this one works

IF (MSHToNum(GetUserStoredValue( $userName."Sector3" )) > 29170)
THEN
PrivMsg("test");
ENDIF

but these two options don't?



IF (MSHToNum(GetUserStoredValue( $userName."Sector3" )) > 29170 || MSHToNum(GetUserStoredValue( $userName."Sector3" )) < 40000)
THEN
PrivMsg("test");
ENDIF

IF (MSHToNum(GetUserStoredValue( $userName."Sector3" )) > 29170)
THEN
IF (MSHToNum(GetUserStoredValue( $userName."Sector3" )) < 40170)
THEN
PrivMsg("test");
ENDIF
ENDIF

I attached whole .lpr file just in case.
Attached files
Sector_Times3.rar - 1013 B - 268 views
Well, I will be honest with you, a lot is wrong with your code.
You messed up commands and you didn't used the catchevent properly.
So I have re-arranged and corrected your code.
I've only tested it to see if it runs without errors now (which is the case), but haven't tested if it does what you want it to do.

- Download the file
- Rename it to sector_times3.lpr
- Put it in the "includes" folder
Attached files
sector_times3.txt - 3.6 KB - 300 views
@ LakynVonLegendaus

Could you explain your code, so that we understand what it must do.
Because what Yisc[NL] siad, there are alot of faults in your script (what i can see in a quick view).
Quote from Yisc[NL] :Well, I will be honest with you, a lot is wrong with your code.
You messed up commands and you didn't used the catchevent properly.
So I have re-arranged and corrected your code.
I've only tested it to see if it runs without errors now (which is the case), but haven't tested if it does what you want it to do.

- Download the file
- Rename it to sector_times3.lpr
- Put it in the "includes" folder

Thank you, sorry I probably should have clean it up before attaching.. Well I used your corrected version and it works just fine. I still don't really understand how did I use catchevent wrong.. is it because I did not use Sub? Anyway I'm happy, thank you for your help Smile
After i found a bug in the Toplist, it was time to update the helpmenu.

First i started with the toplist ofcourse, i found out that the amount of results that can be displayed is hardcoded to 18.

Does someone know where i can change the variable in the Lappercode.
Attached images
Racepos.jpg
hmm oke, thx for answering the question.

The toplist you see is not finished yet.
several functions has to be added.

2 other questions:

-Is it possible that "cleanspb" doesnt work. because my record is still there.

-I'm running an timeattack challenge on my server. It's recording times without penalty's.
Example: laptime: 1:00:00 and Penalty is 30 seconds. so totaltime should be 1:30:00. But its recording the 1:00:00. Is there a easy fix for it?

i know there is something like: $flagConfirm. Does it have effect about the storing the laptimes?
It could well be the case that cleanspb doesn't work, although I think it's not related to a recorded time, but only to the best time in that particular session.
Documententation says this about it: /cleanspb -> Clean your current session of Spb

A while ago I had a struggle with flagconfirm and then finaly found out how that is working.
First you need to know this:

const CONF_MENTIONED 1;
const CONF_CONFIRMED 2;
const CONF_PENALTY_DT 4;
const CONF_PENALTY_SG 8;
const CONF_PENALTY_30 16;
const CONF_PENALTY_45 32;
const CONF_DID_NOT_PIT 64;

Then I made this code:


CatchEvent OnResult( $userName,$flagConfirm ) # Player event
IF( ( $flagConfirm & 2 ) == CONF_CONFIRMED )
THEN
SetCurrentPlayerVar( "race_status","off" );
$plyNum_finished=$plyNum_finished+1;
ENDIF

IF( ( $flagConfirm & 16 ) == CONF_PENALTY_30 )
THEN
GlobalMsg ( "^3INFO: " . GetCurrentPlayerVar( "NickName") . "^7 is fined for 5 euros" );
$new_player_bank_saldo = GetCurrentPlayerVar( "player_bank_saldo" ) - 5;
SetCurrentPlayerVar( "player_bank_saldo",ToNum( $new_player_bank_saldo ) );
SetStoredValue( $userName . "player_bank_saldo", GetCurrentPlayerVar( "player_bank_saldo" ) );
$prices=$prices+5;
ENDIF

IF( ( $flagConfirm & 32 ) == CONF_PENALTY_45 )
THEN
GlobalMsg ( "^3INFO: " . GetCurrentPlayerVar( "NickName") . "^7 is fined for 10 euros" );
$new_player_bank_saldo = GetCurrentPlayerVar( "player_bank_saldo" ) - 10;
SetCurrentPlayerVar( "player_bank_saldo",ToNum( $new_player_bank_saldo ) );
SetStoredValue( $userName . "player_bank_saldo", GetCurrentPlayerVar( "player_bank_saldo" ) );
$prices=$prices+10;
ENDIF

IF( ( $flagConfirm & 4 ) == CONF_PENALTY_DT )
THEN
GlobalMsg ( "^3INFO: " . GetCurrentPlayerVar( "NickName") . "^7 is fined for 15 euros" );
$new_player_bank_saldo = GetCurrentPlayerVar( "player_bank_saldo" ) - 15;
SetCurrentPlayerVar( "player_bank_saldo",ToNum( $new_player_bank_saldo ) );
SetStoredValue( $userName . "player_bank_saldo", GetCurrentPlayerVar( "player_bank_saldo" ) );
$prices=$prices+15;
ENDIF

IF( ( $flagConfirm & 8 ) == CONF_PENALTY_SG )
THEN
GlobalMsg ( "^3INFO: " . GetCurrentPlayerVar( "NickName") . "^7 is fined for 20 euros" );
$new_player_bank_saldo = GetCurrentPlayerVar( "player_bank_saldo" ) - 20;
SetCurrentPlayerVar( "player_bank_saldo",ToNum( $new_player_bank_saldo ) );
SetStoredValue( $userName . "player_bank_saldo", GetCurrentPlayerVar( "player_bank_saldo" ) );
$prices=$prices+20;
ENDIF

SetStoredValue( "RFM_" . "prices", $prices );
DelayedCommand( 60, Finish_price );
EndCatchEvent

Of course the actions within each IF-statement, are of no use for you, but you can replace them with the things you want to happen.
And no, this won't have effect on the laptimes that Lapper will record, so you need to start storing your own values.
Got this for my licensepoints. A penalty means that you are not receiving any points.

But for the laptimes , the lappersource have to be changed , if i want to add the penaltytimes?
Yes, then the sourcecode have to be adjusted.
Well new challenge ahead XD
-
(Bass-Driver) DELETED by Bass-Driver : Fixed it :S
Maybe it is a stupid question, but i need to know something.

I'm rewriting the dragscript, so that demousers can use the script.
It's because demousers cannot use AutoX editor for placing "Splits", so they must use tracknodes.

To get the time i can use: getLapperVar( "LongTime" ). But is there a Variable that can get the current laptimer? to get milliseconds.
Quote from Bass-Driver :Maybe it is a stupid question, but i need to know something.

I'm rewriting the dragscript, so that demousers can use the script.
It's because demousers cannot use AutoX editor for placing "Splits", so they must use tracknodes.

To get the time i can use: getLapperVar( "LongTime" ). But is there a Variable that can get the current laptimer? to get milliseconds.

There is a variable to get the laptime: LapTime
And there's a function to get milliseconds: NumToMs
Although it's earlier called "NumToMSH" in the changelog.
I have tried many Vars

All returned 0, See attachment.

privmsg(GetPlayerVar($userName, "RaceTotalTime"));
privmsg(GetPlayerVar($userName, "LapTime"));
privmsg(GetPlayerVar($userName, "RacePBTime"));
privmsg(GetPlayerVar($userName, "SplitTime"));
Attached images
example.jpg
According to changes.txt two variables are written in lower case only:

6. Added 3 new var setted at end of race or qualification
finishedpos : finish or qualify pos (1 = win / 256 = not added to table)
racetotaltime : race time (ms) use NumToMsh is need
racepbtime : race time (ms) use NumToMsh is need

Sadly this has happened a lot in Lapper, as either the use of variable names in inconsistent and/or the documention is incorrect.
Recently I had to go through the source files to get the correct spelling for a variable.

It also looks like that "racetotaltime" and "racepbtime" are only set at end of race or qualification.
hmm oke,
Is there a way to calculate the timedifference between 2 nodes with getLapperVar( "LongTime" );

The output i get is in 0-12 format. And Adding NumToMSH() doesnt work.

very basis example code.

$NodeOne = getLapperVar( "LongTime" );
$NodeTwo = getLapperVar( "LongTime" );
$Timediff = $NodeTwo - $NodeOne
Longtime always seems to be in 12-hour format and setting "TimeFormat = HH:mm;" in the Lapper server config file, makes it crash, so although it's mention in the chances.txt, it doesn't work.

In the end I came up with this script, althoug I doubt if this is enough to measure time for drag racing, since it can only handle full seconds:

CatchEvent OnLapperStart()
OnLapperStart_Node_time();
EndCatchEvent

Sub OnLapperStart_Node_time()
### Declare global variables ###
GlobalVar $splitted_node_1;
GlobalVar $splitted_node_2;

RegisterNodeAction( "Node1", "BL1" , 61 , DisplayTime_Node_1, "" );
RegisterNodeAction( "Node2", "BL1" , 72 , DisplayTime_Node_2, "" );
EndSub

Sub DisplayTime_Node_1( $KeyFlags )
$splitted_node_1 = SplitToArray( getLapperVar( "LongTime" ),":" );
$values_in_array = arrayCount( $splitted_node_1 );

FOR( $i = 0 ; $i < $values_in_array ; $i = $i + 1)
$splitted_node_1[$i] = ToNum( subStr( $splitted_node_1[$i], 0, 2 ) );
ENDFOR
EndSub

Sub DisplayTime_Node_2( $KeyFlags )
$splitted_node_2 = SplitToArray( getLapperVar( "LongTime" ),":" );
$values_in_array = arrayCount( $splitted_node_2 );

FOR( $i = 0 ; $i < $values_in_array ; $i = $i + 1)
$splitted_node_2[$i] = ToNum( subStr( $splitted_node_2[$i], 0, 2 ) );
ENDFOR

$hour=$splitted_node_2[0]-$splitted_node_1[0];
$minutes=$splitted_node_2[1]-$splitted_node_1[1];
$seconds=$splitted_node_2[2]-$splitted_node_1[2];

PrivMsg ( "^7DEBUG: " . $hour . ":" . $minutes . ":" . $seconds );
EndSub

Thanks, why didnt i came up with this LOL.
Never thought that SplitToArray() could work on lapperVars. Because i used SplitToArray() alot in my logfile scripts.

Anyway, i go play with the code and see if i can get it to work in my dragscript. Its something to measure the time between nodes etc.
hi,


When you have multiple servers running on one LFSLapper.exe
Is it possible to get data from the servers like Host/ Number of players etc.

i know the function: groupcmdlfs(); but i only can send messages to the servers.
when reading through 'changes.txt' I see this about groupcmdlfs:

groupCmdLfs( cmd );
Same command as cmdLfs but send this LFS command to all server having the same group id.

So basicly it let you do the same actions that can be used in 'cmdLfs' but then for the whole group.

As far as I can see, there isn't a way to retrieve information from another instance of Lapper.
Of course you could write some values to the database and then retrieve them from another server.
I've used such thing in my schedule and schedule_set script, so you might want to have a look at those scripts.
oke thanks.

Anyway, i go back to 1 lapper per server. Otherwise i have to change the code of several systems.
For example i'm updating my adminpanel. The logfiles are not stored in the database. Here's a picture of it. It works good and as admin you have a sort of control over your admins/server.
Attached images
adminlog.jpg
General query about the variables in any Event On... line, (something I probably should know by now!) such as

Event OnCrossingChecker($userName,$Flags,$Time,$Object,$UserSpeed) # Player event

Can each of these vars be used as 'triggers' do to something?

For example

IF ( $Flags == "3" )
THEN
> say or do something, like spec user
ENDIF

IF ( $Time < "0.30.00" )
THEN
> say or do something, like congrat user for doing something within certain time
ENDIF

IF ( $Object == "Checker" )
THEN
> say or do something, like tell user they are going right/wrong direction
ENDIF

IF ( $UserSpeed < "100" )
THEN
> say or do something, like tell user they are too slow
ENDIF

I ask, because I'm more used to using player and lapper vars, such as

IF( GetCurrentPlayerVar( "LapsDone" ) > 0 )
THEN....

IF( getConfigVar("MaxCarResets") > 0 )
THEN....

I have tested with $Flags in the above quoted Event, but haven't tested with the others.
As soon as any event within Lapper is triggered, you can use the several variables within that event, to do different things.
You can do that as in your example, but it's even possible to combine variables and do different things.
This thread is closed

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