The online racing simulator
Searching in All forums
(882 results)
Bass-Driver
S3 licensed
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.
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
Small Update:
Its been a while since a worked on this project.
See the changelog below.

======================================
#Version: 0.02
======================================
-Judgebox
-Saving 2 drivers
-Few checks to load the next pair of drivers ( Save score/Next run/Next driver + "Are you sure" question)
-Driver Reset Button

-DriversBar
-Also Available in qualify mode
-Minor design change

-QualifyingList
-Converting from SignUp List (TextFile) to qualifying list (TextFile)
-PlayerInfo from qualifyinglist( Car/Points/Name etc) loaded into Array (For faster loading)
-Each new driver will be added to the list.
-Check online/offline playerstatus
-File saved when Lapper reboots or crashed.

-Global
-Minor bugfixes


Bass-Driver
S3 licensed
Have you add the script in Includes/Addonsused.LPR?
Also check the errorfiles.
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
Please post the code you are working.

If you create a new Script ( New LPR file). you must use CatchEvent/EndCatchEvent for every Event.

To display driftscoring you have to use the OnDriftScore event first.
Because that event will execute everytime you ended a drift/slide.

After That you can call a Sub.

CatchEvent OnDriftScore($userName) # Player event
Driftscore($userName);
EndCatchEvent

Sub DriftScore($userName)
#Blaaaaah
EndSub

But as i said in the first line. Post your code, so we can help you.
Bass-Driver
S3 licensed
This script is easily to create. You have to set the RegisterScheduleAction() function to 1 minute. It will executes the sub callback each minute.

And add a +1 to the playervar each time the sub executes.
Bass-Driver
S3 licensed
Well i have tried to fix the japanese character bug. But i failed, because i just dont understand, how the code works what Gai-Luron has written. With lack of Commentary lines it just makes it even harder to understand.

I have checked LFSForum posts and checked the sourcecode of Insim.Net, but no luck. creating debug textmessages with the values from each character to see if i could change the source doesnt even help.

So my question is:
If there's a developer around who can understand, how to encode LFSStrings. I will ask you to give a quick look in the sourcefile ( see attachment) and edit the bad stuff.

This is how the MST insim packet look like in Lapper.
This can be found in the insim4.cs file.(LFSLapper V7.0.4.6\src\insim4.cs) If you want to check the sourcecode of lapper.


<?php 
public byte[] MST(string msg)
        {
            
int msgLen msg.Length 63 63 msg.Length;

            
byte[] packet = new byte[68];
            
packet[0] = 68;
            
packet[1] = (byte)TypePack.ISP_MST;
            
packet[2] = 0;
            
packet[3] = 0;
            
InSim.CodePage.GetBytes(msg0msgLenpacket4);
            return 
packet;
        }
?>

Thank you.
How to create commands in LFSLapper.
Bass-Driver
S3 licensed
Hello to all new LFSLapper users


In this topic, i will do a fast explaination, how to add commands in LFSLapper.
  • 1) Open the 'LFSLapper.LPR' file in the 'default' folder (LFSLapper V7.0.4.6\bin\default\LFSLapper.LPR) with any texteditor application.

  • 2) Scroll down the file until you see the Event named "OnMSO"
    This should look like this:

<?php 
Event OnMSO
$userName$text # Player event

    
$idxOfFirtsSpace indexOf$text" ");

    IF( 
$idxOfFirtsSpace == -THEN
      $command 
$text;
      
$argv "";
    ELSE
      
$command subStr$text,0,$idxOfFirtsSpace );
      
$argv trimsubStr$text,$idxOfFirtsSpace ) );
    ENDIF
    
    SWITCH( 
$command )
     
    ENDSWITCH
EndEvent
?>


  • 3) Between SWITCH( $command ) and ENDSWITCH you can create CASE commands which is necessary for creating your own commands. This should look like this.

<?php 
SWITCH( $command )
    CASE 
"!yourcommand":
    
#Yourcode
    
BREAK;        
ENDSWITCH
?>

  • 4) Between CASE "!yourcommand": and BREAK; you can add your code. In the LFSLapper.LPR file there already some examples you can use ingame.
