The online racing simulator
Searching in All forums
(970 results)
sinanju
S3 licensed
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.
Last edited by sinanju, .
Top times and drift scores after 100 completed runs
sinanju
S3 licensed
sinanju
S3 licensed
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.
sinanju
S3 licensed
You can't put an Event under a sub, nor should you put a sub under an Event.

But you can call a sub from within an Event.

For an example, look at the OnConnectClose sub in the Event OnConnect - you'll see that the sub is called within the event (at end of a button - and works when you press that button), but the sub is outwith the Event itself (comes after EndEvent).

Before you start getting too involved in everthing, the very first thing you should be doing is seeing if you can get the driftscores of 2 drivers onto the screen at the same time.

Forget how things will look, angles, adding scores, who's in front/behind. Just try get 2 drivers $LastDriftScore to show on screen at same time.

You won't be able to do this with private buttons, and if you use global buttons, how does lapper know how to differentiate between the 2 drivers, and not get scores mixed up?

I suspect that you may have to look at using openButton AND getListOfPlayers AND the FOREACH loop.

Following bit of code is something that I amended slightly from code that Bass-Driver gave me for something drift related, and gives you an idea of what may be required...

CatchEvent OnDriftScore($userName) # Player event
$hgt = 50;
$Drivers = getListOfPlayers("N");
FOREACH( $Var IN $Drivers ) #For each player in the $drivers list
IF (GetPlayerVar($maVar["value"], "OnTrack") == 1)
THEN #IF player is on track , display his name and totaldriftscore
$hgt=$hgt+4; #Buttonheight + 4 (has to be used else your second driver will just be placed and overwrite 1st driver)
openButton($Var["value"],"driver_Ply_".$maVar["value"],3,$hgt,18,4,1,-1,96,"".Getplayervar($maVar["value"],"NickName"));
openButton($Var["value"],"driver_DScore_".$maVar["value"],21,$hgt,10,4,1,-1,32,"^3".Getplayervar($maVar["value"],"DriftScore"));
ENDIF
ENDFOREACH
EndCatchEvent

sinanju
S3 licensed
You're not using the CASE command properly. Its basically there as a command to do something (usually simple), such as output a button or start a sub-routine WHEN you type in the trigger word - in this case !twin.

Think of the !top command - once you type in !top, you get a list of the top best times.
It happens once. It normally does not update. If someone does a new faster time while you're looking at the top table, you have to type in !top again, for table to refresh.

Yours should have been something like

CASE "!twin":
openPrivButton( "twin_message",([i]dimensions here[/i]),"Twin Drift System now enabled" );
DoTwinSub();
BREAK;

so when you type !twin, lapper knows to then start the sub called DoTwinSub

as in

Sub DoTwinSub(blah, blah)
$me = GetCurrentPlayerVar("NickName");
$behind = GetPlayerVar( GetCurrentPlayerVar( "UNameBehind" ),"NickName" );
$front = GetPlayerVar( GetCurrentPlayerVar( "UNameBefore" ),"NickName" );

your code in here.....

EndSub

Why do you think you need the $me/$behind/$front variables?

Also. I don't understand the IF statements....
IF (9 > 7)
IF (7 > 6)

9 is always going to be more than 7 and 7 is always going to be more than 6.

What do the numbers indicate?

Now, if you meant
IF ($behind > $me) - or - IF ($behind < $me)
that would make more sense, although may not work, as lapper has already worked out the UNameBehind and UNameBefore users.

If I was making a twin drift system, then there would be 1 question; do i want to give users/admin option to switch twin system off/on, or would it be on all the time?

If an option to turn off/on, then you would have to start playing about with GlobalVars and a simple CASE command to get started - complicated subject. if you want to see it in action, look at Yisc[NL]'s pitboard lapper script for a GlobalVar that has "off" or "on" set.

In either case, all the code should be within the Event OnDriftScore( $userName ) section.

You can either use the section within the lfslapper.lpr file, or make your own add-on, in which case you would need to Catch the Event, as in CatchEvent OnDriftScore( $userName ).

If you went down the GlobalVars route, then you would need another IF-ENDIF section, which could be done various ways, as in,
IF enabled,
THEN...

- or -

IF not enabled
THEN use usual code,
ELSE use this code

....etc

====================

There are probably only a handful of people who use lapper that could make a twin drift system, and I'm not one of them. Not only that, all but 2 of these people don't actually give advice or put their code on the forum, and even if I could make a twin drift system, I wouldn't make it public.

This is a fairly good feature to have to 'sell' your server, and have people use your server rather than someone else's, so why give it away?
sinanju
S3 licensed
The 'stickers' can be edited - they are in fact, the same as your chosen number plate.
Options/Driver/Number plate



You are restricted to about 8 characters, and they will only show white on the window.
sinanju
S3 licensed
I'm not sure, but I don't think these UNameBefore/UNameBehind will work in a sub like that, as i'm sure they need a split/sector/lap Event to trigger, such as Event OnSpbSplit1( $userName ).

Maybe you could try with the distance done Event (Event OnDistDone)? If it does work, don't make it every single meter, but try every 10, 25, or 50?

