The online racing simulator
Quote from Fire_optikz001 :mass server message
i was wondering if there was a way to make a command like !msm that works like cmdlfs in the command prompt is there a way to do this?

I'm not 100% sure I understand your question, but here's some code I made a while ago:


<?php 
Event OnMSO
$text # Player event
    
SWITCH( $command )
        CASE 
"!msg":
            IF( 
UserInGroup"admin"$userName ) == )
            
THEN
              openPrivButton
"send_msg",52,0,48,5,5,-1,32,"^3Click to resend message: &" .GetCurrentPlayerVar ("message"),rcm_msg );
              
openPrivButton"write_send_msg_bg",100,0,48,10,5,-1,32,"" );
              
openPrivTextButton"write_send_msg",100,5,48,5,5,0,"^3Write message and click OK (max. 50 characters)","^2Click to type and send a message",50,rcm_written_msg );
              
openPrivButton"close_msg",148,0,10,10,5,-1,32,"^1X",close_msg );
            ELSE
              
privMsg"^1You are not allowed to open that");
            ENDIF
            BREAK;
    ENDSWITCH
EndEvent

Sub rcm_written_msg 
$message )
    
SetCurrentPlayerVar ("message""^2".$message);

    
cmdLFS "/rcm ^2" $message );
    
cmdLFS "/rcm_all" );
    
openPrivButton"send_msg",52,0,48,5,5,-1,32,"^3Resend message: &^8" .GetCurrentPlayerVar ("message"),rcm_msg );
EndSub

Sub rcm_msg 
$KeyFlags $argv )
    
cmdLFS "/rcm ^2" GetCurrentPlayerVar "message" ) );
    
cmdLFS "/rcm_all" );
EndSub

Sub close_msg 
$KeyFlags $argv )
    
closePrivButton "send_msg&write_send_msg_bg&write_send_msg&close_msg" );
EndSub
?>


A good thing and (i think) not too hard to code would be a command to force track/car rotation like !rotate with a random rotation.
Hello my old friend Gai-Luron ,

I am now in this version, and I have a small "big" request.

All default Event, are defined in the LFSlapper.lpr main file, and we can overwrite them in our includes.

I do not like to modify default files, and I would like to keep all customization in my own lpr without loosing default or "new release" default modification in the LFS Lapper.

Is it or would it be possible to have an implementation which allow to call back default event:

Here is an example:

LFSLapper.lpr:
Event OnLapperStart ()
do 1;
do 2;
etc..
End of Event


and my own lpr
Event OnLapperStart () #overwrite of default
LFSlapper.OnLapperStart();
do my own 1
do my own 2:
etc;
endofEvent

this execute first the default content and then my own additional code.

Thanks,
Loco
Quote from Yisc[NL] :I'm not 100% sure I understand your question, but here's some code I made a while ago:


<?php 
Event OnMSO
$text # Player event
    
SWITCH( $command )
        CASE 
"!msg":
            IF( 
UserInGroup"admin"$userName ) == )
            
THEN
              openPrivButton
"send_msg",52,0,48,5,5,-1,32,"^3Click to resend message: &" .GetCurrentPlayerVar ("message"),rcm_msg );
              
openPrivButton"write_send_msg_bg",100,0,48,10,5,-1,32,"" );
              
openPrivTextButton"write_send_msg",100,5,48,5,5,0,"^3Write message and click OK (max. 50 characters)","^2Click to type and send a message",50,rcm_written_msg );
              
openPrivButton"close_msg",148,0,10,10,5,-1,32,"^1X",close_msg );
            ELSE
              
privMsg"^1You are not allowed to open that");
            ENDIF
            BREAK;
    ENDSWITCH
EndEvent

Sub rcm_written_msg 
$message )
    
SetCurrentPlayerVar ("message""^2".$message);

    
cmdLFS "/rcm ^2" $message );
    
cmdLFS "/rcm_all" );
    
openPrivButton"send_msg",52,0,48,5,5,-1,32,"^3Resend message: &^8" .GetCurrentPlayerVar ("message"),rcm_msg );
EndSub

Sub rcm_msg 
$KeyFlags $argv )
    
