The online racing simulator
hi its me (AGAIN )

i was working with the foreach statement , but it only works with one IDbutton:
my idea was:

to make 1 IDbutton with the nickname and the other IDbutton to check if you are on the track or not.

the last one works but the IDbutton with the nicknames doesnt work.

question: how to make 2 differend ID buttons with the foreach statement


$RL_HT1 = 100;
$Racers = getListOfPlayers("N");
FOREACH( $maVar IN $Racers )
openGlobalButton($maVar["value"],1,$RL_HT1,17,4,5,-1,32,GetPlayerVar($maVar["value"],"NickName"));
IF (GetPlayerVar($maVar["value"], "OnTrack"))
THEN
openGlobalButton($maVar["value"],18,$RL_HT1,3,4,1,-1,32,"^2#");
ELSE
openGlobalButton($maVar["value"],18,$RL_HT1,3,4,1,-1,32,"^1#");
ENDIF
$RL_HT1=$RL_HT1+4;
ENDFOREACH

Start Debugging Error

Help
Quote from Bass-Driver :hi its me (AGAIN )

i was working with the foreach statement , but it only works with one IDbutton:
my idea was:

to make 1 IDbutton with the nickname and the other IDbutton to check if you are on the track or not.

the last one works but the IDbutton with the nicknames doesnt work.

question: how to make 2 differend ID buttons with the foreach statement

You're creating 2 buttons with the same name, so they won't be able to display at the same time. Add a description before or after the username to differentiate them like this:


<?php 
$RL_HT1 
100;
$Racers getListOfPlayers("N");
FOREACH( 
$maVar IN $Racers )
    
openGlobalButton("name_" $maVar["value"],1,$RL_HT1,17,4,5,-1,32,GetPlayerVar($maVar["value"],"NickName"));
    IF (
GetPlayerVar($maVar["value"], "OnTrack"))
    
THEN
        openGlobalButton
("ontrack_" $maVar["value"],18,$RL_HT1,3,4,1,-1,32,"^2#");
    ELSE
        
openGlobalButton("ontrack_" $maVar["value"],18,$RL_HT1,3,4,1,-1,32,"^1#");
    ENDIF
$RL_HT1=$RL_HT1+4;
ENDFOREACH
?>

hi,

my problem,

My server lfs is heberged by Gaming-solutions, staff has installed lfslapper6.12 for me.

i have configurate all files.

lfslapper.exe is running but insim is not in game !

i have verified all files and are ok !

sorry for my bad english i speak french,
Quote from Krayy :

<?php 
$OnIdleTimeout1 
120# Idle timeout for OnIdleAction1 in seconds
$OnIdleTimeout2 240# Idle timeout for OnIdleAction2 in seconds

CatchEvent OnLapperStart()
    
GlobalVar $Idlesystem;
    
GlobalVar $TimeIdle;
    
GlobalVar $TimeIdleWarning;
    
GlobalVar $IdleAction;

    
$Idlesystem "on";                   
    
$TimeIdle 600;
    
$TimeIdleWarning 540;
    
$IdleAction "spec";

    
$OnIdleTimeout1 $TimeIdleWarning;  # Idle timeout for OnIdleAction1 in seconds
    
$OnIdleTimeout2 $TimeIdle# Idle timeout for OnIdleAction2 in seconds
EndCatchEvent
?>



i have tried this but it set the 120 and 240 seconds and not the 600 and 540 sec.


i have this now:


<?php 
CatchEvent OnLapperStart
()
GlobalVar $OnIdleTimeout1;
    
GlobalVar $OnIdleTimeout2;

$Idlesystem "on";                    #Set idlesystem on/off (Standart = off)
    
$TimeIdle 600;                    #set Max IdleTime in Seconds (Standart = 600)
    
$TimeIdleWarning 540;                    #Set Idlewarning in Seconds (Standart = 540)
    
$IdleAction "spec";                     #Set IdleAction for wrong way drivers(kick/spec )(Standart = spec)

