Hello Lapperusers.
After adding many features and alot of testing.
Curious about the testing period?: Test: Lapper 7.0.4.8
Check the changelog below for the new/updated features.
After adding many features and alot of testing.
Curious about the testing period?: Test: Lapper 7.0.4.8
Check the changelog below for the new/updated features.
+-------------------------------+
|Changes from 7.0.4.7 to 7.0.4.8|
+-------------------------------+
-Sort Arrays function
-Several functions to edit strings
-Delete stored values from the database
-Delete userstored values from the database
-New Lappervars
-Set/Get allowed cars on the server.
-Create/Edit/Read/Delete Textfiles.
-Old RemoveZoneAction() bugfix.
-Other Fixes.
-Small updates on errormessages
-Small Sourcecode cleanup.
=================================================
New:
=================================================
01: New Function: Sort() Sort Arrays
Sort(Var,"TypOfSort") Sort Arrays , TypOfSort = DESC or ASC: Sort values descending or ascending
$testArray[0] = A;
$testArray[1] = B;
$testArray[2] = C;
$testArray[3] = D;
$Sortedarray = Sort($testArray,$TypOfSort);
FOR ( $i = 0; $i < 4 ; $i = $i + 1)
privMsg( "^3" . $Sortedarray[$i] );
ENDFOR
02: Delete Stored (Player) Vars from database
DeleteUserStoredValue($userName,"Value"); #Delete user stored values from the database
DeleteStoredValue("Value"); #Delete stored values from the database
03: New Function: SetAllowedCars() Set Allowed cars on the server. (This is not the same as setallowedPlayerCars($username,$Cars))
$Cars = UF1+XRT+UFR;
SetAllowedCars($Cars);
04: New lappervars added: (retrieve values from LFS)
-Wind (returns 0,1 or 2)
-Weather (returns 1,2 or 3)
-RaceLaps (returns number of Laps) Returns 0 IF Hours is set
-RaceHours (return number of Hours) Returns 0 IF Laps is set
-allowedcars (Returns string of cars : UF1+XRT+XFG for example)
05: New function: Contains() Returns 1 or 0
$String = "teststring";
IF (Contains($String,"test") == 1) THEN
#yourcode
ENDIF
06: New function: Replace() Replace chars in a string
$oldstring = "LFSLapper String Test";
privmsg("Old String: ".$oldstring);
$newstring = Replace($oldstring,"","_");
privmsg("New String: ".$newstring);
07: New function: Insert() Insert chars in a string.
$oldstring = "LFSLapper String Test";
privmsg("Old String: ".$oldstring);
$newstring = Insert($oldstring,21," [Extra String]");
privmsg("New String: ".$newstring);
08: Created $TimeFormat var for 12 or 24hour format. used for the following LapperVars
GetLapperVar("ShortTime");
GetLapperVar("LongTime");
//The code below can be found in LFSLapper.LPR
$LongTimeFormat = "HH:mm:ss tt";
$ShortTimeFormat = "HH:mm";
# Used for GetLapperVar("LongTime") and GetLapperVar("ShortTime")
# HH = Hour in 0-23 format
# hh = Hour in 0-12 format
# mm = Minute
# ss = Seconds
# t = A/P "hh:mm:ss t"
# tt = AM/PM "hh:mm:ss tt"
09: Create/Read/Delete Textfiles
#===================================================
#Create textfiles (Include FileExist options) (only .txt extension)
#===================================================
$FileName = "Filename";
$NameofDirectory = "C:\Users\User\Desktop";
$FileExistOption = 0;
What todo if file exist:
0 = no action
1 = overwrite file
2 = overwrite file + create backup file.
CreateFile($FileName,$NameofDirectory,$FileExistOption);
#===================================================
#Delete textfiles (Include copy file option)
#===================================================
$FileName = "Filename";
$NameofDirectory = "C:\Users\User\Desktop";
$NameofCopyDirectory = "C:\Users\User\Desktop\Copy"; #or $NameofCopyDirectory = "";
$Extension = ".txt";
DeleteFile($FileName,$NameofDirectory,$NameofCopyDirectory,$Extension);
#===================================================
#Read file (Possible to read various Filetypes: .log/.txt/.ini/.cfg.lpr)
#===================================================
$LinesofFile = Readfile($Filename,$Folder);
What info you get from file.
-FileSize in bytes
-CreationDate/Time
-ModificationDate/Time
-Number Of lines
-LineNumber
-Text from each line
!!!!EXAMPLE CODE!!!!
$Filename = "TestFile";
$Folder = "C:\Users\Danny\Desktop";
$Extension = ".txt";
$LinesofFile = Readfile($Filename,$Folder,$Extension);
$NrOfLines = ToNum($LinesofFile["NumberOfLines"]);
$FileCreationDate = $LinesofFile["TimeOfCreation"];
$FileModificationTime = $LinesofFile["TimeOfModification"];
$FileSize = $LinesofFile["FileSize"];
privmsg("Reading file: " . $Filename . "" .$Extension);
privmsg("NumberOfLines: " . $NrOfLines . "");
privmsg("Size of file: " . $FileSize . " bytes");
privmsg("Creation time: " . $FileCreationDate . "");
privmsg("Modify time: " . $FileModificationTime . "");
FOR ( $i = 0; $i <= $NrOfLines-1 ; $i = $i + 1)
$linenr = $LinesofFile[$i,"LineNumber"];
$line = $LinesofFile[$i,"Line"];
privmsg("[".$linenr."]: ".$line);
ENDFOR
!!!!!!!!!! USE THE FOR/WHILE LOOP, ONLY FOR THE LINES YOU WANT TO BE DISPLAYED ON YOUR SCREEN !!!!!!!!!!!!!!!!!!!
#===================================================
#Edit file (Possible to edit various Filetypes: .log/.txt/.ini/.cfg/.lpr)
#===================================================
$Filename = "TestFile";
$Folder = "C:\Users\Danny\Desktop";
$NewText = "TESTTEST";
$LineToEdit = -1; # -1 to create a extra line
$Extension = ".txt";
EditFile($Filename,$Folder,$NewText,$LineToEdit,$Extension);
=================================================
Updates:
=================================================
01: Files with LapperVars and LapperConfigvars updated.
02: Deleted !powered command: command became obsolete
03: Few errormessages updates (typo's & imcomplete info).
=================================================
Fixes:
=================================================
01: ToNum(); Wrong error message when PlayerVar is empty.
02: Several RemoveZoneAction() fixes:
-Leave Subroutine still active after removing zone.
-Lappercrash when deleting Zone in not particular order.
03: Several fixes on ErrorMessages (some caused lappercrashes)
04: Error on !ver command. caused by a invalid URL in webcommand
05: Incorrect tracknames from lapper when ShortTrackName contains more than 4 characters.
06: Lappercrash on subStr ($string, 4, 1); when Startindex is larger than the length of the string.
07: Incorrect errormessages for RegisterScheduleAction();
-Returns an errormessage when ID or Sub routine value is empty.
-Returns an errormessage when the time/date field is incorrect.