Author Topic: Calendar Script  (Read 3907 times)

zubpe

  • Newbie
  • *
  • Posts: 25
    • View Profile
Calendar Script
« 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,

Hero

  • Administrator
  • Hero Member
  • *****
  • Posts: 502
    • View Profile
    • http://rev7.net
Calendar Script
« Reply #1 on: October 16, 2008, 10:11:04 AM »
The one at Stealthbot.net fails.

I am not sure how hard this would be. I might do it.
Hero
AKA: HeroAssasin and Mike
- - - - -  - - -
Visit Clan R77
- - - - -  - - -
Please do not PM me with random questions. That is what I made these forums for.

Noob ~Vector

Vector

  • Administrator
  • Hero Member
  • *****
  • Posts: 550
    • View Profile
    • http://clanmage.phost.ws
Calendar Script
« Reply #2 on: October 16, 2008, 10:24:05 AM »
Simple. Default access is 50. Let me know if this works or not.

Defunct. A working version can be found below this post. ~Vector

Code: [Select]
'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
« Last Edit: October 23, 2008, 12:10:30 AM by Vector »
I am an Unofficial StealthBot Technician, an Unofficial StealthBot scripter, among other things. See my about page for more info.

Quote from: ArticWolve
Sorry I went down. Had internet problems with a cracker-jack-licensed driver hitting my internet pole (about 8 of them fell) and drooping my phone and electricity. Sorry ><

Rev77.net Plugins Manager

Proud host of Vector.no-ip.info | VectorJBLS.no-ip.org Status: [img]http://rev77.net/ServerCheck/check.asp?query=check&server=VectorJBLS.no-ip.org_status.png\" border=\"0\" class=\"linked-image\" /]

Shito-Ryu Karate-Do Genbu-Kai Rank: 8th Kyu (White belt, one stripe)

Rev77.Net Remote Support (Double-Click my name only if you were told to)

If the above link doesn't work, or if you use Vista, try this alternate link.

Noob ~Vector

Vector

  • Administrator
  • Hero Member
  • *****
  • Posts: 550
    • View Profile
    • http://clanmage.phost.ws
Calendar Script
« Reply #3 on: October 16, 2008, 02:44:53 PM »
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!
I am an Unofficial StealthBot Technician, an Unofficial StealthBot scripter, among other things. See my about page for more info.

Quote from: ArticWolve
Sorry I went down. Had internet problems with a cracker-jack-licensed driver hitting my internet pole (about 8 of them fell) and drooping my phone and electricity. Sorry ><

Rev77.net Plugins Manager

Proud host of Vector.no-ip.info | VectorJBLS.no-ip.org Status: [img]http://rev77.net/ServerCheck/check.asp?query=check&server=VectorJBLS.no-ip.org_status.png\" border=\"0\" class=\"linked-image\" /]

Shito-Ryu Karate-Do Genbu-Kai Rank: 8th Kyu (White belt, one stripe)

Rev77.Net Remote Support (Double-Click my name only if you were told to)

If the above link doesn't work, or if you use Vista, try this alternate link.

Noob ~Vector

Ace

  • Administrators
  • Full Member
  • ***
  • Posts: 227
    • View Profile
    • http://
Calendar Script
« Reply #4 on: October 16, 2008, 03:02:53 PM »
Quote from: Vector
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!

?
[img]http://zeus.cooltext.com/images/9ff/9fff41541771f1d8f564cabff80fd40cfb587413.jpg\" border=\"0\" class=\"linked-image\" /][img]http://209.85.12.232/13848/49/pip/admin.png\" border=\"0\" class=\"linked-image\" /]

zubpe

  • Newbie
  • *
  • Posts: 25
    • View Profile
Calendar Script
« Reply #5 on: October 17, 2008, 02:04:42 AM »
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

Hero

  • Administrator
  • Hero Member
  • *****
  • Posts: 502
    • View Profile
    • http://rev7.net
Calendar Script
« Reply #6 on: October 17, 2008, 06:58:20 AM »
@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.
Hero
AKA: HeroAssasin and Mike
- - - - -  - - -
Visit Clan R77
- - - - -  - - -
Please do not PM me with random questions. That is what I made these forums for.