$OnIdleTimeout1 ToNum($TimeIdleWarning);
 
$OnIdleTimeout2 ToNum($TimeIdle);

?>

When i do my testcommand ill see that the variables gives the right values


<?php 
CASE "!t1":
privMsg"IdleWarning: " $OnIdleTimeout1);
privMsg"TotalIdleTime: " $OnIdleTimeout2);
BREAK;
?>

But it already gives the warning after 20 sec.
Did i missed something??
Quote from Bass-Driver :...

<?php 
CASE "!t1":
privMsg"IdleWarning: " $OnIdleTimeout1);
privMsg"TotalIdleTime: " $OnIdleTimeout2);
BREAK;
?>

But it already gives the warning after 20 sec.
Did i missed something??

I missed something actually...

You need to use the SetConfigVar command to set an internal variable and GetConfigVar to read it like this:


<?php 
CASE "!t1":
privMsg"IdleWarning: " GetConfigVar ("OnIdleTimeout1");
 
privMsg"TotalIdleTime: " GetConfigVar("OnIdleTimeout2");
 
SetConfigVar("OnIdleTimeout1"500);
SetConfigVar("OnIdleTimeout2"600);

privMsg"IdleWarning: " GetConfigVar ("OnIdleTimeout1");
privMsg"TotalIdleTime: " GetConfigVar("OnIdleTimeout2");
BREAK;
?>

Give that a try. (you may need to quote the values for the SetConfigvar command)
k thx it works

i'm trying to set the speedtrap manually ingame.
i have this so far , after alot of debugging.
i have no errors ( YAAY ) but it doesnt work.

it shows the value when i set the speedtrap.


Sub DisplaySpeed( $userName )
PrivMsg( langEngine( "%{main_speedtrap}%" , ToPlayerUnit( GetCurrentPlayerVar( "InstantSpeed" ) ),GetCurrentPlayerVar("UnitSpeed") ) );
EndSub

Event OnLapperStart()
RegisterNodeAction( getLapperVar( "ShortTrackName" ) , GetStoredValue("node") , DisplaySpeed,"");

EndEvent



CASE "!setspeedtrap":
CASE "!ssp1":
$node = GetCurrentPlayerVar( "CurrNode" );
SetStoredValue( "node", $node);
privMsg( "Set Speedtrap " .GetStoredValue( "node"));
$node1 = GetStoredValue( "node");
BREAK;

See attached for a radar/speed trap I use on my server - main coding was by Krayy - I just tweaked it slightly to suit my layout and added in nodes.
Attached images
Speedtrap.png
Attached files
radartrap.zip - 5.4 KB - 322 views
looks nice , but thats not i want
i want to try something new: like setting the nodes , zones from ingame
like i want to do i my previous post.
Quote from Bass-Driver :k thx it works

i'm trying to set the speedtrap manually ingame.
i have this so far , after alot of debugging.
i have no errors ( YAAY ) but it doesnt work.

it shows the value when i set the speedtrap.


The first problem is that you are using one variable name for all of the nodes, so if you go to use SetStoredValue, the next time you run the command it will overwrite the value. Better to use a variable name that's based on the track short name and then store the nodes as a comma delimited list. Then you can use split to turn them into an array and use a FOREACH to go through all of them.


<?php 
Sub DisplaySpeed
$userName )
    
PrivMsglangEngine"%{main_speedtrap}%" ToPlayerUnit(  GetCurrentPlayerVar"InstantSpeed" ) ),GetCurrentPlayerVar("UnitSpeed")  ) );
EndSub

CatchEvent OnLapperStart
()
   
Globalvar $SplitNodes;
EndCatchEvent

CatchEvent OnNewPlayerJoin 
$username# Lapper event
    
SplitNodeLoad();
EndCatchEvent

Sub SplitNodeLoad 
()
    
$SplitNodes GetStoredValuegetLapperVar"ShortTrackName" ) . "SplitNodes");
    
$Nodes SplitTOArray$SplitNodes "," );
    FOREACH 
$Node in $Nodes
        RegisterNodeAction
