The online racing simulator
W.I.P: ZoneBuilder
Hello,

==============================================================================
NOTE: If you dont know how to create zones or doesnt know what a zone is, please read the topic below.

https://www.lfs.net/forum/thread/89860-Nodes-and-Zones
Shoutout to Sinanju for making this tutorial
==============================================================================

This script is build within version 7.0.4.11. And havent used any new features that arent compatible with the older versions of lapper.
There are still a few things left todo. Please report bugs.

Since Publishing Lapper 7.0.4.6, someone asked me, if it is possible to set zones/area's more easily.
I have build a script that will store the Zones you saved within a menu.
Since the team doesnt exist anymore and the servers are off. I have decided to make this script public.

Features:

-Create multiple files and multiple Zones within the file.
-It stores the X / Y / Z axis and the carheading , the carheading will only be used for testing.
-Test single Zone's (Button will displayed with the text: 'Entered Zone' / 'Leaving Zone')
-Test Entire files
-Delete Zones
-Delete files.(Under development

Couple of ideas that makes this script usefull.

-CruiseServers: Set/store your locations like : The Cardealer / The Store etc.
-Creating checkpoints. Respawn to your last checkpoint.
-Off/OnTrack Detection

How to start:
-Download the files and place them in the 'include' directory of the latest version of Lapper.
-Open Addonsused.LPR and add the line: include( "./ZoneBuilder/Global.LPR");
-Start or reload lapper and type the command !zb or !zonebuilder.


How to Create a zone:
-Drive to the location you want to create your zone.
-Enter a filename (existing or a new one)
-Enter the width of the zone.
-Enter ZoneID. Give it a propername so that you know for which zone it is. NO SPACES!!
-Enter the name of the Sub Callback when someone ENTERED the zone. NO SPACES!!
-Enter the name of the Sub Callback when someone LEAVES the zone. (You can keep this empty is necessary) NO SPACES!!
-Keep the X/Y/Z empty if you are already in the The Zone. Otherwise you can enter this manually, if you know the location.
-The ZoneBuilder will save your carheading at your current spot. You also can enter this manually.
-Click on SAVE ZONE.

How to load the entire file into my script:

-The zoneline inside the file will look like this:
#-148|39|10|2|testzoneid|tralala|trololol|329

#X-Axis | Y-Axis | Z-Axis | WidthOfArea | ZoneID | EnterZone | LeaveZone | CarHeading
#$Line[0] | $Line[1] | $Line[2] | $Line[3] | $Line[4] | $Line[5] | $Line[6] | $Line[7]

If you have saved zones into the file and you want to load it into your (Cruise)(Checkpoint) script. you could use the code below.


<?php 
CatchEvent OnLapperStart
()
    
GlobalVar $GetFileDir;
    
GlobalVar $GetFileName;      
    
$GetFileDir "includes/ZoneBuilder/Files/"#Folder of where the file of zones is saved
    
$GetFileName "Name Of The File Here";               #Name of the file that need to be loaded
    
    #Get zones from the files
    
UserGroupFromFile(""$GetFileName"" $GetFileDir"" $GetFileName".txt" );
    
#Convert them to a array
    
$GetListFromFile GetListOfUsersGroup(""$GetFileName );
    
#Calculate the amount of zones in the file.
    
$GetMaxLinesFromFile arrayCount$GetListFromFile );
    
#Get List from File
    #X-Axis | Y-Axis | Z-Axis | WidthOfArea | ZoneID |  EnterArea  | LeaveArea | CarHeading
    #$Line[0] | $Line[1] | $Line[2] | $Line[3] | $Line[4] | $Line[5] | $Line[6] | $Line[7]
        
FOR ($NrOfRows=0;$NrOfRows<$GetMaxLinesFromFile;$NrOfRows=$NrOfRows+1)
            
$Line SplitToArray($GetListFromFile[$NrOfRows], "|");
            
#Check if the Arrays aren't empty
            
IF (($Line[0] != "")||($Line[1] != "")||($Line[4] != "")) THEN
                RegisterZoneAction
("".$Line[4].""getLapperVar("ShortTrackName") , $Line[0] , $Line[1] , $Line[3], $Line[5], $Line[6]);
            ENDIF
        ENDFOR
EndCatchEvent
?>


Attached images
ZoneBuilder.jpg
Attached files
ZoneBuilder.zip - 6.6 KB - 296 views
First version of the ZoneBuilder is available.
Quote from Bass-Driver :First version of the ZoneBuilder is available.

is something available like this for executable insim? C#
No there isnt. But whats wrong with this Addon for Lapper?
Load the script into lapper and start Lapper. Because Lapper is also a executable?

FGED GREDG RDFGDR GSFDG