cmdLFS "/rcm ^2" GetCurrentPlayerVar "message" ) );
    
cmdLFS "/rcm_all" );
EndSub

Sub close_msg 
$KeyFlags $argv )
    
closePrivButton "send_msg&write_send_msg_bg&write_send_msg&close_msg" );
EndSub
?>



ok u know you know in the exe u type cmdlfs (msg)? and it sends it to all the server insim is connected to? well i wanna do that from inside lfs with a command u have any idea?

i was thinking of some type of lapper addon would work
Quote from Fire_optikz001 :ok u know u=in the exe u type cmdlfs (msg)? welli wanna do that from inside kfs with a command u have any idea?

i was thinking of some type of lapper addon would work

Please try to write normal english since it's very hard to understand what you want to say.
The code I posted can be accessed within Lapper by writing !msg which brings up a box to type a text and send it to all players as an RCM.
now look at it
Hello,

Is there a way to catch the end of race event?
I am not talking about the onResult.

I need really the End for the server, not the player.

Thanks,
Loco
There is not end of race in LFS. Just start new race or qualify. One reason is that a player can never pass the finish line if he want.

LFS never end a race. i hope i'am clear

Gai-Luron
Thx,
On what do you base the time for the automatic restart ?
Is it the finish(onResult) for the first one which cross the line?
Loco
Quote from loconstant :Thx,
On what do you base the time for the automatic restart ?
Is it the finish(onResult) for the first one which cross the line?
Loco

Event OnFinish
DelayedCommand( 30, Restart );
EndEvent

Sub Restart()
cmdLFS ( "/restart"
);
EndSub
Hi Bass-Driver,

thanks but this is not what I am looking for.
I think the onFinish is not for a race but for the global event finish.

I just need to know when you activte the autorestart: when the time start for the delay.

Cheers
Quote from loconstant :Hi Bass-Driver,

thanks but this is not what I am looking for.
I think the onFinish is not for a race but for the global event finish.

I just need to know when you activte the autorestart: when the time start for the delay.

Cheers

so if i understand what u mean

u want start with a ! command like for example : !startdelay
??
Thanks Bass, I changed my mind, and tried to use cmd LFS instead of embedded Lapper restart function.

So I insert, my restartAutoMain() in my onResult. BUT the automatic LFSLapper rotateTrack does not work anymore. Is there some incompatibilities with cmdLFS ( "/restart" ); ??


Sub restartAutoMain()
privMsg( "Test" );
DelayedCommand($restart_A-15, restartAutoDisplay);
DelayedCommand($restart_A, restartAuto);
EndSub

Sub restartAuto()
cmdLFS ( "/restart" );
EndSub

Sub restartAutoDisplay()
openGlobalButton ("test",70,100,60,20,4,15,16,"^7Restart in (%cpt%) second(s)");
EndSub

Cheers
Quote from loconstant :Thanks Bass, I changed my mind, and tried to use cmd LFS instead of embedded Lapper restart function.

So I insert, my restartAutoMain() in my onResult. BUT the automatic LFSLapper rotateTrack does not work anymore. Is there some incompatibilities with cmdLFS ( "/restart" ); ??


Sub restartAutoMain()
privMsg( "Test" );
DelayedCommand($restart_A-15, restartAutoDisplay);
DelayedCommand($restart_A, restartAuto);
EndSub

Sub restartAuto()
cmdLFS ( "/restart" );
EndSub

Sub restartAutoDisplay()
openGlobalButton ("test",70,100,60,20,4,15,16,"^7Restart in (%cpt%) second(s)");
EndSub

Cheers

are u sure that u have $EnableRotation = true;
cmdLFS ( "/restart" ); works the same as /restart

i dont have time now to test the code sry
i will test it after a few hours


this is what i have but then for another command
i have edit it for u
i think it works the same but the code is differend

#################
#Event OnResult#
#################
Sub racerestart1
openGlobalButton( "racerestart",1,90,24,5,1,-1,16,"^7 RACE RESTART IN ");
openGlobalButton( "racerestartcounter1",1,95,24,20,1,1,0,"^7 15",racerestart);
EndSub