getLapperVar"ShortTrackName" ), $NodeDisplaySpeed""); 
    ENDFOREACH
EndSub

Sub SplitNodeSet 
$NewNode)
    IF ( 
indexOf$SplitNodes$NewNode) < THEN
        $SplitNodes 
$SplitNodes "," $NewNode;
        
RegisterNodeActiongetLapperVar"ShortTrackName" ), $NewNodeDisplaySpeed""); 
        
privMsg"Set Speedtrap " $NewNode);
        
SetStoredValuegetLapperVar"ShortTrackName" ) . "SplitNodes"$SplitNodes);
    ENDIF
EndSub

CASE "!setspeedtrap":
CASE 
"!ssp1":
    
SplitNodeSet (GetCurrentPlayerVar"CurrNode" ));
BREAK;
?>

This code is by no means complete so should require a bit of testing, but essentially the main stuff is in there. I just use OnPlayerJoin as it will load all nodes each time a player leaves pits.
hmmm wow i didnt know it whould be so complex
i have to understand the code first before i use it . i'm not a guy who said kthxbye after getting the code.

so what it does is : everytime u enter the command it will save the code in a array.
And when u are driving and a value of that array is equal with your current node it shows the messages.

could u explane what the code below does??

IF ( indexOf( $SplitNodes, $NewNode) < 0 ) THEN
$SplitNodes = $SplitNodes . "," . $NewNode;




is it like :
$SplitNodes = 1,2,3,4,5,6,7
$NewNode = your node u have set

so in the array it should be like this??

1,234
2,567
3,463
etc
That's a safeguard against adding a node that already exists. Essentially if you park you car in a sport and then type !setnode (or whatever u call it) the code looks in the list of existing nodes (comma separated). If it finds it's already there, then it skips it.

Of course, you would need to put code in to be able to delet nodes so that if you reposition one, then you can remove or update it, so yes, there is a lot more to do to make it a workable system. But since it's something that I'd probably use, I might throw some time into getting a workable system up with a GUI interface etc to enable node modification or deletion.
thx krayy for the explaination,
and thx for the basic code.

The delete and update part whould be a challange , but thats what i like xd
i found a error while testing and debugging the code

Sub SplitNodeLoad ()
$SplitNodes = GetStoredValue( getLapperVar( "ShortTrackName" ) . "SplitNodes");
$Nodes = SplitTOArray( $SplitNodes , "," );
FOREACH ($Node IN $Nodes)
RegisterNodeAction( getLapperVar( "ShortTrackName" ), $Node, DisplaySpeed, "");
globalMsg($Node);
ENDFOREACH
EndSub

$Node has the value : Array , and the not 1 single value from that Array
For test i have set a bunch of nodes:
$SplitNodes Values: ,479,482,483,484,485,487,489,490,491,492
it should be shown as:

479
482
483
etc...........

and it gives a error:

11/11/2011 6:32:18 PM -> Syntax error in cfg file "./includes/[TI]SpeedTrap.lpr" at line #62
'RegisterNodeAction' parameter #1(Array) is wrong type at line #
Function 'splitnodeload' script aborted
Quote from Bass-Driver :
$Node has the value : Array , and the not 1 single value from that Array
For test i have set a bunch of nodes:
$SplitNodes Values: ,479,482,483,484,485,487,489,490,491,492
it should be shown as:

479
482
483
etc...........

and it gives a error:

11/11/2011 6:32:18 PM -> Syntax error in cfg file "./includes/[TI]SpeedTrap.lpr" at line #62
'RegisterNodeAction' parameter #1(Array) is wrong type at line #
Function 'splitnodeload' script aborted

Problem is the FOREACH (told you it was buggy).

It should be:

<?php 
     
FOREACH ($Node IN $Nodes)
            
RegisterNodeActiongetLapperVar"ShortTrackName" ), $Node["value"], DisplaySpeed"");
  
globalMsg($Node); 
    ENDFOREACH
?>

...I think ;-) The FOREACH puts each entry into an array, so you need to deference using ["value"].