Noob ~Vector

Vector

  • Administrator
  • Hero Member
  • *****
  • Posts: 550
    • View Profile
    • http://clanmage.phost.ws
Calendar Script
« Reply #7 on: October 17, 2008, 07:23:52 AM »
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 =/
I am an Unofficial StealthBot Technician, an Unofficial StealthBot scripter, among other things. See my about page for more info.

Quote from: ArticWolve
Sorry I went down. Had internet problems with a cracker-jack-licensed driver hitting my internet pole (about 8 of them fell) and drooping my phone and electricity. Sorry ><

Rev77.net Plugins Manager

Proud host of Vector.no-ip.info | VectorJBLS.no-ip.org Status: [img]http://rev77.net/ServerCheck/check.asp?query=check&server=VectorJBLS.no-ip.org_status.png\" border=\"0\" class=\"linked-image\" /]

Shito-Ryu Karate-Do Genbu-Kai Rank: 8th Kyu (White belt, one stripe)

Rev77.Net Remote Support (Double-Click my name only if you were told to)

If the above link doesn't work, or if you use Vista, try this alternate link.

Noob ~Vector

zubpe

  • Newbie
  • *
  • Posts: 25
    • View Profile
Calendar Script
« Reply #8 on: October 17, 2008, 08:48:46 AM »
Cool, I'll try it out whenever I'm unbanned............

Ace

  • Administrators
  • Full Member
  • ***
  • Posts: 227
    • View Profile
    • http://
Calendar Script
« Reply #9 on: October 17, 2008, 01:01:17 PM »
On all servers?  You can go on europe or asia to test it.
[img]http://zeus.cooltext.com/images/9ff/9fff41541771f1d8f564cabff80fd40cfb587413.jpg\" border=\"0\" class=\"linked-image\" /][img]http://209.85.12.232/13848/49/pip/admin.png\" border=\"0\" class=\"linked-image\" /]

zubpe

  • Newbie
  • *
  • Posts: 25
    • View Profile
Calendar Script
« Reply #10 on: October 18, 2008, 07:56:08 AM »
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.

Hero

  • Administrator
  • Hero Member
  • *****
  • Posts: 502
    • View Profile
    • http://rev7.net
Calendar Script
« Reply #11 on: October 18, 2008, 11:02:57 AM »
Updated to whisper on userjoin.
« Last Edit: October 18, 2008, 11:07:39 AM by Hero »
Hero
AKA: HeroAssasin and Mike
- - - - -  - - -
Visit Clan R77
- - - - -  - - -
Please do not PM me with random questions. That is what I made these forums for.

Noob ~Vector

zubpe

  • Newbie
  • *
  • Posts: 25
    • View Profile
Calendar Script
« Reply #12 on: October 18, 2008, 11:54:56 AM »
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? :>

zubpe

  • Newbie
  • *
  • Posts: 25
    • View Profile
Calendar Script
« Reply #13 on: October 21, 2008, 02:25:12 AM »
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

Vector

  • Administrator
  • Hero Member
  • *****
  • Posts: 550
    • View Profile
    • http://clanmage.phost.ws
Calendar Script
« Reply #14 on: October 21, 2008, 11:26:05 AM »
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.

Code: [Select]
'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
« Last Edit: October 21, 2008, 11:27:09 AM by Vector »
I am an Unofficial StealthBot Technician, an Unofficial StealthBot scripter, among other things. See my about page for more info.

Quote from: ArticWolve
Sorry I went down. Had internet problems with a cracker-jack-licensed driver hitting my internet pole (about 8 of them fell) and drooping my phone and electricity. Sorry ><

Rev77.net Plugins Manager

Proud host of Vector.no-ip.info | VectorJBLS.no-ip.org Status: [img]http://rev77.net/ServerCheck/check.asp?query=check&server=VectorJBLS.no-ip.org_status.png\" border=\"0\" class=\"linked-image\" /]

Shito-Ryu Karate-Do Genbu-Kai Rank: 8th Kyu (White belt, one stripe)

Rev77.Net Remote Support (Double-Click my name only if you were told to)

If the above link doesn't work, or if you use Vista, try this alternate link.

Noob ~Vector