Bass-Driver
S3 licensed
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.
Bass-Driver
S3 licensed
New version released.
Check first post
Bass-Driver
S3 licensed
i think you should create something like this:

Event OnDriftScore($userName) # Player event
$AngleVelocity = GetCurrentPlayerVar( "AngleVelocity" );
IF (($AngleVelocity > 0)&&($AngleVelocity < 11)) THEN
#Button
ENDIF
IF (($AngleVelocity > 10)&&($AngleVelocity < 21)) THEN
#Button
ENDIF
IF (($AngleVelocity > 20)&&($AngleVelocity < 31)) THEN
#Button
ENDIF
#etc
EndEvent

Release : LFSLapper V7.0.4.6
Bass-Driver
S3 licensed
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 
?>


==========================================================
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
Really nice layout.

The 5 min laptime thingy is on my Lapper Todo List.

EDIT: i managed to set the max laptime to 30 min. Laptimes below 30 min will not be stored in the database.
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
We cannot help you with this question. You have to give more details about the insim.

-Library: InsimDotNet/LFSLapper/Prism
-Type of insim: Drift/Cruise etc
-Details about the type of insim: What must it do.

etc.
Bass-Driver
S3 licensed
Could you explain what you have done to fix this issue. Your fix could help some other lapperusers aswell.
Bass-Driver
S3 licensed
Create a "debug" message in the 'br_fixture_leftt' Sub. To see if the sub is actually working. If not , there might be a chance that the Parameters of that sub are wrong.
Check the errorfiles instead.

If the sub must open from a Clickable button, then this should be working.
Otherwise from a command:

CASE "!btn":
br_fixture_leftt($KeyFlags);
BREAK;

Sub br_fixture_leftt($KeyFlags)
EndSub

or

CASE "!btn":
br_fixture_leftt($userName);
BREAK;

Sub br_fixture_leftt($userName)
EndSub

Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
@ num13er & Yisc[NL]

I couldnt let it go, so i went finding out how to create a "simple" way to sort values in an array.

It took me some headaches but i finally came up with a solution. I hope it works also with Values from the Database etc.

Example code:

<?php 
CatchEvent OnMSO
$userName$text # Player event

    
$idxOfFirtsSpace indexOf$text" ");
    IF( 
$idxOfFirtsSpace == -THEN
      $command 
$text;
      
$argv "";
    ELSE
      
$command subStr$text,0,$idxOfFirtsSpace );
      
$argv trimsubStr$text,$idxOfFirtsSpace ) );
    ENDIF

    SWITCH( 
$command )

        CASE 
"!sort"#!sort asc or !sort desc
              
SortValues($argv);
            BREAK;
    ENDSWITCH
EndCatchEvent

Sub SortValues
($TypeSort)
    
$SaveNumber 0;
    
$Numbers "3|2|10|45|21|4|5|11|1|0|300|276|112";
    
$GetNumber SplitToArray($Numbers,"|");
    
$Count_GetNumber arrayCount$GetNumber );
    
    
#Add a '0' to the number to create a 2 or 3 digit number
    #This will also converts string to Numeric characters
        
FOR ($i=0;$i<$Count_GetNumber;$i=$i+1)
        
### Array with values from 0 - 10 ###
            
