The online racing simulator
Release : LFSLapper V7.0.4.6
Hello Lapperusers.

Here is a new version of LFSLapper.
See the changes below.

+-------------------------------+
|Changes from 7.0.4.5 to 7.0.4.6|
+-------------------------------+
=================================================
New:
=================================================
01 New function: layoutinfo(); Layout information ISP_AXI Insimpacket
-Number of objects
-Number of Checkpoints
-Number of startarrows
-Layoutname: (only when lapper is loaded on a local server)

02 New PlayerVars: Extra player info ISP_NCI Insimpacket (DONE)
//These vars are set after the player has joined the server
GetPlayerVar($userName,"LFS_Language"));
GetPlayerVar($userName,"LFS_UserID"));
GetPlayerVar($userName,"DecimalIPAdress"));
GetPlayerVar($userName,"IPAdress"));

To retreive extra info about the players AFTER lapper is loaded:
connectioninfo();

03 New PlayerVars: AFKTimer/IdleTimer
GetPlayerVar($userName,"AFKTime")); # Not being active in the server (Driving/Sending messages)
GetPlayerVar($userName,"IdleTime")); #Not driving the car (on the road).

=================================================
Updated:
=================================================
01: Max stored laptime is now 30 minutes instead of 5 minutes.
//Laptimes higher than 30 minutes will not be stored in the Lapper database.
//Reason: For very long layouts.

02: Few document updates.(Docs folder)

=================================================
Fixed:
=================================================
01: Lapper Crash: After loading/clearing layouts
02: Lapper Crash: After loading new track

NOTE: Since Version 7.0.4.4 contains changes for the RegisterNodeAction() & RegisterZoneAction() Sub Callbacks. The Sub callback requires now 2 values. See example below!!
==========================================================


<?php 
RegisterNodeAction
TESTIDgetLapperVar"ShortTrackName" ) , getCurrentPlayerVar("CurrNode") , test,"" );

Sub test($UserName,$ZoneID)
    
privmsg("ID=".$ZoneID); #output is TESTID
EndSub 
?>


==========================================================
Attached files
LFSLapper V7.0.4.6.rar - 2.3 MB - 930 views
LFSLapper (RegisterZoneAction_Fix).zip - 147.2 KB - 877 views
New version released.
Check first post
Thanks danny for this really great update.....
Thanks for your continued support of this great program.
Thank you.

There are a few things i didnt implement in this version.

-Sort(); To sort values (Arrays/Playervars) in Descending or Ascending order :
This was to difficult to implement it in the sourcecode. So i gonna try to create a script for it.
I have written something already in the 'utils.lpr',but it is far from finished.

-The street registration sourcecode: Which is your sourcecode. I will implement this in the next version of lapper.

Also there are still some tutorials left, that need to be written.

During the updates since last year, i have seen some nice servers that are powered by lapper with some nice scripts.
You're doing a very good job with LFSLapper, I hope you keep getting better!

Regards !
A question....

Does the onconnect event work?

And I did not quite understand what RegisterNodeAction
Quote from Popughini :Does the onconnect event work?

The standard 'welcome' message is in this section, so if you see the message, then the Event works.

Quote from Popughini :And I did not quite understand what RegisterNodeAction

This acts like a 'trigger', as does RegisterZoneAction.

In both of these, you have to set track abbreviation, X and Y co-ordinates, along with a sub-routine name. In the Zone action, you also have to set the size (in metres) of the zone (eg 1 would be an area 1m x 1m).

When driving the specified track, and when a car either crosses a node, or enters a zone, then lapper knows to start the sub-routine that is called within the registered action line.
Quote from sinanju :The standard 'welcome' message is in this section, so if you see the message, then the Event works.


This acts like a 'trigger', as does RegisterZoneAction.

In both of these, you have to set track abbreviation, X and Y co-ordinates, along with a sub-routine name. In the Zone action, you also have to set the size (in metres) of the zone (eg 1 would be an area 1m x 1m).

When driving the specified track, and when a car either crosses a node, or enters a zone, then lapper knows to start the sub-routine that is called within the registered action line.

Yes, I understand that, what I do not understand is how to use the new RegisterNodeAction function ....
Where the node number, track name and the name of the event that starts when driving by X node

Thanks for answering my questions!
Think of RegisterNodeAction and/or RegisterZoneAction as a way to make your own Event.

At an Event, you can code something within lapper to happen, as in
Event OnSplit1( $userName ) # Player event

you can have lapper put a button on screen with some text, like
Quote :You took {x} seconds to get to Split 1 from the Start line

There's an Event for both Split 1 and Split 2, but if you want something to happen in between, you would have to make up your own using RegisterNodeAction / RegisterZoneAction.

So if you knew the node number between Split 1 and Split 2, then you could put that number into the RegisterNodeAction line along with a sub-routine, and the sub-routine could have something like
Quote :Congratulations! You're half way to split 2, and your current time is {x}

If you watch a video I made while ago and put on YouTube ...



