I tried to find out what the problem was, but it was to no avail.
After trying today to figure out what was wrong, I found that I had to Trim() bot variables (that check for the date entry against the current date), and that was the only way to make it work =/
It should have so happened I didn't need to do that.
I have added to it. The bot will whisper you once for each particular date that a particular event occurs on, so it will not whisper you indefinitely each time you join. Took out AddChat.
'cs
'2.1
'&Calendar Script:Vector
Public CS_File
CS_File = BotPath() & "calendar.ini"
Const CS_acc = 50
Sub cs_Event_Load()
AddChat vbGreen, "Vector's Calendar Script v0.1 Loaded"
End Sub
Sub cs_Event_WhisperFromUser(Username, Flags, Message)
If Not Left(Message, Len(BotVars.Trigger)) = BotVars.Trigger Then Exit Sub
GetDBEntry Username, a, f
if a < CS_Acc Then Exit Sub
cmd = Split(Mid(Trim(Message), Len(BotVars.Trigger) + 1), " ")
If Lcase(cmd(0)) <> "announce" Then Exit Sub
uDate = Ubound(Split(cmd(1), "/"))
If uDate <> 2 Then
AddQ "/w " & PsD2 & Username & " Incorrect date format. Example: " & Date()
Exit Sub
End If
setDate = cmd(1)
setNotification = Split(message, cmd(1) & " ")(1)
getDateList = GetConfigEntry("datelist", "list", CS_File)
If getDateList <> "" Then
WriteConfigEntry "datelist", "list", getDateList & ", " & setDate, CS_File
Else
WriteConfigEntry "datelist", "list", setDate, CS_File
End If
WriteConfigEntry "dates", setDate, setNotification, CS_File
AddQ "/w " & PsD2 & Username & " Date notification set for " & setDate
End Sub
Sub cs_Event_Userjoins(Username, Flags, Message, Ping, Product, Level, OriginalStatString)
If GetConfigEntry("datelist", "list", CS_File) = "" Then Exit Sub
getList = GetConfigEntry("datelist", "list", CS_File)
If InStr(getList, ", ") Then
splitList = Split(getList, ", ")
Dim dateEntry
For i=0 to Ubound(splitList)
If Trim(splitList(i)) = Trim(Date()) Then
dateEntry = splitList(i) : Exit For
End If
Next
getDateEntry = GetConfigEntry("dates", dateEntry, CS_File)
If GetConfigEntry("noreply", Date() & "|" & Username, CS_File) <> "" Then Exit Sub
WriteConfigEntry "noreply", Date() & "|" & Username, Username, CS_File
Dsp 3, "Date entry for " & getEntry & ": " & getDateEntry, Username, vbGreen
Else
getEntry = getList
If Trim(getEntry) = Trim(Date()) Then
getDateEntry = GetConfigEntry("dates", getEntry, CS_File)
If GetConfigEntry("noreply", Date() & "|" & Username, CS_File) <> "" Then Exit Sub
WriteConfigEntry "noreply", Date() & "|" & Username, Username, CS_File
Dsp 3, "Date entry for " & getEntry & ": " & getDateEntry, Username, vbGreen
End If
End If
End Sub