IF (ToNum($GetNumber[$i]) < 10THEN
                $GetNumber
[$i] = "00".$GetNumber[$i];
            ENDIF
        
### Array with values from 0 - 100 ###
            
IF ((ToNum($GetNumber[$i]) > 9) && (ToNum($GetNumber[$i]) < 100)) THEN
                $GetNumber
[$i] = "0".$GetNumber[$i];
            ENDIF    
        ENDFOR
    
    
###############
    ###Ascending###
    ###############
    
IF($TypeSort == "asc"THEN
        
#Sort values of array in Ascending order
        
FOR ($a=0;$a<$Count_GetNumber;$a=$a+1)
            FOR (
$i=$a;$i<$Count_GetNumber;$i=$i+1)
                    IF( 
$GetNumber[$a] > $GetNumber[$i]) THEN    
                    
                        $SaveNumber 
$GetNumber[$i]."";
                        
$GetNumber[$i] = $GetNumber[$a]."";
                        
$GetNumber[$a] = $SaveNumber."";
                        
                    ENDIF
            ENDFOR
        ENDFOR

        
privmsg("^7[Ascending sort]:");
        
#Display Values
        
FOR ($i=0;$i<$Count_GetNumber;$i=$i+1)
                
privmsg("Pos: [".$i."] = ".$GetNumber[$i]);
        ENDFOR
    ENDIF
    
    
################
    ###Descending###
    ################
    
IF($TypeSort == "desc"THEN
        
#Sort values of array in Descending order
        
FOR ($a=0;$a<$Count_GetNumber;$a=$a+1)
            FOR (
$i=$a;$i<$Count_GetNumber;$i=$i+1)
                    IF( 
$GetNumber[$a] < $GetNumber[$i]) THEN    
                    
                        $SaveNumber 
$GetNumber[$a]."";
                        
$GetNumber[$a] = $GetNumber[$i]."";
                        
$GetNumber[$i] = $SaveNumber."";
                        
                    ENDIF
            ENDFOR
        ENDFOR
        
privmsg("^7[Descending sort]:"); #New line
        #Display Values
        
FOR ($i=0;$i<$Count_GetNumber;$i=$i+1)
                
privmsg("Pos: [".$i."] = ".$GetNumber[$i]);
        ENDFOR
    ENDIF    
EndSub
?>


Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
There is an register/login addon for LFSlapper.


use the search option in Lfslapper forum for more info about this addon.
https://www.lfs.net/forum/post/1921021#post1921021
Bass-Driver
S3 licensed
Damn, never thought that this was so complicated to create a 'simple' sorting script for lapper. Schwitz

I think there must be a easier way to sort values.

But for you. You are already the Lapperguru. King of lapperscripting. Na-na
I'm feeling dumb, while i see you doing this. Schwitz

Nothing todo here.

*Flies away*
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
Well i havent created any sorting for my scripts yet.

according to the internet and translating to Lapper, it should look like this.

Sub SortValues($userName)
$TempNumber = 0;
$Numbers = "3|2|10|45|21|4|5|7|9|11";
$GetNumber = SplitToArray($Numbers,"|");
$ValueCount = arrayCount( $GetNumber );

FOR ($i=0;$i<$ValueCount;$i=$i+1)
FOR ($a=1;$a<$ValueCount;$a=$a+1)
IF ($GetNumber[ToNum($i)] < $GetNumber[ToNum($a)]) THEN
$TempNumber = $GetNumber[ToNum($i)];
$GetNumber[ToNum($i)] = $GetNumber[ToNum($a)];
$GetNumber[ToNum($a)] = $TempNumber;
ENDIF
ENDFOR
ENDFOR

### Display list ###

FOR ($j=0;$j<$ValueCount;$j=$j+1)
privmsg("| ".$j." / ".$GetNumber[ToNum($j)]);
ENDFOR
EndSub

but it simply doesnt work for some reason. atm i have no time to figure it out.
Bass-Driver
S3 licensed
yes it will work after adding the new event into your LFSLapper.LPR
Otherwise Lapper wont start.



#######################################################################################
#Get info about objects when adding/removing objects in AutoX editor
#######################################################################################
$DisplayObjectInfo = -1; #Set -1 to disable this event
Event OnObjectInfo($userName,$NumO,$Action,$X,$Y,$Z,$Flags,$Type,$InDex,$Heading) # Player event

EndEvent

Bass-Driver
S3 licensed
Hello,

Official version is released

Check first post for more information: https://www.lfs.net/forum/thread/90516-Release-%3A-LFSLapper-V7-0-4-5
Bass-Driver
S3 licensed
Must be cmdLFS("/spec " . $Var["value"] );

$Var["value"] = Current Username in the current loop

Because the FOREACH loop checks the Speed ForEach player.
Once the loop has detect overspeed, you have to Spec that player
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
I can admit it. It is a character bug.

have no idea what cause that. :S
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
Yeah , why didnt i thought about that. Frown
edited my first post.
Bass-Driver
S3 licensed
I talked to him, and his explaination: he want to display the online/offline status the serveradmin in his server.
Exacly what i thought.

But indeed, his first post could have more details.
FGED GREDG RDFGDR GSFDG