... you can see messages pop up on my Pace Notes section on right hand side of screen.

Because I was not driving on a track, where I could use nodes, I had to use zones, but if the off-track roads did have nodes, then my code would have looked like ...

RegisterNodeAction( "WE2X",100,PN3,"" );

The above line would have been in the Event OnLapperStart() section.

The following sub, would be somewhere under EndEvent ...

Sub PN3( $userName )
openPrivButton( "pn_note",180,60,34,6,7,-1,0,langEngine( "%{pn_3}%" ));
EndSub

And the following would appear in my EN language file

pn_3 = "Start 1st sector from Yellow gate"
. "%nl%Large hairpin right"
. "%nl%leads to narrow gate"
. "%nl%3 left"
. "%nl%"
. "%nl%^3150 right into tunnel ^1HAZARD";

The 1st 4 lines have uncoloured (grey) text, while last line has yellow text to highlight what's next, and red HAZARD letters.

In my code, I had over 60 zones, and on entering a zone, a message for only that zone appeared on screen.

Like I said, if I could have used nodes, then everytime I crossed a node, the message for that particular node would have appeared.

LFS uses Nodes for setting it's own events, such as sectors/splits/finish lines, as a node goes from one side of the track to the other, but LFS in Autocross mode, allows you to place zones. An LFS zone is usually either a restricted (visible or invisible marshall) circle, or a checkpoint circle.

Zones can be placed almost anywhere, including on the track, off-track, and in the pits.

In a recent upgrade, LFS allows the placing of InSim circles in Autocross mode. These are zones. Great thing about using these, is you don't have to know the X,Y co-ordinates; only the InSim Circle number - but you then have to use slightly different coding (NOT RegisterNodeAction and/or RegisterZoneAction).

If you need to find Node or Zone co-ordinates in lapper, you type !node or !zone when you drive to that section of the layout, and record the exact details.
Quote from sinanju :Think of RegisterNodeAction and/or RegisterZoneAction as a way to make your own Event.

At an Event, you can code something within lapper to happen, as in
Event OnSplit1( $userName ) # Player event

you can have lapper put a button on screen with some text, like


There's an Event for both Split 1 and Split 2, but if you want something to happen in between, you would have to make up your own using RegisterNodeAction / RegisterZoneAction.

So if you knew the node number between Split 1 and Split 2, then you could put that number into the RegisterNodeAction line along with a sub-routine, and the sub-routine could have something like


If you watch a video I made while ago and put on YouTube ...



... you can see messages pop up on my Pace Notes section on right hand side of screen.

Because I was not driving on a track, where I could use nodes, I had to use zones, but if the off-track roads did have nodes, then my code would have looked like ...

RegisterNodeAction( "WE2X",100,PN3,"" );

The above line would have been in the Event OnLapperStart() section.

The following sub, would be somewhere under EndEvent ...

Sub PN3( $userName )
openPrivButton( "pn_note",180,60,34,6,7,-1,0,langEngine( "%{pn_3}%" ));
EndSub

And the following would appear in my EN language file

pn_3 = "Start 1st sector from Yellow gate"
. "%nl%Large hairpin right
. "%nl%leads to narrow gate"
. "%nl%3 left"
. "%nl%
. "%nl%^3150 right into tunnel ^1HAZARD";

The 1st 4 lines have uncoloured (grey) text, while last line has yellow text to highlight what's next, and red HAZARD letters.

In my code, I had over 60 zones, and on entering a zone, a message for only that zone appeared on screen.

Like I said, if I could have used nodes, then everytime I crossed a node, the message for that particular node would have appeared.

LFS uses Nodes for setting it's own events, such as sectors/splits/finish lines, as a node goes from one side of the track to the other, but LFS in Autocross mode, allows you to place zones. An LFS zone is usually either a restricted (visible or invisible marshall) circle, or a checkpoint circle.

Zones can be placed almost anywhere, including on the track, off-track, and in the pits.

In a recent upgrade, LFS allows the placing of InSim circles in Autocross mode. These are zones. Great thing about using these, is you don't have to know the X,Y co-ordinates; only the InSim Circle number - but you then have to use slightly different coding (NOT RegisterNodeAction and/or RegisterZoneAction).

If you need to find Node or Zone co-ordinates in lapper, you type !node or !zone when you drive to that section of the layout, and record the exact details.

I've put everything the same, but passing through the node does not show the message it has to display ...

RegisterNodeAction( "BL2" , 55 , ESPERA,"" );

Sub ESPERA( $userName )
privMsg("^3*^7---------------------------------------------------^3*");
privMsg("^3>> ^7SE CORRE DE A ^33 ^7ESPERA TU TURNO !.");
privMsg("^3*^7---------------------------------------------------^3*");
EndSub

Thanks for the help
Quote from Popughini :I've put everything the same, but passing through the node does not show the message it has to display ...

RegisterNodeAction( "BL2" , 55 , ESPERA,"" );

