The online racing simulator
I need to save the data in the correct sequence. A file Storedvalue.dbs have to edit before use more ... The best option: open the file with the saved data, in which everything is in order is necessary to me, quickly copy and paste.

________
upd
Invented. in cmd "LFSLapper.exe >​​c:\mylog.txt"
what about penalties?
Right Click on button to close - query?
I'd like to be able to use Right Click mouse to close a button rather than a button that says close.

Lapper documentation states -

All backcalled function from click button receive the clicked button on mouse and special on keyboard
1 // left click
2 // right click
4 // ctrl + click
8 // shift + click


Tried a few things, but nothing I do works.

CASE "!click":
SE_Click();
# SE_Click(0);
# SE_Click($argv);
# SE_Click($userName, $argv);
# SE_Click($userName);

BREAK;

Sub SE_Click() # A Sinanju Event
openPrivButton( "RightClickButton",75,85,50,10,-1,32,"^0Right Click ^1CLOSES ^0this button",2 );
# openPrivButton( "RightClickButton",75,85,50,10,-1,32,2,"^0Right Click ^1CLOSES ^0this button"); # 2 used as backcalled sub
# openPrivButton( "RightClickButton",75,85,50,10,-1,34,"^0Right Click ^1CLOSES ^0this button"); # 2 added to button format (32 dark button)
# openPrivButton( "RightClickButton",75,85,50,10,-1,32|2,"^0Right Click ^1CLOSES ^0this button");

EndSub

(lines with hash marks are also code I tried)

Anyone used this function, and if so, how do you do it?!
Bump!
Haven't tried this again yet - anyone know?
Looking to show a table on my server that shows only the current top time for each and every car on current track.

Would look like;

CAR........DRIVER........TIME
-----------------------------------
BF1........Alpha.........0:59.23
FO8........Beta..........1:03.25
FZR........Gamma.....1:06.14
XRR........Delta.........1:06.08
FXR........Echo..........1:05.98
FOX....
etc, etc

I can't work out how to show only the fastest for each type of car - for instance, TOP BF1 1 will give you a table with 18 names, from 1st to 18th places, along with their times.

Can something like this be done?

And to make it more difficult, could drivers country be shown in another column?
The question about the left and right click is an easy one (well, for me it was).
You start a button with a call to subroutine (OnConnectClose in this case)

openPrivButton( "clos",78,120,20,10,10,-1,ISB_DARK,langEngine("%{main_accept}%"),OnConnectClose );

In the subroutine, you capture the $KeyFlags

Sub OnConnectClose( $KeyFlags,$id )
Privmsg ("^7DEBUG: " . $KeyFlags);
EndSub

When left mousebutton is clicked, value 1 will be displayed.
When right mousebutton is clicked, value 2 will be displayed.
Clicking the button while holding CTRL, will add 4 to the value.
While holding SHIFT will add 8 to the value.

*edit* I will try to look into your other question either tomorrow or somewhere this weekend and get back to you with an answer (even if it would be, sorry not possible as far as I can tell)
Well, well....didn't know you could put $KeyFlags within the sub itself.

No rush on the top list table - something I've been thinking about for a while to make it easier for me to post times when I show them against some of the AutoX layouts I've made. At the moment I have to cut and paste 20 screenshots together to make my table up, which is really time consuming.
No rush on the top list table, but I got it done in about 2 hours.
I think this is what you want, if not, let me know.
The script is attached as well, download the file, rename txt to lpr, place it in the "includes" folder of Lapper and make an entry in addonsused.lpr for it.

It displays all available cars that have a time set on that track, the rest of the cars is left out.

Attached images
toptable_per_car.png
Attached files
toptable.txt - 6 KB - 351 views
This is great thanks! Just what I wanted.

No way I would have come up with that code.

Cheers!
Huge difference being able to use this "toptable"! Again, much appreciated.

Made few adjustments for my use though...