Alternatively, maybe using Nodes, Zones or InSim circles in AutoX mode as the triggers?
sinanju
S3 licensed
Put this on my Sin'rs server, where some times and drift points have been recorded



All my times and scores should easily be beaten, but you might struggle against Willie's (Will.i.am) times.

If you compare my LX6 and FZ5 times against, that'll give you idea of how easy it should be to take my top spots away from me.
sinanju
S3 licensed
Quote from Siikais1 :But how can make layout loader on insim?

If you know what the commands are ....

<?php 
Autocross layout commands 
:

/
axlist X            :get list of layouts for track X e.gAU1
/axload X            :load layout X on host
/axsave X            :save layout X on host
/axlaps X            :set autocross number of laps
/axclear             :clear layout
?>


.... then you can probably use the cmdLFS command within a button.

If you want to see script that has cmdLFS in action, see HERE (Tim NL's Config GUI). It's a bit out of date now, but fairly easy to see how he used cmdLFS to load cars, tracks, etc. You just need to do something similar for autocross layouts.

To make sure they're the right commands, and they work, try typing these commands on your server.
sinanju
S3 licensed
Quote from Siikais1 :In last days i got 2 questions.

Quote :How to set drift score database for each layout?

At the moment its not yet possible, as there is no sql field for the layout, only the track.



As you can see from screen dump, it saves the track abbreviation (BL1X) as trackname, but if you use more than one layout on this track, then all the drift scores will get mixed up, and your current layout will show the old drift scores too.

It isn't just drift scores that will be affected, as sector and lap times will be too, as they are also only saved under track abbreviation.

The way I do it is to make new file directory for each and every layout, and only save times and points to that directory.

Quote :is a system that place layout via insim?

Probably, but as I replace a lot of files at once, I replace layout at same time, so I have no need for it.
sinanju
S3 licensed
Quote from JALKMFE :Amazing, you can't take a break while driving. Excellent. 10/10.

Glad you liked it Thumbs up

Made a slightly shorter track @ 6,290 metres / 3.1 miles, against original long track length of 6,927 metres / 4.3 miles - so 10% shorter. Removed some of the difficult hairpin turns (which I struggled with using keyboard).

Because it's shorter, used extra objects to put painted lines in centre of track in some corners.
sinanju
S3 licensed
Finally finished the layout, which I've attached in 1st post.
sinanju
S3 licensed
Just finished one of the walls right round the track - the high one on the left, that's meant to look cliff like.



Other side, with lower concrete walls, armco and some tyre stacks, is maybe quarter done; long way from being finished.

There are some floating overhead direction marker boards to help navigate round.

I won't be available to work on the layout again till early next week, so layout will stay 'as is' for next few days.

Be aware that if you complete a lap, and your time recorded in the top 12 on front screen, it will be wiped when I update layout. However, any times under 5 minutes will be saved by my InSim, so you can look at the !top times.

Drift scores: Regardless of time taken to get round, a complete lap will mean that any score will also be recorded/saved.

There are currently about a dozen drift scores saved, the highest just over 9,200, recorded by Willi.
BL1X The Long and Winding Road
sinanju
S3 licensed
Currently making a new layout - BL1X The Long and Winding Road.

It's supposed to look like a mountain road.



Although it's a Work in Progress, decided to put it on my server (Sin'rs), and work on it there.




Made a video of the lap while working out the length of the track - over 4 miles, which is almost 7,000 metres.



If you do decide to visit the server, you may find me there working on the layout.

Not sure I'll have enough objects to put sides to the road, and as road is up in air, possible that you can fall off if you try the layout.

I've actually fell off few times by hitting wall too hard, and tumbling over.

One of the vagaries of the LFSLapper insim that I use, is that it will not save any laps over 5 minutes long into its database, so if you do a lap, and it's longer than that, then it won't show when you look at the Top times, although if you take longer than 5 minutes, and you do complete lap, your drift scores will be saved.
Last edited by sinanju, . Reason : Finished and attached layout x 2 (long and short)
sinanju
S3 licensed
Some times set ...

BL1Y Twin Peaks
sinanju
S3 licensed
BL1Y Twin Peaks layout



