R77 Community Forum Archive
Programming => Scripting => Requests => Topic started by: zubpe on October 16, 2008, 08:36:52 AM
-
Hello there
I would like to request a Calendar Plugin. I think it should be very simple, it should just be able to: (Just showing some examples)
For example you would whisper the bot (if you have enough access for it of course)
/w BOT .announce 16/10/2008 BLA BLA BLA BLA..
I don't exactly know how to explain it but there was a "outdated" old calendar script on stealthbot forums, maybe just something like that just refreshed up
cheers,
-
The one at Stealthbot.net fails.
I am not sure how hard this would be. I might do it.
-
Simple. Default access is 50. Let me know if this works or not.
Defunct. A working version can be found below this post. ~Vector
'cs
'2.1
'&Calendar Script:Vector
Public CS_File
CS_File = BotPath() & "calendar.ini"
Const CS_acc = 50
Sub cs_Event_Load()
If GetConfigEntry("datelist", "list", CS_File) = "" Then Exit Sub
getList = GetConfigEntry("datelist", "list", CS_File)
If InStr(getList, ", ") Then
splitList = Split(getList, ", ")
For i=0 to Ubound(splitList)
If splitList(i) = Date() Then
dateEntry = splitList(i) : Exit For
End If
Next
getDateEntry = GetConfigEntry("dates", dateEntry, CS_File)
AddChat vbGreen, "Date entry for " & dateEntry & ": " & getDateEntry
Else
getEntry = getList
If getEntry = Date() Then
getDateEntry = GetConfigEntry("dates", getEntry, CS_File)
AddChat vbGreen, "Date entry for " & getEntry & ": " & getDateEntry
End If
End If
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, ", ")
For i=0 to Ubound(splitList)
If splitList(i) = Date() Then
dateEntry = splitList(i) : Exit For
End If
Next
getDateEntry = GetConfigEntry("dates", dateEntry, CS_File)
Dsp 3, "Date entry for " & getEntry & ": " & getDateEntry, Username, vbGreen
Else
getEntry = getList
If getEntry = Date() Then
getDateEntry = GetConfigEntry("dates", getEntry, CS_File)
Dsp 3, "Date entry for " & getEntry & ": " & getDateEntry, Username, vbGreen
End If
End If
End Sub
-
Ok, what the hell, was that a bot that just posted here? Perhaps someone just decided to have a little fun? YOU'VE BEEN TO THIS BOARD HOURS AFTER I POSTED THE SCRIPT!
Bot, shoo!
-
Ok, what the hell, was that a bot that just posted here? Perhaps someone just decided to have a little fun? YOU'VE BEEN TO THIS BOARD HOURS AFTER I POSTED THE SCRIPT!
Bot, shoo!
?
-
Hey, nah I'm no bot
Just that due to too much logging etc. and the shit alike I'm currently not able to login on the battle net. So I can't test it. xD
But when I took the plugin in and into the plugins folder and on my way to start up the bot I already got a error there, so maybe you can re check it
And would be awesome if you could tell me what command it uses or how it works
-
@vector you should have a greet message of the event that is happening that day
@zubpe You whisper the bot .announce <date> <what is happening> From what I can see, when you reload script on the day of the event it tells you that the event is that day.
-
Minor update. Also, I changed the version number to 111.111 because it's the same prefix as the calenar script on the plugins server (OH SO UGLY CODE!). It would ask me if I wanted to update =/
-
Cool, I'll try it out whenever I'm unbanned............
-
On all servers? You can go on europe or asia to test it.
-
I fixed it now
About the plugin, I don't think it works. Or maybe I'm just doing it wrong.
My bot was online and I whispered it:
.announce 18/10/2008 (which is today) and wrote something afterwards. It replied back with "Notification set to 18/10/2008". I rejoined channel and I didn't get any whisper with the announcement.
-
Updated to whisper on userjoin.
-
Thanks, and sorry if I explained myself bad before :> though I find this feature very nice.
Hmm. So I tried it now, I did as before and now upon rejoin in the channel I just got the following whisper:
Date entry for:
and that was all I got.
I was wondering if it could get changed into the direction of something like, the greetdelay plugin thingy by hero.
When people join the channel they'll get the message in a whisper.
So for example if I whisper the bot: .announce 18/10/2008 welcome to the clan dear fellas - currently there are no annoucements.
Then when someone join the channel it should whisper them something like this: 18/10/2008 welcome to the clan dear fellas - currently there are no annoucements.
If possible I'd like the date included in the whisper you get. I hope this was a better explanation then the ones before xD
also, could you change the access on it to 100 or something? :>
-
BUMP
What I am requesting, is it too difficult? If it is then no problem, I can live without it. Though it would have been cool
-
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
-
Hmm. I don't know what's wrong, maybe I'm the one doing it wrong. But I can't seem to make it work.
I loaded the plugin joined the channel and without even announcing anything it whispered me directly: "Date entry for:"
Anyways, I continued and whispered the bot .announce 21/10/2008 Hello.
Afterwards I rejoined the channel and nothing happened. I didn't get the whisper-
-
Hm, you may still have a calendar.ini file in your stealthbot folder. Delete it, and try again.
the date format would be 10/21/2008, not 21/10/2008.
-
Ah I see It works now, and I like that it actually doesn't "spam". But only say it once, that's nice.
Though one thing that could be nice to change would be the.. "Date Entry For: bla bla bla"
If you just could remove something in the whisper you recieve: "Date Entry For:" this part, then it would be great.
So basically, instead of receiving the part "Date Entry For:" and afterwards the actual message, it would be much better (in my opinion) if it just replaced the part "Date Entry For:" with the date it's set for and afterwards the actual message.
So something like this: 10/22/2008: AND THE ACTUAL MESSAGE - HELLO D:
Btw, just one last note, could the date thingy possibly be changed to 22/10/2008 (day/month/year) instead of 10/22/2008 (month/day/year)
-
Please note that this version will only work with the new date format you specified: 23/10/2008.
If any of you who do not want this format, then get the code to this plugin from my previous post where I posted it. Don't come to me and tell me that it does not work.
Access changed to 100, like you requested
'cs
'110.2
'&Calendar Script:Vector
Const CS_Ver = "0.2"
Public CS_File
CS_File = BotPath() & "calendar.ini"
Const CS_acc = 100
Sub cs_Event_Load()
AddChat vbGreen, "Vector's Calendar Script v" & CS_Ver & " 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
mDate = Split(Date, "/")(0)
dDate = Split(Date, "/")(1)
yDate = Split(Date, "/")(2)
fDate = dDate & "/" & mDate & "/" & yDate
AddQ "/w " & PsD2 & Username & " Incorrect date format. Example: " & fDate
Exit Sub
End If
splitDAte = Split(cmd(1), "/")
tempDay = splitDate(0)
tempMonth = splitDate(1)
setDate = tempDay & "/" & tempMonth & "/" & Split(Date(), "/")(2)
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)
tempDay = Split(splitList(i), "/")(0)
tempMonth = Split(splitList(i), "/")(1)
tempList = tempMonth & "/" & tempDay & "/" & Split(Date, "/")(2)
If Trim(tempList) = 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, getEntry & ": " & getDateEntry, Username, vbGreen
Else
getEntry = getList
tempDay = Split(getEntry, "/")(0)
tempMonth = Split(getEntry, "/")(1)
tempEntry = tempMonth & "/" & tempDay & "/" & Split(Date, "/")(2)
If Trim(tempEntry) = 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, getEntry & ": " & getDateEntry, Username, vbGreen
End If
End If
End Sub
-
[20:01:12] Loaded 2 of 2 script files referenced.
[20:01:12] 11 plugins loaded. Type /plugins in the bot to view them. Type /phelp for help using them.
[20:01:12] Type /updates in the bot to view updates and new plugins that are available for download.
[20:01:12] Vector's Calendar Script v0.2 Loaded
[20:01:12] Loading GD...
[20:01:12] Greet Delay by Hero loaded!
[20:01:12] Checking if your built-in greet is enabled...
[20:01:12] Your built-in greet messages are disabled!
[20:01:43] UserJoins Call Error On File> C:\bot-s\tn.StealthBot\plugins\cs.plug
[20:01:43] Error Number: 450 Description: Wrong number of arguments or invalid property assignment
and btw, it's saying that a new calendar version 1.3 or something like that is available for download etc.
is this yours or what is this?
-
Problem solved. Copy the code again. Apparently, I was testing it on the beta, and it added another argument to UserTalk, which is not so with 2.6r3, so I apologize on that note.
Also, the reason its saying there is a new plugin is because the plugin uses the same prefix as the one on the official plugins server. I also changed the version number, so this wouldn't happen.
-
I really appreciate your work and I'm grateful. But if you've time and still would like to help me I would appreciate it very much. I was wondering if there could be a few changes/additions to the current plugin, I'm just wondering if it's secure if enough - I mean, it seems like there isn't any delay, ergo it's might flood out? Yes, No? I'm using the greetdelay plugin by hero as well, and this calendar plugin by you. So I just want to be sure it doesn't flood out. Because as it seems I instantly get the message when I join the channel (the calendar plugin), but the GD plugin I've set to 6secs delay. So was wondering if there could be added a few seconds delay to the calendar plugin as well?
1. Another thing is, that if there are not set an announcement the bot still simply messages you with the message: ":"
Could that be removed?
2. Could there be added a "standard" message, which will message the same message everyday until it's changed. So the only thing it would be updating would be the date. Is this even possible? So there would be a command to set a announcement for any day, like the current .announce 27/10/2008 or for example I could just use the ".announce" command now, and set it to announce something the next month. (This is the currently how it works) So the other thing would be something like .stanannounce (standard announcement) which will message the same message every day until I either delete it or use the ".announce" command where I set a date etc. or update. Maybe you have better ideas on how it is possible to work out, but I just wanted to give you my ideas etc.
3. Is it possible to make the bot send/message the announcement every time a user joins the channel instead of just giving it once to the user?
4. Could there be added commands? For example, .delan (delete announcement), .upan (update announcement), .announce (this is already implented)
-
I really appreciate your work and I'm grateful. ...
Well thank you very much. I appreciate it.
1. Another thing is, that if there are not set an announcement the bot still simply messages you with the message: ":"
Could that be removed?
The way its set up, it shouldn't message you if the date on which the user joins no message is set for
2. Could there be added a "standard" message, which will message the same message everyday until it's changed. So the only thing it would be updating would be the date. Is this even possible? So there would be a command to set a announcement for any day, like the current .announce 27/10/2008 or for example I could just use the ".announce" command now, and set it to announce something the next month. (This is the currently how it works) So the other thing would be something like .stanannounce (standard announcement) which will message the same message every day until I either delete it or use the ".announce" command where I set a date etc. or update. Maybe you have better ideas on how it is possible to work out, but I just wanted to give you my ideas etc.
Yes, I can put this into the bot. Do you want the standard message whispered to the user, even if there is another message assigned for that date?
3. Is it possible to make the bot send/message the announcement every time a user joins the channel instead of just giving it once to the user?
I figure once the user has received the message, they already know what it says. I guess I can do this for you, if it's really important.
4. Could there be added commands? For example, .delan (delete announcement), .upan (update announcement), .announce (this is already implented)
Yes, this is possible.
-
Well thank you very much. I appreciate it.
The way its set up, it shouldn't message you if the date on which the user joins no message is set for
Then I don't know if it's a bug, but at the moment it still messages people when they enter the channel even though I haven't made an announcement. It just messages them with ":"
Yes, I can put this into the bot. Do you want the standard message whispered to the user, even if there is another message assigned for that date?
No, if there is "manually" set an announcement for a specific day then that day the standard message should somehow go off, and then next day on again and so on. If possible of course
I figure once the user has received the message, they already know what it says. I guess I can do this for you, if it's really important.
Hmm, well I guess you're right. Now I just started to wonder if it's possible to make a command to turn that off and on hehe.
Yes, this is possible.
Cool, could you add a few then, just some you think would be useful etc.
Greetings z,
-
Fixed the problem where it messaged the user everytime they joined. This time, there is a three second delay where the bot whispers the person the date.
The bot will open up a pop-up asking you what you want the standard message to be. It will whisper each user everytime, until you cancel it (.stannounce off)
If there is a message for that given date, the bot will whisper the user the message, AND NOT whisper them the standard message. Let me know if I need to patch anything up.
'cs
'110.2
'&Calendar Script:Vector
Const CS_Ver = "0.2"
Const CS_acc = 100
Public CS_File
CS_File = BotPath() & "calendar.ini"
Public dspStandard
dspStandard = True
Sub cs_Event_Load()
AddChat vbGreen, "Vector's Calendar Script v" & CS_Ver & " Loaded"
If Not GetSetting("cs", "sMessage") Then
sMessage = InputBox("Enter the standard greet message", "Vector's cs plugin")
SetSetting "cs", "standardMessage", sMessage, "Standard Message", True
End If
TimerInterval "cs", "greetDelay", 3
TimerEnabled "cs", "greetDelay", False
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
End Sub
Sub cs_Event_Userjoins(Username, Flags, Message, Ping, Product, Level, OriginalStatString)
If GetConfigEntry("noreply", Date() & "|" & Username, CS_File) <> "" Then Exit Sub
TimerEnabled "cs", "greetDelay", True
If Not dspStandard Then Exit Sub
getStandard = GetSetting("cs", "standardMessage")
If getStandard = "" Then Exit Sub
AddQ "/w " & PsD2 & Username & " " & getStandard
dspStandard = True
End Sub
Sub cs_Event_UserTalk(Username, Flags, Message, Ping)
Call cs_processInput(Username, Message, 1)
End Sub
Sub cs_processInput(Username, Message, Origin)
If 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(Lcase(Message)), Len(BotVars.Trigger) + 1), " ")
ucmd = Ubound(cmd)
Select Case cmd(0)
Case "stannounce"
If ucmd < 1 Then Exit Sub
If cmd(1) = "off" Then
SetSetting "cs", "standardMessage", "", "", True
DSP Origin, "Standard message cancelled."
Else
sMessage = Split(cmd(0) & " ")(1)
SetSetting "cs", "standardMessage", sMessage, "", True
DSP Origin, "Standard message set.", Username, vbWhite
End If
Case "announce"
uDate = Ubound(Split(cmd(1), "/"))
If uDate <> 2 Then
mDate = Split(Date, "/")(0)
dDate = Split(Date, "/")(1)
yDate = Split(Date, "/")(2)
fDate = dDate & "/" & mDate & "/" & yDate
DSP Origin, "Incorrect date format. Example: " & fDate, Username, vbWhite
Exit Sub
End If
splitDAte = Split(cmd(1), "/")
tempDay = splitDate(0)
tempMonth = splitDate(1)
setDate = tempDay & "/" & tempMonth & "/" & Split(Date(), "/")(2)
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
DSP Origin, "Date notification set for " & setDate, Username, vbWhite
End Select
End Sub
'// TIMER SUBS \\'
Sub cs_greetDelay_Timer()
TimerEnabled "cs", "greetDelay", False
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)
tempDay = Split(splitList(i), "/")(0)
tempMonth = Split(splitList(i), "/")(1)
tempList = tempMonth & "/" & tempDay & "/" & Split(Date, "/")(2)
If Trim(tempList) = Trim(Date()) Then
dateEntry = splitList(i) : Exit For
End If
Next
getDateEntry = GetConfigEntry("dates", dateEntry, CS_File)
if getDateEntry = "" Then Exit Sub
If GetConfigEntry("noreply", Date() & "|" & Username, CS_File) <> "" Then Exit Sub
WriteConfigEntry "noreply", Date() & "|" & Username, Username, CS_File
Dsp 3, getEntry & ": " & getDateEntry, Username, vbGreen
dspStandard = False
Else
getEntry = getList
tempDay = Split(getEntry, "/")(0)
tempMonth = Split(getEntry, "/")(1)
tempEntry = tempMonth & "/" & tempDay & "/" & Split(Date, "/")(2)
If Trim(tempEntry) = Trim(Date()) Then
getDateEntry = GetConfigEntry("dates", getEntry, CS_File)
If getDateEntry = "" Then Exit Sub
If GetConfigEntry("noreply", Date() & "|" & Username, CS_File) <> "" Then Exit Sub
WriteConfigEntry "noreply", Date() & "|" & Username, Username, CS_File
Dsp 3, getEntry & ": " & getDateEntry, Username, vbGreen
dspStandard = False
End If
End If
End Sub
-
.announce 8/11/2008 Hello & Welcome to our Clan.
WhisperFromUser Call Error On File> C:\mappen\mappen.StealthBot\plugins\XML-download.plug
Error Number: 5 Description: Invalid procedure call or argument
Sorry for no response, I've been a bit busy ~ IRL
I tested it out, and it seems that it interferes with another plugin I'm using. At least that's what I think. I tried to use the command to announce something, and inside the bot I got the above error. The reason to that I think that this cs plugin interferes with another plugin is that the name "XML-download.plug" is another plugin I've in the plugin folder.
So I guess I've to delete/remove that plugin to be able to use the cs plugin?
Cheers,
-
Weird. That error looks like it has nothing to do with my plugin. As a precaution, I changed the prefix to "cal" instead.
'cal
'0.2
'&Calendar Script:Vector
Const cal_Ver = "0.2"
Const cal_acc = 100
Public cal_File
cal_File = BotPath() & "calendar.ini"
Public dspStandard
dspStandard = True
Sub cal_Event_Load()
AddChat vbGreen, "Vector's Calendar Script v" & cal_Ver & " Loaded"
If Not GetSetting("cal", "sMessage") Then
sMessage = InputBox("Enter the standard greet message", "Vector's cal plugin")
SetSetting "cal", "standardMessage", sMessage, "Standard Message", True
End If
TimerInterval "cal", "greetDelay", 3
TimerEnabled "cal", "greetDelay", False
End Sub
Sub cal_Event_WhisperFromUser(Username, Flags, Message)
If Not Left(Message, Len(BotVars.Trigger)) = BotVars.Trigger Then Exit Sub
GetDBEntry Username, a, f
if a < cal_Acc Then Exit Sub
cmd = Split(Mid(Trim(Message), Len(BotVars.Trigger) + 1), " ")
If Lcase(cmd(0)) <> "announce" Then Exit Sub
End Sub
Sub cal_Event_Userjoins(Username, Flags, Message, Ping, Product, Level, OriginalStatString)
If GetConfigEntry("noreply", Date() & "|" & Username, cal_File) <> "" Then Exit Sub
TimerEnabled "cal", "greetDelay", True
If Not dspStandard Then Exit Sub
getStandard = GetSetting("cal", "standardMessage")
If getStandard = "" Then Exit Sub
AddQ "/w " & PsD2 & Username & " " & getStandard
dspStandard = True
End Sub
Sub cal_Event_UserTalk(Username, Flags, Message, Ping)
Call cal_processInput(Username, Message, 1)
End Sub
Sub cal_processInput(Username, Message, Origin)
If Left(Message, Len(BotVars.Trigger)) <> BotVars.Trigger Then Exit Sub
GetDBEntry Username, a, f
If a < cal_acc Then Exit Sub
cmd = Split(Mid(Trim(Lcase(Message)), Len(BotVars.Trigger) + 1), " ")
ucmd = Ubound(cmd)
Select Case cmd(0)
Case "stannounce"
If ucmd < 1 Then Exit Sub
If cmd(1) = "off" Then
SetSetting "cal", "standardMessage", "", "", True
DSP Origin, "Standard message cancelled."
Else
sMessage = Split(cmd(0) & " ")(1)
SetSetting "cal", "standardMessage", sMessage, "", True
DSP Origin, "Standard message set.", Username, vbWhite
End If
Case "announce"
uDate = Ubound(Split(cmd(1), "/"))
If uDate <> 2 Then
mDate = Split(Date, "/")(0)
dDate = Split(Date, "/")(1)
yDate = Split(Date, "/")(2)
fDate = dDate & "/" & mDate & "/" & yDate
DSP Origin, "Incorrect date format. Example: " & fDate, Username, vbWhite
Exit Sub
End If
splitDAte = Split(cmd(1), "/")
tempDay = splitDate(0)
tempMonth = splitDate(1)
setDate = tempDay & "/" & tempMonth & "/" & Split(Date(), "/")(2)
setNotification = Split(message, cmd(1) & " ")(1)
getDateList = GetConfigEntry("datelist", "list", cal_File)
If getDateList <> "" Then
WriteConfigEntry "datelist", "list", getDateList & ", " & setDate, cal_File
Else
WriteConfigEntry "datelist", "list", setDate, cal_File
End If
WriteConfigEntry "dates", setDate, setNotification, cal_File
DSP Origin, "Date notification set for " & setDate, Username, vbWhite
End Select
End Sub
'// TIMER SUBS \\'
Sub cal_greetDelay_Timer()
TimerEnabled "cal", "greetDelay", False
If GetConfigEntry("datelist", "list", cal_File) = "" Then Exit Sub
getList = GetConfigEntry("datelist", "list", cal_File)
If InStr(getList, ", ") Then
splitList = Split(getList, ", ")
Dim dateEntry
For i=0 to Ubound(splitList)
tempDay = Split(splitList(i), "/")(0)
tempMonth = Split(splitList(i), "/")(1)
tempList = tempMonth & "/" & tempDay & "/" & Split(Date, "/")(2)
If Trim(tempList) = Trim(Date()) Then
dateEntry = splitList(i) : Exit For
End If
Next
getDateEntry = GetConfigEntry("dates", dateEntry, cal_File)
if getDateEntry = "" Then Exit Sub
If GetConfigEntry("noreply", Date() & "|" & Username, cal_File) <> "" Then Exit Sub
WriteConfigEntry "noreply", Date() & "|" & Username, Username, cal_File
Dsp 3, getEntry & ": " & getDateEntry, Username, vbGreen
dspStandard = False
Else
getEntry = getList
tempDay = Split(getEntry, "/")(0)
tempMonth = Split(getEntry, "/")(1)
tempEntry = tempMonth & "/" & tempDay & "/" & Split(Date, "/")(2)
If Trim(tempEntry) = Trim(Date()) Then
getDateEntry = GetConfigEntry("dates", getEntry, cal_File)
If getDateEntry = "" Then Exit Sub
If GetConfigEntry("noreply", Date() & "|" & Username, cal_File) <> "" Then Exit Sub
WriteConfigEntry "noreply", Date() & "|" & Username, Username, cal_File
Dsp 3, getEntry & ": " & getDateEntry, Username, vbGreen
dspStandard = False
End If
End If
End Sub
-
Seems to have fixed it :-) Works great now.
I was wondering if you could make a little list of the commands, I tend to forget them all the time :-D
-
<trigger>announce <date> <message for that date>
<trigger>stannounce <announcement>
If <trigger>stannounce off is used, will terminate the announcement and you have to set it again with <trigger>stannounce <announcement>