IPB

Welcome Guest ( Log In | Register )

2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 
Reply to this topicStart new topic
> [BETA] SplitQueue
Jack
post Apr 7 2009, 02:54 PM
Post #1


Ultimate spammer.
********

Group: Sr. Members
Posts: 5,593
Joined: 28-January 06
Member No.: 28



CODE
Private FSO
Private followBot

Private Const Master = "IdleBoT"
Private Const all = "IdleBoT, Slave-One, Slave-Two, Slave-Three, Slave-Four"
Private c

Script("Name") = "SplitQueue"
Script("Author") = "Jack"
Script("Major") = 0           ' script   major version
Script("Minor") = 3           ' script   minor version
Script("Revision") = 0        ' script   version revision
Script("Description") = "Splits the queue."  


Sub Event_Load()
  
   Set FSO = CreateObject("Scripting.FileSystemObject")
End Sub

Sub Event_UserTalk(Username, Flags, Message, Ping)
  
   Call SplitQueue_processMessage(Username, Message)
End Sub

Sub Event_UserEmote(Username, Flags, Message)
  
   Call SplitQueue_processMessage(Username, Message)
End Sub

Sub Event_MessageQueued(MessageID, Message, Tag)
  
   If followBot = "" Then Exit Sub
  
   If Left(Message, 1) = "/" And Not Left(Message, 4) = "/me " Then Exit Sub
   If Message = "%%%%%blankqueuemessage%%%%%" Or Message = "" Then Exit Sub
  
   If (GetVirtualQueueSize() > 0 Or Queue.Count > 1) And Not Tag = "SplitQueue" Then
      Queue.RemoveItemByID(MessageID)
      AddToVirtualQueue(Message)
   End If
End Sub

Sub Event_UserJoins(Username, Flags, Message, Ping, Product, Level, OriginalStatstring, Banned)
  
   If InStr(all, Username) Then resetBots()
End Sub

Sub Event_UserLeaves(Username, Flags)
  
   If InStr(all, Username) Then resetBots()
End Sub

Sub Event_UserInChannel(Username, Flags, Message, Ping, Product, StatUpdate)
  
   If Username = Master Then c = True
  
   If Username = Channel.Self.DisplayName And c = True Then
      resetBots()
      c = False
   End If
End Sub

Sub Event_ChannelJoin(ChannelName, Flags)
  
   followBot = ""
End Sub

Sub Event_PressedEnter(Text)
  
   If LCase(Text) = "/scq" Or LCase(Text) = "/cq" Then
      VetoThisMessage
      ClearQueue()
   End If
End Sub


' // Script functions
Sub SplitQueue_processMessage(Username, Message)
  
   If Username = followBot Then
      If GetVirtualQueueSize() > 0 Then
         msg = FirstVirtualMessageAndDelete()
         AddQ msg, , "SplitQueue"
      End If
   End If
      
   Set cmd = IsCommand(Message)
   If cmd.Name = "cq" Or cmd.Name = "scq" Then
      If HasAccess(Username, cmd.Name, cmd.Args) Then
         ClearQueue()
      End If
   End If
   Set cmd = Nothing
  
   If LCase(Message) = BotVars.Trigger & "followbot" Then
      AddQ "I am following bot [" & followBot & "]"
   End If
End Sub

Sub resetBots()
  
   ' // not in same channel as master bot
   If Channel.GetUserIndex(Master) = 0 Then
      followBot = ""
   Else
      For Each name In Split(all, ", ")
         If Channel.GetUserIndex(name) > 0 Then
            a = a & name & ", "
         End If
      Next
      a = Left(a, Len(a) - 2)
      
      AddChat vbMagenta, a
      
      bots = Split(a, ", ")
      For i = 0 To UBound(bots)
         If bots(i) = Channel.Self.DisplayName Then
            If i = 0 Then i = UBound(bots) + 1
            followBot = bots(i - 1)
            Exit For
         End If
      Next
   End If
  
   If followBot = Channel.Self.DisplayName Then followBot = ""
   AddChat vbCyan, "I am following bot [" & followBot & "]"
End Sub


' // Queue functions
Sub AddToVirtualQueue(msg)
  
   Set f = FSO.OpenTextFile("queue.txt", 8, True)
   f.WriteLine msg
   f.Close
End Sub

Sub ClearQueue()
  
   Set f = FSO.OpenTextFile("queue.txt", 2, True)
   f.Close
End Sub

