The online racing simulator
[Solved] RegisterStreetAction() help
Hello all!

I'm nearly finishing off my cruise script that is running by LFSLapper 7.0.4.10
So i'm trying to add street names, i know registerzoneaction could work, but that would be too much of a hassle if there is another way to identify a street, so Bass-Driver told me that lapper has registerstreetaction since 7.0.4.7.

If you want to help me, the server is online everyday, which is called [SC] Cruise Server S2

I tried to use RegisterStreetAction("Highway","AS5X",7,857,-524,140,-109,HighwayEnter,"");
but it seems to crash everything and cause the rest of the script to malfunction...
I've literally copied and pasted the streetaction from the lfslapper changelog but it also malfunctioned. (From danny's changelog)

Am I only left out with RegisterZoneAction or is the streetaction bugged out?
Usualy when Lapper 'crashes' things are written in the logfile (unless the whole application crashes and Windows tells you that the application stopped working).
If there are errors written in the logfile, that might point you in the right direction of what is going wrong.
Right after this message I will test my own CfL streetcode and see if it's still working or not, using Lapper 7.0.4.10
I've justed tested my 'CfL - Street registration system' and it seems to work nicely.

This is the GUI to define the street:



After I pressed 'Store street' the actual code that's happing is shown on Lapper console:



When I enter the street, the HUD is showing in which street I am and what the maximum speed is:



And when I left the defined street, the HUD is cleared again:

Attached images
Capture1.PNG
Capture2.PNG
Capture3.PNG
Capture4.PNG
Quote from Yisc[NL] :I've justed tested my 'CfL - Street registration system' and it seems to work nicely.

This the GUI to define the street:



After I pressed 'Store street' the actual code that's happing is shown on Lapper console:



When I enter the street, the HUD is showing in which street I am and what the maximum speed is:



And when I left the defined street, the HUD is cleared again:

Huh? it doesn't work for me at all, even getting the source itself from danny didnt work... what did you write exactly? (nvm dont reply to this, pics finally loaded. i'll post update to see if it will work)
RegisterStreetAction now works.

But it's not identified by the subs i guess...

Sub HighwayStreet($userName)
PrivMsg("entered highway!");
EndSub
My streets are stored in an array, so I made two subs 'EnterStreet' and 'LeaveStreet' and then walk through the street array, to grab the corresponding information.

If you used the code provided in your first post, being:


<?php 
RegisterStreetAction
("Highway","AS5X",7,857,-524,140,-109,HighwayEnter,"");
?>

Then your Sub should be:

<?php 
Sub HighwayEnter 
$userName )
EndSub
?>


Alright, let me break this down for you.

<?php 
RegisterStreetAction
("Highway","AS5X",10,-620,-259,-620,-323,HighwayEnter,"");
?>

Doesn't work, I've received an error saying incorrect number of parameters, so I double checked and saw that weirdly, RegisterStreetAction doesn't use ; at the end.

So i removed it and this is how it looks.

<?php 
RegisterStreetAction
("Highway","AS5X",10,-620,-259,-620,-323,HighwayEnter,"")
?>

That worked, so I created the HighwayEnter sub, added a privmsg debug to see if it's recognized, but there's no output at all once i drive in the area i registered.. I tried tinkering with the syntaxes in the RegisterStreetAction, ended up with

<?php 
RegisterStreetAction
(Highway,AS5X,10,-620,-259,-620,-323,HighwayEnter,"")
?>

which also worked, but there's no output from the sub that i created already. I know how to set zones, timers, subs and everything, but since RegisterStreetAction is new, and what i feel like is completely bugged out, i have no idea what's going on.
what happends if you add the leavestreet sub routine?
I will look into this and will come back to you within a few hours.
** Best answer **
I've created this little test-script for streets, tested it and it's working as intended.
The 'test_street' is situated down the pitlane of track BL1 (see attached screenshot).


<?php 
CatchEvent OnLapperStart
()
    
OnLapperStart_test_street();
EndCatchEvent

Sub OnLapperStart_test_street
()
    
$street_width=5;
    
$start_street="-40,300";
    
$end_street="-14,373";
    
$street_values="".$street_width.",".$start_street.",".$end_street;
    
RegisterStreetAction"test_street","BL1","".$street_valuesEnterStreet LeaveStreet );
EndSub

Sub EnterStreet 
($userName)
    
SetCurrentPlayerVar"current_street"GetCurrentPlayerVar"idCurrStreet" ) );
    
PrivMsg "^7You are now driving on: " GetCurrentPlayerVar"current_street" )  );

Endsub

Sub LeaveStreet 
($userName)
    
PrivMsg "^7You have now left: " GetCurrentPlayerVar"current_street" ) );
    
SetCurrentPlayerVar"current_street""" );
Endsub
?>


Attached images
Capture.PNG
Quote from Yisc[NL] :I've created this little test-script for streets, tested it and it's working as intended.
The 'test_street' is situated down the pitlane of track BL1 (see attached screenshot).


<?php 
CatchEvent OnLapperStart
()
    
OnLapperStart_test_street();
EndCatchEvent

Sub OnLapperStart_test_street
()
    
$street_width=5;
    
$start_street="-40,300";
    
$end_street="-14,373";
    
$street_values="".$street_width.",".$start_street.",".$end_street;
    
RegisterStreetAction"test_street","BL1","".$street_valuesEnterStreet LeaveStreet );
EndSub

Sub EnterStreet 
($userName)
    
SetCurrentPlayerVar"current_street"GetCurrentPlayerVar"idCurrStreet" ) );
    
PrivMsg "^7You are now driving on: " GetCurrentPlayerVar"current_street" )  );

Endsub

Sub LeaveStreet 
($userName)
    
PrivMsg "^7You have now left: " GetCurrentPlayerVar"current_street" ) );
    
SetCurrentPlayerVar"current_street""" );
Endsub
?>



Now i see what you did there! it's kinda strange since it acts a bit different that ZoneAction.
Thank you!
This thread is closed

[Solved] RegisterStreetAction() help
(12 posts, closed, started )
FGED GREDG RDFGDR GSFDG