mIRC Home    About    Download    Register    News    Help

Print Thread
#151959 24/06/06 07:11 PM
Joined: Jun 2006
Posts: 2
M
Bowl of petunias
OP Offline
Bowl of petunias
M
Joined: Jun 2006
Posts: 2
Currently I have setup a trigger bot so that when someone does ~info### based on what ever they need, it reads a text file on the server and sends that information back to the user. Well now the amount of people has risen significantly and due to so many people requesting info, especially when new topics come out the bot becomes majorly queued with ~info requests.

This maybe too far fetched for an mIRC bot to do but I would like to be able to do a queue system(or something like it) where there are two bots that respond instead of just one. So example below.

In channel:
<Billy> ~info555
<Sara> ~info555
<John> ~info555
<Steve> ~info555

Bot 1 responds to Billy and John, and Bot 2 responds to Sara and Steve.

Any thoughts on if it is possible and if so any method to take?

#151960 24/06/06 07:54 PM
Joined: May 2005
Posts: 449
Fjord artisan
Offline
Fjord artisan
Joined: May 2005
Posts: 449
I'm packing for a trip tomorrow, so I can't put a lot of time into this, but I have a quick idea. Maybe you could have a variable get set (and incremented) every time someone requests info and if that variable hits a certain number, then have the bot message the other bot to give info. Don't forget to subtract from the variable when info is given.

#151961 24/06/06 07:59 PM
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
didnt test this, but I think it will do what you want IF the first word of the line in the file is the match text

~info555 Today is XYZ's birthday
~info750 Stocks and bonds sold by Joe 555-1234

Code:
Bot 1
on *:TEXT:~info*:#:{
  if (%Q4info) {
    notice $nick $read(file.txt,s,$1)
    set %Q4info one
  }
  else { 
    unset %Q4info 
  }
}

Bot 2
on *:TEXT:~info*:#:{
  if (!%Q4info) {
    notice $nick $read(file.txt,s,$1)
  }
  else { 
   set %Q4info one
  }
}


#151962 24/06/06 09:48 PM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
A little bit more information would make this easier to solve.

What sort of volume of requests does the bot currently have to handle? 10 per minute? 30 per minute? 100s per minute?

How big is the text file (how many lines)? How much data is on each line (length of the lines)? Can you give a sample of the text file?

What is the reason for needing another bot? Is the single bot simply too slow to process that many requests? Do the multiple requests cause the bot to flood itself off the network?

How will multiple bots be set up? Will there simply be two bots connecting from the same mIRC off the same computer? Will there be two separate bots on two separate computers (at different locations)?

-genius_at_work

#151963 25/06/06 01:35 AM
Joined: Jun 2006
Posts: 2
M
Bowl of petunias
OP Offline
Bowl of petunias
M
Joined: Jun 2006
Posts: 2
each text file can contain 4-5 lines or more but usually around 5 lines lets say

the bot can get majorly spammed at release so you have at times where 20-30 people are requesting the info all at once and the bot gets so delayed that people start requesting the info again thinking its broken. We have to tell them several times it is not and just wait and eventually in 30seconds to 2 minutes the bot finally responds to them. We put in a small delay so the bot doesn't flood itself off the network. We put it to the bare minimum to message so many people at once.

As for a second bot running, both on another computer (and connection) and on the same computer is a possiblity.

And it based on the same info so think of 30 people doing
~info555
all at once and when those 30 people are getting answered, every 5 seconds or so there is another person doing
~info555
and a random
~info222
in between them

Last edited by meowingcows; 25/06/06 01:40 AM.
#151964 25/06/06 02:40 AM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
I don't know if it's an option, but have you considered using a method other than having mIRC msg the information to users? The method that comes to mind is a simple HTTP server. You could use the existing bot to simply send the link to anyone who uses the ~info### triggers. Example:

<user1> ~info123
<bot1> http://11.22.33.44/info123.txt
<user2> ~info604
<bot1> http://11.22.33.44/info604.txt

To me, that seems like the ideal solution. You could also have an index page on the website so users can navigate to whatever info page they want. If you used PHP on the site, you could make dynamic pages like latest.php which automatically redirects to the latest info page. If you restrict the pages to text only, you should be able to run it on your own internet connection.

If that is not a possibility, I'm sure we can figure something out using mIRC.

-genius_at_work

#151965 25/06/06 04:20 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Heres something that would work, blue sections you need to do yourself, and maybe even fine tuen the rest, but the idea i think is sound.

Code:
;FIRSTBOT CODE
on *:TEXT:!info*:#channel:{ 
  if ((SECONDBOT ison $chan) &amp;&amp; (!$istok(waiting active,$chat(SECONDBOT).status,32)))) { close -c SECONDBOT | dcc chat SECONDBOT }
  if (([color:blue]NOT ALREADY SENDING INFO[/color]) || ($chat(SECONDBOT).status != active)) {
    set %sending.info.toggle 0
    Process.a.request.alias $nick $chan $1-
  }
  else {
    inc %sending.info.toggle
    if (!$calc(%sending.info.toggle % 2)) {
      Process.a.request.alias $nick $chan $1-
    }
    else {
      msg =SECONDBOT PROCESS $nick $chan $1-
    }
  }
}

Code:
;SECONDBOT CODE
on *:CHAT:PROCESS *:{
  if (($nick == =FIRSTBOT) &amp;&amp; ($2 ison $3)) {
    Process.a.request.alias $2 $3 $4-
  }
}

Code:
;BOTH BOTS HAVE THIS
alias Process.a.request.alias {
  var %nick = $1
  var %chan = $2
  tokenize 32 $3-
  [color:blue]Code to process a request, with %nick instead of $nick, and %chan instead of $chan, $1- is text from %nick[/color]
}

* code untested *

Simply the idea is the first bot any time it gets a requests, attempts to dcc connect the second bot if present, this is to establish a continues link between them, that is not dependent on the irc server for speed of message traffic.
Next if it isnt sending a reply already OR the link to bot2 isnt yet made, then it has to process the request (no one else can)
If however the link is made then it increments a counter, and only if that counter is even well it process a request
If it isnt even then it well send a message to bot2 with instructions on channel nick and what they said (thus handing off that request)

The second bot is like a simple servant, it just gets orders from BOT1 and processes the requests it was ordered to do.

Each bot has the same procces the request alias, however becuase bot2 is calling it from a dcc chat with bot1, the $nick and $chan values are not supported, thus why they are passed to it as parameters.


Link Copied to Clipboard