centred table on screen
swapped car types round so quickest cars at top, down to slow cars at bottom (quickest people on server want to see their name at top!)
made table smaller (doesn't take so much screen real estate) by tweaking column sizes

Table is now 59 in from left, with car/driver/time columns now 20/40/20 wide.


You'll should add your script to your 'code release' post.
Attached images
AU1 Scaletrix 8a Multi Laps Best times per car.png
Great to hear you like it.
I have been trying to make it possible to enter a trackcode manualy and then gather the times for the selected track.
But sadly that doesn't seem possible.
But I agree, it's a useful script and I think I will add it ot my "code release" post.
Yellow Flag System Request
I made a simple Yellow flag system for people who spin that shows a global yellow flag to everyone to be aware that someone spun (likely caused by crash). There's also a delayed command, which shows a Green flag once the Yellow flag disappears off screen.

I'm using the 'Event OnAngleVelocity'.

However, I'd like it to be shown to people only in the sector the event occurs, along with the sector before.

So, if spin happens in Sector 3, then Sectors 2 and 3 get message, but not 1 and 4, or if spin happens in Sector 1, then sectors 1 and 4 get message.

Not sure about what happens if track layout only has 3 sectors, if code written for 4 sectors.

Anyone like to take this on?

My code is attached, which is mainly how the large flags are made.

For testing purposes only, I've set the $MinAngleVelocity very low - 40 - normally I have it at 181.
Attached files
yellowflag.zip - 840 B - 385 views
hey,

I have made already the basics(no not done yet) to set the user in the right Sector and detect where the crash is.
For now its only for tracks/layouts with 3 Splits.

for my splittimebar to detect how many splits the track has, i have made a extra file. The globalvars in the LOADTRACKSPLITS file are places a another file
I will implement that in the yellowflag system.
Attached files
[TI]RS_LOADTRACKSPLITS.zip - 540 B - 397 views
[TI]RS_YELLOWFLAG.zip - 808 B - 362 views
Just doing this out of my head, so might not work that way when actualy coding it. First you need to set a Playervalue when someone crosses a split. So when split 1 is crossed, the player has entered sector 2, etc.
When the Event is called to show the yellow flag, run a loop through all current connections and while doing that, do a check if the sector the player is currently in, does or doesn't need to show that flag. I think this is relatively straight forward.
Quote from Bass-Driver :hey,

I have made already the basics(no not done yet) to set the user in the right Sector and detect where the crash is....

Tried your code,and the debug messages for advising player which sector they are in works (removed erroneous ENDIF in your Race and Qualy Events), but if you spin, you don't get message, but more likely (especially if big spin) to be spectated.

To make sure it wasn't a problem with the IF statements when a player was in a particular sector, I simplified the spin code to check

CatchEvent OnAngleVelocity( $userName ) # Player event

######CRASH IN SECTOR 1 ( STARTLINE - 1ST SPLIT)#########
IF(GetCurrentPlayerVar("IsInSplitSector") == 1)THEN
privMsg ( "(DEBUG) ^3YELLOWFLAG SECTOR: ^61");
openprivButton( "flag1",152,56,40,90,8,8,64,"^3-%nl%^3-%nl%^3-%nl%^3-"); #yellow flag
openprivButton( "flag2",162,56,40,90,8,8,64,"^3-%nl%^3-%nl%^3-%nl%^3-");
ENDIF

######CRASH IN SECTOR 2 ( 1ST SPLIT - 2ND SPLIT)#########
IF(GetCurrentPlayerVar("IsInSplitSector") == 2)THEN
privMsg ( "(DEBUG) ^1REDFLAG SECTOR: ^62");
openprivButton( "flag1",152,56,40,90,8,8,64,"^1-%nl%^1-%nl%^1-%nl%^1-"); #red flag
openprivButton( "flag2",162,56,40,90,8,8,64,"^1-%nl%^1-%nl%^1-%nl%^1-");
ENDIF

etc, etc

EndCatchEvent

This worked, but again, spin specs you.

Also experimented with putting the FOREACH before the IF statements (with ENDFOREACH after last ENDIF) but nothing happens.

Just had a thought as I finish this - which I need to check - wonder if the stunt Event causing spec?
I'm stil busy with the code but this is weird, i dont get specced.
Did you checked the the event below. I didnt added that event in the code yet

Event OnMaxNbInStunt( $userName ) # Player event
EndEvent

Maybe you have a another "OnMaxNbInStunt" event in a another file that might specs the player.

EDIT: just added the event with some debug messages and i do not get specced or whatever.
As we both thought, it was the OnMaxNbInStunt event causing the spec when spinning.

I've never changed the default since using lapper, and I've never added it into any other add-ons.

I disabled it, so I no longer got specced, but I still don't get debug messages on spinning.

I then re-enabled it, and transferred your code from 'CatchEvent OnAngleVelocity' to 'CatchEvent OnMaxNbInStunt', but, again, no debug messages.

Just a thought, but would it be best to have same code in both these events?

What's "stunt mode" anyway? Donuts?
OnMaxNbInStunt means that you reached the max angle(100 degrees in a amount of time like 100ms( (very fast) spin or heavy crash). Its just a extra check. In my scripts i have OnMaxNbInStunt disabled.

This is the code i have now:
You need to add the code from the [TI]RS_LOADTRACKSPLITS.LPR in the posts above
Do not forget to make a globalvar of $TrackSplits

CatchEvent OnRaceStart($NumP ) # Lapper event
$ListOfPlayers = GetListOfPlayers("U");
FOREACH( $CurrUname IN $ListOfPlayers)
setplayervar( $CurrUname["value"],"IsInSplitSector",1 );
ENDFOREACH
EndCatchEvent

CatchEvent OnQualStart( $NumP ) # Lapper event
$ListOfPlayers = GetListOfPlayers("U");
FOREACH( $CurrUname IN $ListOfPlayers)
setplayervar( $CurrUname["value"],"IsInSplitSector",1 );
ENDFOREACH
EndCatchEvent



CatchEvent OnNewPlayerJoin( $userName ) # Player event
SetCurrentPlayerVar("IsInSplitSector",1 );
EndCatchEvent

CatchEvent OnLeaveRace( $userName ) # Player event
SetCurrentPlayerVar("IsInSplitSector",0 ); #Spectator or Inpit
EndCatchEvent

CatchEvent OnSplit1( $userName ) # Player event
SetCurrentPlayerVar("IsInSplitSector",2 );
EndCatchEvent

CatchEvent OnSplit2( $userName ) # Player event
SetCurrentPlayerVar("IsInSplitSector",3 );
EndCatchEvent

CatchEvent OnSplit3( $userName ) # Player event
SetCurrentPlayerVar("IsInSplitSector",4 );
EndCatchEvent

CatchEvent OnLap( $userName ) # Player event
SetCurrentPlayerVar("IsInSplitSector",1 );
EndCatchEvent


$MinAngleVelocity = 100; # Minimum angle velocity to trigger action. Possible values: 0 - 720 - set very low for testing

CatchEvent OnAngleVelocity( $userName ) # Player event
IF($yellowflagsystem == "on")THEN
######CRASH IN SECTOR 1 ( STARTLINE - 1ST SPLIT)#########
IF(GetCurrentPlayerVar("IsInSplitSector") == 1)THEN
$ListOfPlayers = GetListOfPlayers("U");
FOREACH( $CurrUname IN $ListOfPlayers)
IF($TrackSplits == "1")THEN
IF((GetPlayerVar( $CurrUname["value"], "IsInSplitSector" ) == 2)||(GetPlayerVar( $CurrUname["value"], "IsInSplitSector" ) == 1))THEN
#Your code
ENDIF
ENDIF
IF($TrackSplits == "2")THEN
IF((GetPlayerVar( $CurrUname["value"], "IsInSplitSector" ) == 3)||(GetPlayerVar( $CurrUname["value"], "IsInSplitSector" ) == 1))THEN
#Your code
ENDIF
ENDIF
IF($TrackSplits == "3")THEN
IF((GetPlayerVar( $CurrUname["value"], "IsInSplitSector" ) == 4)||(GetPlayerVar( $CurrUname["value"], "IsInSplitSector" ) == 1))THEN
#Your code
ENDIF
ENDIF
ENDFOREACH
ENDIF
######CRASH IN SECTOR 2 ( 1ST SPLIT - 2ND SPLIT) OR ( 1ST SPLIT - FINISHLINE)#########
IF(GetCurrentPlayerVar("IsInSplitSector") == 2)THEN
$ListOfPlayers = GetListOfPlayers("U");
FOREACH( $CurrUname IN $ListOfPlayers)
IF($TrackSplits == "1")THEN
IF((GetPlayerVar( $CurrUname["value"], "IsInSplitSector" ) == 1)||(GetPlayerVar( $CurrUname["value"], "IsInSplitSector" ) == 2))THEN
#Your code
ENDIF
ENDIF
IF($TrackSplits == "2")THEN
IF((GetPlayerVar( $CurrUname["value"], "IsInSplitSector" ) == 1)||(GetPlayerVar( $CurrUname["value"], "IsInSplitSector" ) == 2))THEN
#Your code
ENDIF
ENDIF
IF($TrackSplits == "3")THEN
IF((GetPlayerVar( $CurrUname["value"], "IsInSplitSector" ) == 1)||(GetPlayerVar( $CurrUname["value"], "IsInSplitSector" ) == 2))THEN
#Your code
ENDIF
ENDIF
ENDFOREACH
ENDIF
######CRASH IN SECTOR 3 ( 2ND SPLIT - 3RD SPLIT) OR ( 2ND SPLIT - FINISHLINE)#########
IF(GetCurrentPlayerVar("IsInSplitSector") == 3)THEN
$ListOfPlayers = GetListOfPlayers("U");
FOREACH( $CurrUname IN $ListOfPlayers)
IF($TrackSplits == "2")THEN
IF((GetPlayerVar( $CurrUname["value"], "IsInSplitSector" ) == 2)||(GetPlayerVar( $CurrUname["value"], "IsInSplitSector" ) == 3))THEN
#Your code
ENDIF
ENDIF
IF($TrackSplits == "3")THEN
IF((GetPlayerVar( $CurrUname["value"], "IsInSplitSector" ) == 2)||(GetPlayerVar( $CurrUname["value"], "IsInSplitSector" ) == 3))THEN
#Your code
ENDIF
ENDIF
ENDFOREACH
ENDIF
######CRASH IN SECTOR 4 ( 3RD SPLIT - FINISHLINE)#########
IF(GetCurrentPlayerVar("IsInSplitSector") == 4)THEN
$ListOfPlayers = GetListOfPlayers("U");
FOREACH( $CurrUname IN $ListOfPlayers)
IF($TrackSplits == "3")THEN
IF((GetPlayerVar( $CurrUname["value"], "IsInSplitSector" ) == 3)||(GetPlayerVar( $CurrUname["value"], "IsInSplitSector" ) == 4))THEN
#Your code
ENDIF
ENDIF
ENDFOREACH
ENDIF
ENDIF
EndCatchEvent

Feeling stupid as still can't get your code to work.

Tried streamlining a bit - I'm testing on track with 4 sectors, so just set GlobalVar
GlobalVar $TrackSplits ; $TrackSplits = "3";

Added small country flag and private message to appear before the FOREACH sections to prove that going over $MinAngleVelocity = 25; works - it does, but the yellow flag and global message that should appear once the FOREACH code starts, still won't appear. And there are no errors being reported in the log files.

Code attached.

On your tracksplits code, you have $IsOpenConfig - I assume you must be using that in some other add-on, as not doing anything in the code you attached.
Attached files
yellowflag5.zip - 1.3 KB - 349 views
i really have no idea why it doesnt work for you. Really confusing.
i'm testing my code. its the same code what i added in my post above and its working.

Script attached

Your globalvar is good.

Well maybe i have an idea:
-Add some debug messages after the IF($TrackSplits == "")THEN line
-Set some laps or hours
-Try to finish a lap and crash XD.

The $IsOpenConfig is a variable that i'm not using at the moment.
its more for future development of my lapper. It was more for testing if i forgot to add a track to the list.
Attached images
yellowflag.jpg
Attached files
[TI]RS_YELLOWFLAG.zip - 1.1 KB - 354 views
Just downloaded your new file.

Wonder if the problems I'm having are related to me using V6.0.1.3?

This is the version both of my online host providers add when user requests lapper (as against Airio), so its the version I use for testing offline (multiplayer/start new host/visibility: local), as I've been doing for this code.
Quote from sinanju :Just downloaded your new file.

Wonder if the problems I'm having are related to me using V6.0.1.3?

This is the version both of my online host providers add when user requests lapper (as against Airio), so its the version I use for testing offline (multiplayer/start new host/visibility: local), as I've been doing for this code.

Try it with mine LFSLapper.exe
its a modified V6.0.1.4.
Attached files
LFSLapper.rar - 119.4 KB - 345 views
Still can't get it to work.

Tried again on vanilla copy of LFSLapper V6.014_v015. Added my yellowflag5.lpr file, and although the country flags and debug messages are seen on big drifts, the yellow flags and debug messages still missing.

Then used your modified .exe file, and apart from updating my drift scoreboard live (I only found out how to do this 2 weeks ago using lapper script!), still no yellow flag or debug messages.

Moved by LFS directory from C:\Games\ to C:\, even though I've never had any previous issues with LFS in my Win7 Games directory, but no difference.

Tried your file (which I called yellowflag6.exe), with and without modified .exe, and still not working.

The major change I made to your new file was to remove the IF($yellowflagsystem == "on" part - there will be no IF on my servers - it will always be on.

Everything I've been using, including modified .exe, in attached zip.

The only other thing I can think of to do is to download new copy of LFS and install that, then test again.
Attached files
V6.014_v015 -yellow flag test.zip - 2 MB - 365 views
Further tests done - all to no avail.

Downloaded and re-installed LFS, then ran lapper with yellowflag5.lpr add-on, but still no yellow flag, although country flag ok.

Added some additional code;

------------------------------------------------------------------------------------------------------
CatchEvent OnSplit1( $userName ) # Player event
SetCurrentPlayerVar("IsInSplitSector",2 );
privMsg("(DEBUG) ^7You are now in Sector: ^2".getCurrentPlayerVar("IsInSplitSector"));
$CurrPly = GetPlayerInfo( $userName );
WriteLine( $CurrPly["userName"] );
WriteLine( $CurrPly["nickName"] );
WriteLine( $CurrPly["IsInSplitSector"] );
privMsg ( $CurrPly["userName"] );
privMsg ( $CurrPly["nickName"] );
privMsg ( $CurrPly["IsInSplitSector"] );
EndCatchEvent

------------------------------------------------------------------------------------------------------

(ditto for other splits) and

------------------------------------------------------------------------------------------------------
CatchEvent OnAngleVelocity( $userName ) # Player event

######CRASH IN SECTOR 1 ( STARTLINE - 1ST SPLIT)#########
$CurrPly = GetPlayerInfo( $userName );

IF(GetCurrentPlayerVar("IsInSplitSector") == 1)THEN

### First part is test to make sure a flag and message appears for person who crashed ###
openprivButton("flaga",75,9,40,90,8,3,64,"^1-%nl%^7-%nl%^4-");
openprivButton("flagb",85,9,40,90,8,3,64,"^1-%nl%^7-%nl%^4-");
privMsg ( "(DEBUG_TEST) ^3YELLOW FLAG IN SECTOR: ^61");

privMsg ( $CurrPly["userName"] );
privMsg ( $CurrPly["nickName"] );
privMsg ( $CurrPly["IsInSplitSector"] );

### Second part polls round every player to see if they are in right sector, and if so, different flag and message will apppear ###
$ListOfPlayers = GetListOfPlayers("U");
FOREACH( $CurrUname IN $ListOfPlayers)

IF((GetPlayerVar( $CurrUname["value"], "IsInSplitSector" ) == 4)||(GetPlayerVar( $CurrUname["value"], "IsInSplitSector" ) == 1))THEN
writeLine( "Key = " . $CurrUname["key" ] . " Value = " . $CurrUname["value" ] );
dumpVar( $CurrUname );
GlobalMsg ( $CurrUname["value"] , "(DEBUG) ^3YELLOWFLAG SECTOR: ^61");
openprivButton( "flag1",152,56,40,90,8,3,64,"^3-%nl%^3-%nl%^3-%nl%^3-");
openprivButton( "flag2",162,56,40,90,8,3,64,"^3-%nl%^3-%nl%^3-%nl%^3-");
ENDIF

ENDFOREACH
ENDIF
EndCatchEvent

------------------------------------------------------------------------------------------------------

Although the Sector debug messages work ("(DEBUG) You are now in Sector n"), none of the FOREACH, WriteLine, dumpVar or the $CurrPly messages appear in console or on screen.

When I do a !who request, my name doesn't appear in Krayy's CIF module (don't think I've looked at this offline before, so not sure if that's normal). Nor does it appear in the Membership module, which I've never enabled before and only used in this test as it was included and set up in the new lapper V6 I installed.

For these reasons, I think the problem may be something to do with my Win7 or network settings, although lapper is allowed full access to my network, so not sure what network problem could be.


My next step (much later on today), will be to put a yellowflag.lpr file onto one of my online servers, and test it online. That way it doesn't rely on my Win7 or network settings being correct.
Attached images
Firewall Settings.jpg
Not got round to putting test yellow flag script onto my server yet, but I tested Port Forwarding on my pc earlier....



... and even closed my Windows Firewall, but still nothing.

Why that should make a difference when i'm testing as Local Multiplayer on home network 127.0.0.1:29999, I've no idea.

Tried a short test with new additional bit of code

Event OnConnect( $userName ) # Player event
$CurrPly = GetPlayerInfo( $userName );
$CurrPly["test"] = "(Debug) test";
WriteLine( $CurrPly["userName"] );
WriteLine( $CurrPly["nickName"] );
WriteLine( $CurrPly["test"] );
privMsg($CurrPly["userName"]);
privMsg($CurrPly["nickName"]);
privMsg($CurrPly["test"]);
EndEvent

In the lapper console, I get "(Debug) test", and in game, I also get "(Debug) test" - but neither show my username or nickname, which is weird. My first thought was maybe V6.0.1.3 didn't recognise $CurrPly, but if so, why do I get both debug messages, which rely on $CurrPly?

And no other script that requires use of FOREACH is working.

Just had a thought - if I have time later, I'll test on my son's pc (probably require to install LFS, but I can always try it in demo mode. Probably should have done this first Shrug

Big thank you for sticking with me!
Attached images
Port Forwarding.jpg

FGED GREDG RDFGDR GSFDG