You can also use the dumpvar function to see what the contents of an array are

<?php 
$Health 
strFormat("{0:0}",GetCurrentPlayerVar"Health" ) );
PrivMsg("".$Health."");
?>

Do you know why not work?


<?php 
openPrivButton
"Health",51,6,$Health,3,3,-1,16,"");
Or
openPrivButton"Health",51,6,strFormat("{0:0}",GetCurrentPlayerVar"Health" ) ),3,3,-1,16,"");
?>

Quote from LFSCruise :

<?php 
$Health 
strFormat("{0:0}",GetCurrentPlayerVar"Health" ) );
PrivMsg("".$Health."");
?>

Do you know why not work?


<?php 
openPrivButton
"Health",51,6,$Health,3,3,-1,16,"");
Or
openPrivButton"Health",51,6,strFormat("{0:0}",GetCurrentPlayerVar"Health" ) ),3,3,-1,16,"");
?>


Because you have the parameters out of order. The 4th field is the button width. make it 10 or something like:



<?php 
openPrivButton
"Health",51,6,10,3,3,-1,16,$Health);
Or
openPrivButton"Health",51,6,10,3,3,-1,16,strFormat("{0:0}",GetCurrentPlayerVar"Health" ) ));
?>

No no no I need it to be width.
Sliding bar after 0:50 nnes length of 50 Health.
Quote from LFSCruise :No no no I need it to be width.
Sliding bar after 0:50 nnes length of 50 Health.

If thats the case you will need to use the health as a divisor of whatever the max health is to make a percentage.

i.e. If the max length the health bar can be is 50 units, then the calculation would be:


<?php 
$HealthbarLength 
50 * (GetCurrentPlayerVar"Health" ) / $MaxHealth
?>

Do you know what to do in that unwritten: IS_BTN - invalid dimensions ?
Hy , my question is how to configure that new 6.0.1.2 lapper to work how I want.

*I want to put my own layouts
* To show the Drifting Score with drift meter
* To sow the personal best.

And one thing ... I dont know how to login as admin and change layout on dedi server ....
Attached files
help.rar - 24 KB - 262 views
Quote from sarxes :Hy , my question is how to configure that new 6.0.1.2 lapper to work how I want.

*I want to put my own layouts

The standard Autocross layout commands are:


<?php 
/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
?>


In the LFSLapper.lpr file, look for the Event OnLapperStart() section

Add extra line - something like

cmdLFS("/axload X ");

(where X is name of your layout

Quote from sarxes :

* To show the Drifting Score with drift meter

Read this thread HERE especially post 4

Quote from sarxes :
* To s(h)ow the personal best.

Read this thread HERE especially post 2
Thx mate u helped me a lot ... I have 2 question ...

For what is useful the pitboard ?

Can I set a teritorry on the layout where the idle timer is not timeing ? I want to make a "pit" in AU1 layout where players could stay without kicking to spectate

My questions is in picture what i attached !
Attached images
how.jpg
Pitboard
The pitboard is good for seeing if you're faster or slower in the different splits and/or sectors.

If you don't want to show the pitboard, use either the !closepb or !config commands to set pitboard. This will only work for player inputting command.

Start
You can only set one Start position in a layout.

This is an LFS game restriction.

Idle
Good question.

Probably using RegisterZoneAction and associated sub-routine -

e.g.
In the Event OnLapperStart() section, add an additional RegisterZoneAction

RegisterZoneAction( "AS3R" , -621,-440, 3 , SR_Idle,"" );

Then after the EndEvent line, add an additional sub-routine like

Sub SR_Idle()
$OnIdleTimeout1 = 998;
$OnIdleTimeout2 = 999;
EndSub

Not sure that will work exactly, and you may have to play around with size of the zone - or put in multiple adjoining zones.
Thx mate u ar the best, its working for me !!!!!!! ThX for all !!! sinanju
This thread is closed

Config help
(1112 posts, closed, started )
FGED GREDG RDFGDR GSFDG