The online racing simulator
Calculate when someone will be unbanned if they are banned
Can something like in the image be done with lapper, if so, can you give me a clue about how to do it?
Attached images
Ekran Görüntüsü (972).png
You can use "ShortDate" Lappervar get calculate the end date of the ban or something else.

GetLapperVar(ShortDate): Possible to add an 2nd parameter to add/delete days

$NewDate = GetLapperVar(ShortDate,5); // Adds 5 days to the current date
$NewDate = GetLapperVar(ShortDate,+5); // Adds 5 days to the current date
$NewDate = GetLapperVar(ShortDate,-5); // Deletes 5 days from the current date

Quote from Bass-Driver :You can use "ShortDate" Lappervar get calculate the end date of the ban or something else.

GetLapperVar(ShortDate): Possible to add an 2nd parameter to add/delete days

$NewDate = GetLapperVar(ShortDate,5); // Adds 5 days to the current date
$NewDate = GetLapperVar(ShortDate,+5); // Adds 5 days to the current date
$NewDate = GetLapperVar(ShortDate,-5); // Deletes 5 days from the current date


I couldn't think of it, it was very helpful thanks Smile
Quote from Bass-Driver :You can use "ShortDate" Lappervar get calculate the end date of the ban or something else.

GetLapperVar(ShortDate): Possible to add an 2nd parameter to add/delete days

$NewDate = GetLapperVar(ShortDate,5); // Adds 5 days to the current date
$NewDate = GetLapperVar(ShortDate,+5); // Adds 5 days to the current date
$NewDate = GetLapperVar(ShortDate,-5); // Deletes 5 days from the current date


I didn't pay attention at first, but then I noticed that it doesn't seem to be working right now.
I wonder if there is an error in my code

$NewTime = GetLapperVar(LongTime);
$NewDate = GetLapperVar(LongDate,+5);
$NewDate2 = GetLapperVar(LongDate);
$Message = "``` [" . $suspect1 . "] Banned for 5 days • [Date banned: ".$NewDate2. " " .$NewTime."] • [Expiration: ".$NewDate. " " .$NewTime."] ```";
$DiscordChannel = "1116093851032100886";
sendmessagetodiscord($DiscordChannel,$Message);
Attached images
Ekran Görüntüsü (980).png
You have this


$NewDate = GetLapperVar(LongDate,+5);
$NewDate2 = GetLapperVar(LongDate);

Should be this


$NewDate = GetLapperVar(ShortDate,+5);
$NewDate2 = GetLapperVar(ShortDate);

LongDate Lappervar doesnt support the "AddDays" feature.
Quote from Bass-Driver :You have this


$NewDate = GetLapperVar(LongDate,+5);
$NewDate2 = GetLapperVar(LongDate);

Should be this


$NewDate = GetLapperVar(ShortDate,+5);
$NewDate2 = GetLapperVar(ShortDate);

LongDate Lappervar doesnt support the "AddDays" feature.