Sub ESPERA( $userName )
privMsg("^3*^7---------------------------------------------------^3*");
privMsg("^3>> ^7SE CORRE DE A ^33 ^7ESPERA TU TURNO !.");
privMsg("^3*^7---------------------------------------------------^3*");
EndSub

Thanks for the help

Apologies, but I gave you code that works in my V6 - there was an update in V7.0.4.4 that makes my code obsolete if using this newer, or even later, version.

Means you will have to add an 'ID' to your code (in front of your BL2 track abbreviation).

Extract from update post here.

Quote :a small codechange in the RegisterZoneAction() and RegisterNodeAction().
The Callback Sub shall have a extra variable.

Example:


<?php 
RegisterNodeAction
TESTIDgetLapperVar"ShortTrackName" ) , getCurrentPlayerVar("CurrNode") , test,"" );

Sub test($UserName,$ZoneID)
   
privmsg("ID=".$ZoneID); #output is TESTID
EndSub
?>


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

To be honest, i've no idea why this was changed, nor what the code example above means.

TESTID/$ZoneID - I want my RNA (RegisterNodeAction) to be a trigger for something to happen. I already have the sub name (in example above, sub is 'test'). I'm not going to output the name or number of the node. Why would I need or want to? If I did, I could just write the info in the button. What happens if I use the zone id more than once in different nodes, or with different subs?

getLapperVar( "ShortTrackName" ) - Is this right? Why am I asking for the track abbreviation. I want me to tell lapper which track I want the sub to run on. If I use this, will it actually run, or will it run on every single track?

getCurrentPlayerVar("CurrNode") - Is this right? Why am I asking for the current node. I want me to tell lapper which exact node I want the sub to run on. If I use this, will it actually run, or will it run at every node?

test - this is the sub - tells lapper to run this sub when you cross node - perfectly understandable.

"" - never understood the logic behind this 2nd sub callback. I know its for when leaving the node you've just crossed, but distance between nodes is so small, you would be travelling at speed (even if only few mph/kph, and would probably only be milliseconds between nodes). So why not put all your actions in 1st sub? If you want to display 2 different pieces of information, why not just make 2 buttons in one sub, rather than 2 subs with one button each?

I have the same issues with the RZA (zones), as I don't need a zone id or a 2nd sub. Can sort of see why you might want 2nd sub callback as zones can be made large, but I'd rather have 2 small zones, each with their own sub.

Looking back at my add-ons where I use zones, none of the RZA's has a zone id - only track abbreviation, X, Y, size, sub1, "" (never a 2nd sub). And they all work.
Reason why i made this change was to create 1 Sub Callback for multiple Zone/Node actions. Which makes your code easier to read. I know that players who uses an older version of lapper, Must change theire code. I deal with the same situation. But at the end i'm happy with this code change.

The only i have changed is: Adding a 2nd value in the sub callbacks , so every Lapperuser who will change theire lapper version to 7.0.4.4 and higher need to add an 2nd Value in sub callbacks.
Quote from Bass-Driver :Reason why i made this change was to create 1 Sub Callback for multiple Zone/Node actions. Which makes your code easier to read. I know that players who uses an older version of lapper, Must change theire code. I deal with the same situation. But at the end i'm happy with this code change.

The only i have changed is: Adding a 2nd value in the sub callbacks , so every Lapperuser who will change theire lapper version to 7.0.4.4 and higher need to add an 2nd Value in sub callbacks.

Thank you already learned how to use the new function!
Could you explain how I do so that X user can use all vehicles while others can only use those that are active in the host?

Thanks in advance
As first you need enable all the cars in your server. After that you have to use a function that i made for Lapperversion 7.0.4.4.
See the link below. You might have asked the same question.

https://www.lfs.net/forum/post/1916011#post1916011

Read post 6/7/8/9 and 10
It's just a minor detail but IPAdress should be IPAddress (double D and double SS) in the English language.
Yeah sorry :s Bad english
Will be fixed in the next version.

I have no plans, to work on a new version yet.
Hello,

During developing a tool to define area's i discovered a bug in the RegisterZoneAction() function.

RegisterZoneAction( "MyZone", "SO6" , X-Axis , Y-Axis, WidthOfZone, EnterZone,LeaveZone );

After set a name for the LeaveZone Sub routine, i drove into the zone , which was ok. But Lapper crashed when i left the zone.
So i went exploring the bug in the sourcecode, and i found a typo. This is fixed and tested and is working

This bug only appear when set the LeaveZone Sub routine in the registerZoneAction() function.
The RegisterNodeAction() function is fine.

See Attachment for the fix bug. This attachment contains the LFSLapper.exe
Overwrite the old LFSLapper.exe in your LFSLapper directory.


PS: For players that customised theire LFSLapper.exe, Send me a PM.
Attached files
LFSLapper (RegisterZoneAction_Fix).zip - 147.2 KB - 728 views
Thanks Bass-Driver!

Release : LFSLapper V7.0.4.6
(20 posts, started )
FGED GREDG RDFGDR GSFDG