Sub racerestart($KeyFlags,$id)
closePrivButton("racerestartcounter1");
openGlobalButton( "rcrestartcounter2",1,95,24,20,1,14,0,"^7 %cpt% ", endracerestartcounter );
EndSub

Sub endracerestartcounter($KeyFlags,$id)
closePrivButton("racerestartcounter1&racerestartcounter2&racerestart");
cmdLFS ( "/restart" );
EndSub

Thanks,

But no need to test.

There is incompatibility, rotate only work with AutoRestartRaceSec.
As sson, I disable it, rotate does not work....
Quote from loconstant :Thanks,

But no need to test.

There is incompatibility, rotate only work with AutoRestartRaceSec.
As sson, I disable it, rotate does not work....

oh ok
thx for report
because i dont use rotate track,
but i want use it in future with the code i gived u in the post above.
Gai-Luron: if you are around here

I have an issue, you provided me a beta version but I do no have the src.

I would need a way to use the same piece of code you have in the loop.cs

if (newCfg.varsLapper.RotateCars != "")
{
SendMsg("/cars=" + tmpCars[currRace.currRotateCar]);
newCfg.executeFunction("OnRotateCar", null, null);
RestartTimer();
}
if (newCfg.varsLapper.RotateTracks != "")
{
SendMsg("/track=" + tmpTracks[currRace.currRotateTrack]);
newCfg.executeFunction("OnRotateTrack", null, null);
}

and call it from my lpr file. Is it possible?

Thax,
Loco
Hello,
I think having "setlappervar" would be nice in fact
Loco
Thanks to Gai-Luron, I had a beta version which solved my issue.
scheduled event for certain players
hi i was wondering if there was a scheduled event for certain players

or a way to add one
Now that GLScript can pass arrays back to your lapper scripts, is there any chance of modifying the GL function "split" to return a multi value array that's split on the splitChar instead of a single string?
Hello,

Can you give me an example, i don't understand what you say
Quote from Gai-Luron :Hello,

Can you give me an example, i don't understand what you say

Currently if I have a list with a know separator, you need to iterate through a number of splits to process all items in that list. i.e:


<?php 
$racers 
4aged,krayy,kumarakid,steala;
    
$IsNotBlank 1;
    
$GroupIndex 0;
    WHILE (
$IsNotBlank == 1)
        
$racer=split$racers,",",$GroupIndex );
        IF ( 
$racer!= ""THEN
            privMsg 
($racer);
            
$GroupIndex $GroupIndex 1;
        ELSE
            
$IsNotBlank 0;
        ENDIF
    ENDWHILE
?>

if we were able to conver that string to an array like the .NET split function does, then we can use the FOREACH loop:


<?php 
$racers 
4aged,krayy,kumarakid,steala;
    FOREACH( 
$racer IN split$racers,","))
            
privMsg ($racer);
    ENDFOREACH
?>

sort of like this....

GLScript.cs:

<?php 
                
case "splittoarray":
                    if (
nbArgs != 2)
                        throw new 
GLScriptException("Incorrect args number in function " val.nameFunction);
                    
val.typVal GLScript.typVal.setOfVar;
                    
val.setVars = new GLScript.SetOfVars();
                    
string tmpSc = (string)args[1];
                    
char splitChar tmpSc[0];
                    
string[] splited = (args[0] as string).Split(splitChar);
                    for (
int i 0splited.Lengthi++)
                    {
                        
val.setVars.Set(i.ToString(), new unionVal(0"\"" splited[i] + "\""typVal.str));
                    }
                    return;
?>

LFSLapper.lpr:

<?php 
        
CASE "!ta":
                    
$Racers "gul,4aged,krayy,kumarakid,steala";
                    
$RacerList SplitToArray($Racers",");
                    
dumpvar($RacerList);
                    FOREACH ( 
$ra IN $RacerList )
                        
# Do something with the entire list of vars like check membership etc
                        
privMsg $ra["value"] );
                    ENDFOREACH
                    BREAK;
?>

Okay , when i read split, i think about LFS splitting, not the split command. It's for this i don't understand what you say.

You are rigth, i do it ASAP : SplitToArray

Thank's

Gai-Luron

FGED GREDG RDFGDR GSFDG