Function GetVirtualQueueSize()
  
   Set f = FSO.OpenTextFile("queue.txt", 1, True)
   Do While Not f.AtEndOfStream
      l = f.ReadLine
      GetVirtualQueueSize = GetVirtualQueueSize + 1
   Loop
   f.Close
End Function

Function FirstVirtualMessageAndDelete() ' // also known as "pop" :D
  
   Set f = FSO.OpenTextFile("queue.txt", 1, True)
   msgs = Split(f.ReadAll, vbCrLf)
   f.Close
  
   Set f = FSO.OpenTextFile("queue.txt", 2, True)
   For i = 1 To UBound(msgs)
      If msgs(i) <> "" Then f.WriteLine msgs(i)
   Next
   f.Close
  
   FirstVirtualMessageAndDelete = msgs(0)
End Function




Bot will work if it is the master and has slaves in the same channel. Slaves will not work by themselves.


No you may not edit it, fuck off noobs. It is my script and if you do edit it don't share it because you are a noob, yes you awakening.

Post bugs here.

This post has been edited by Jack: Jun 13 2009, 12:40 PM


--------------------
IPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
AwaKening
post Apr 10 2009, 12:49 AM
Post #2


Don't u know who I am
***

Group: Sr. Members
Posts: 764
Joined: 19-February 06
From: Utah
Member No.: 275



QUOTE
No you may not edit it, fuck off noobs. It is my script and if you do edit it don't share it because you are a noob, yes you awakening.


Well I don't need to share it because you already are, (sharing my fixes). Except that you ruined some of my fixes by trying to do it your way.

It turns me on to see you so angry for fixing your code though. Maybe I'll throw you some more bugs for amusement.


--------------------
Rival Nations Reborn Map Creator

Clan RnR.com
If you're looking for a "REAL" dota league script, aim or pm me.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Jack
post Apr 10 2009, 07:44 AM
Post #3


Ultimate spammer.
********

Group: Sr. Members
Posts: 5,593
Joined: 28-January 06
Member No.: 28



QUOTE(AwaKening @ Apr 10 2009, 01:49 AM) *

QUOTE
No you may not edit it, fuck off noobs. It is my script and if you do edit it don't share it because you are a noob, yes you awakening.


Well I don't need to share it because you already are, (sharing my fixes). Except that you ruined some of my fixes by trying to do it your way.

It turns me on to see you so angry for fixing your code though. Maybe I'll throw you some more bugs for amusement.

My original script had no "bugs." It just wasn't complete because it was just a script I threw together. This script also has no "bugs" and I did not steal any ideas from you at all, nor did I "ruin" any of your fixes because I didn't look at your script, I started with my original.

This post has been edited by Jack: Jun 13 2009, 12:41 PM


--------------------
IPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
nate
post Apr 10 2009, 08:08 AM
Post #4


Full Member
***

Group: Sr. Members
Posts: 741
Joined: 29-January 06
Member No.: 30



Unless I am missing something, all the bots need to be running on the same machine as the queue is stored locally in a text file correct?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Jack
post Apr 10 2009, 08:09 AM
Post #5


Ultimate spammer.
********

Group: Sr. Members
Posts: 5,593
Joined: 28-January 06
Member No.: 28



QUOTE(Nate @ Apr 10 2009, 09:08 AM) *

Unless I am missing something, all the bots need to be running on the same machine as the queue is stored locally in a text file correct?

For mine, yes. I could however easily modify it to use a server like botnet or pynet to send the messages around.


--------------------
IPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Sui(C)ide
post Oct 9 2009, 04:45 AM
Post #6


SuI[C]IdE's DotA Leage Plugin Author
***

Group: Members
Posts: 766
Joined: 23-April 09
From: Australia
Member No.: 49,768



So like, the variable "all", do bots names get stored there?
2. Does ech bot have this?
3. Guide please.


--------------------
IPB Image
Interested in joining an Aus/Nz DotA League? Come by Clan AIDL today, on UWEST.
You may visit our website Here.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Pyro
post Oct 9 2009, 12:31 PM
Post #7


huh?
********

Group: Root Administrators
Posts: 9,073
Joined: 23-February 07
From: Orlando, Florida
Member No.: 19,243



Stop posting on this board. Use the new one.


--------------------
Pyro
Chieftain of Clan BoT.
Host of pyro.no-ip.biz
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 16th September 2019 - 12:26 AM
Skin by Andrea
Website Legal Information | Hosted by LunarPages