Bit of plagiarism by me, in that I came across a video by Vano Paniashvili of his Touge Road layout (https://www.youtube.com/watch?v=nc9GgcmXXO0), and I thought I could make the same layout, using the same underlying track shape

I put layout on my Sin'rs server earlier, and Corse / BassB did some runs in various cars; one of which, I recorded and loaded onto youtube -

.

If you want to try a lap yourself, would be worth watching the video to see the route, as its not so obvious when you try it without knowing how to get to the finish line going via the sector splits, and if you miss a sector, no time/drift points will be recorded.
Last edited by sinanju, . Reason : Attached the layout
sinanju
S3 licensed
Added a pit area, and done some tidying up, so layout now looks like ...



Track length is approx. 2.78 miles / 4,470 metres.
sinanju
S3 licensed
On normal tracks (not X or Y configurations), the AI cars follow the programmed racing line. To see this line, press 4. This is a toggle (on/off). Colours generally mean Green for accelerate, yellow for lift and coast, and red for brake.

If you can see this line, then you know AI cars are going to follow it, so you can try driving slightly off this line to help with AI cars crashing into you.

Of course, the AI racing line can sometimes be the racing line you want to follow (especially on tracks with more corners), and it can be tricky both leading or following AI cars round when you both want to drive on the same line.

You can also go into Options/Misc and play with Update Path/AI using player setup/etc, to see if that helps/hinders.

Or, as nacim says, try online, and race against all sorts of level of players, usually all on the same server, from the drivers who forget to put pit limiter off, the truly awful, the so-so, all the way up to the 'aliens'.
Single lap of BL1Y Conundrum (layout wip)
sinanju
S3 licensed
Another layout, which I've called 'Conundrum.

Name came about as when making the layout, and trying it out as I was going along, couldn't decide which way I preferred driving it - clockwise or counter clockwise. So, I put a loop in, and you have drive one way, reach the loop, and go round it, then retrace the route you've just driven. Was going to put another loop in, but I mucked things up a bit, and rather than rip down a lot of track I'd built to do the 2nd loop, I put a sort of diversion in not far from start/finish line.

Layout still a work in progress, as I want to do a pit area, and tidy some bits up, see if I need more marker boards, etc.



You'll notice I drove quite badly - still using keys instead of wheel, and couple of times, got confused on which corner was coming up next. Not helped by the fact that the concrete ramps, when placed on the ground of the container park, blend right into the ground, so hard to see the walls, and turns. Old age, mild cognitive impairment and 20/30 vision does not a good driver make!
sinanju
S3 licensed
I'm not too hot when it comes to Set and Get vars, but I doubt lapper understands what the plus sign is for as it's not being used for an arithmatic function.

Nor do I understand
$["value"]

Maybe try;

SetStoredValue( $Var["value"] . " National ". GetCurrentPlayerVar( "National1" ) );

or

SetStoredValue( $Var["value"] . " National ",GetCurrentPlayerVar( "National1" ) );

I've seen Yisc[NL] use these Set / Get vars a lot in his code add-ons. Maybe you should have a look at some of his code to see how it's used, and the proper syntax.

Look here.
sinanju
S3 licensed
The most obvious thing that jumps out, is that you've not put a semi-colon ";" at the end of the line that calls the br_Fixtures sub (in your 2nd sub).

Add it to your 2nd last line and see how you get on.

A way to sometimes find errors is to look at the text file that ends -ERR.log within your default/logs directory. Usually, you'll be given the line number within the script add-on where the fault lies. Weirdly, in the case of a missing semi-colon, sometimes the line number will be given as the next line WITH a semi-colon, and you have to work backwards to find a line that doesn't have one.
sinanju
S3 licensed
Appreciate the video - way better driving than I managed. And your reflexes a lot quicker.

Tyre bundles mainly cover trees that I saw as obstacles, which are mainly from start to the bridge, as there is plenty of room and proper track in last section.
BL1X Woodland Sprint (offroad layout)
sinanju
S3 licensed
Offroad layout, mainly going round the outside of most of the container park, in the woodlands section.



I didn't want to show video of run as I crashed repeatedly (many times per run, and many, many runs), so just some images of various parts of the course ...



The layout if very narrow for most of the perimeter section as only part of the ground can be driven on (small narrow section outside the fenced area), and layout is for single timed runs.

For reference, my best time ...



As usual, if someone can post a video showing how it should be done, I'd be most grateful Thumbs up
sinanju
S3 licensed
I only used just over 1,300 objects out of 2,100 available, so plenty more could be added if required by anyone who wants to use the layout.

I originally had route markers, invisible marshalls and some slabs laid near edge of ramp wall, to act as a sort of pavement/sidewalk kerb, but I eventually removed all these to give bit more freedom to drivers to risk taking shortcuts over some of the bumps/corners.

There is risk taking too much of these corners as it can throw you off course, or cause you to spin, or go over edge, etc.

If you do go over the edge into the middle bits, I constructed some circular walls to play around in, as a sort of consolation for being out of a race.

Another reason for not putting too much more in, especially coloured objects, was that I wanted it to be difficult when racing someone, for the drivers to have difficulties in differentiating track surface from sloping walls. If they stuggle to make out route when racing someone, then there is a chance for the more visually acute to make up for eyesight what they may lack in driving skill.

Because there's a lot of grey on grey, it's very easy too miss something that might be in front of you when going at speed. If you look at video at about the 1:30 mark (near end), or if you race round the circuit, you'll find that the overhead concrete gantry that holds the lights is almost invisible. Some other objects elsewhere round the track are the same.

If anyone does decide to use this layout on their server, I'd love to see a replay to see what kind of mayhem might be involved in a race.
BL1Y Sandell
sinanju
S3 licensed
Layout for Blackwood.

Wanted to try making layout without fully vertical walls, which is why the sloping ramp walls all round.

Feels like you are driving in a groove, and with the muted colours of road and walls, everything looks almost sand coloured.



Think would be good layout for race, which isn't something I tend to have on my server.

YouTube video

FGED GREDG RDFGDR GSFDG