This is what it looks like when I use ShortDate
Attached images
Ekran Görüntüsü (982).png
What is the line (or lines) of Lapper code you have?
It's hard to see what is wrong when we only have a screenshot to go on.
It looks the variable isn't correctly added to the text, but only the actual code can proof that theory.
Quote from Yisc[NL :;2048537"]What is the line (or lines) of Lapper code you have?
It's hard to see what is wrong when we only have a screenshot to go on.
It looks the variable isn't correctly added to the text, but only the actual code can proof that theory.

$NewTime = GetLapperVar(LongTime);
$NewDate = GetLapperVar(ShortDate,+5);
$NewDate2 = GetLapperVar(ShortDate);
$Message = "``` [" . $suspect1 . "] Banned for 5 days • [Date banned: ".$NewDate2. " " .$NewTime."] • [Expiration: ".$NewDate. " " .$NewTime."] ```";
$DiscordChannel = "1116093851032100886";
sendmessagetodiscord($DiscordChannel,$Message);
I cannot spot any obvious issue, but am currently not at home to double check things within Lapper.
What happens if you add the following line after the line that is setting $NewDate2?
The line should be: WriteLine( $NewDate2 );
Now a value should be shown on the Lapper console, what is that value?
Quote from Yisc[NL :;2048558"]I cannot spot any obvious issue, but am currently not at home to double check things within Lapper.
What happens if you add the following line after the line that is setting $NewDate2?
The line should be: WriteLine( $NewDate2 );
Now a value should be shown on the Lapper console, what is that value?

Unfortunately the problem still seems to persist
Attached images
Ekran Görüntüsü (984).png
i've did a test with GetLapperVar(ShortDate,+5);
Seems to work fine ingame.


<?php 
CASE "!day":
   
privmsg("Date Now: "   .GetLapperVar(ShortDate));
   
privmsg("Date Now + 5: " .GetLapperVar(ShortDate,+5));
BREAK;
?>



Instead of testing the code in discord. Do a couple of basic tests ingame with privmsg() or globalmsg() before testing it with other complicated code.

Might do some other tests later, but ill wait on your results first.
Attached images
DayTest.png
Quote from Bass-Driver :i've did a test with GetLapperVar(ShortDate,+5);
Seems to work fine ingame.


<?php 
CASE "!day":
   
privmsg("Date Now: "   .GetLapperVar(ShortDate));
   
privmsg("Date Now + 5: " .GetLapperVar(ShortDate,+5));
BREAK;
?>



Instead of testing the code in discord. Do a couple of basic tests ingame with privmsg() or globalmsg() before testing it with other complicated code.

Might do some other tests later, but ill wait on your results first.

When I send it to lfs via msg or cmd it's fine, but when I send it to discord for some reason something is wrong.
I am not familiar with Discord, but to me it looks like some character in the message, is misunderstood by Discord, causing the message to get broken. The problem could be with the / which might have to be escaped to get them through. Since I don't know if escaping them is even possible, you might want to try and replace them. Have a go with this:

$NewDate = Replace( GetLapperVar(ShortDate,+5),"/","-");
$NewDate2 = Replace( GetLapperVar(ShortDate),"/","-");
** Best answer **
I've did some tests with the normal discord messages and discord embedded messages.

$DayNow = GetLapperVar(ShortDate);
$DayNowPlusFive = GetLapperVar(ShortDate,+5);

Embedded messages seems to be fine.

#DISCORD EMBED MESSAGE
$Title = "";
$Desc = "";
$Color = "0xFFFFFF";
$FieldTitle = "Test Day";
$FieldValue = StripLFSColor("**Day Now: **".$DayNow."\n **Day Now + 5: **".$DayNowPlusFive."");
$FieldInline = "True";
$Footer = "";
$ThumbnailUrl = "";
$ImageUrl = "";
SendDiscordEmbed($DiscordChannel_cmd,$Title,$Desc,$Color,$FieldTitle,$FieldValue,$FieldInline,$Footer,$ThumbnailUrl,$ImageUrl);

on the normal discordmessages sendmessagetodiscord(), the text wont be displayed.
while i was writing this, Yisc[NL] came up with a solution that might help.

Yisc[NL]'s his line did the trick. Thanks Thumbs up

$Text = Replace( "Day Now: ".$DayNow." + Day Now + 5: ".$DayNowPlusFive."","/","-");

#DISCORD NORMAL MESSAGE
sendmessagetodiscord($DiscordChannel_cmd,StripLFSColor($Text));



I have never experienced this, so this is good way to test the discord function in LFSLapper.

Do not understand why there is a difference between Embedded discord messages and normal ones when it comes to odd characters.
Attached images
DayTest#2.png
Quote from Yisc[NL :;2048577"]I am not familiar with Discord, but to me it looks like some character in the message, is misunderstood by Discord, causing the message to get broken. The problem could be with the / which might have to be escaped to get them through. Since I don't know if escaping them is even possible, you might want to try and replace them. Have a go with this:

$NewDate = Replace( GetLapperVar(ShortDate,+5),"/","-");
$NewDate2 = Replace( GetLapperVar(ShortDate),"/","-");

Thanks for everything, it's working now Smile
Attached images
Ekran Görüntüsü (990).png
Glad to hear it's working.
For future reference, what happens when this is used?

$NewDate = Replace( GetLapperVar(ShortDate,+5),"/","\/");
$NewDate2 = Replace( GetLapperVar(ShortDate),"/","\/");

In most systems \ can be used to escape characters, so this might do the trick here as well.
Quote from Yisc[NL :;2048581"]Glad to hear it's working.
For future reference, what happens when this is used?

$NewDate = Replace( GetLapperVar(ShortDate,+5),"/","\/");
$NewDate2 = Replace( GetLapperVar(ShortDate),"/","\/");

In most systems \ can be used to escape characters, so this might do the trick here as well.

Actually, the last image I posted worked thanks to what you said, but since Bass-Driver is more detailed and similar to what you said, I marked it as the best answer.
Thank you for your help, you have been very helpful.

FGED GREDG RDFGDR GSFDG