Keep track of triggered scripts? reddit / irc ---------------------------------------------------------------------- Feyl0rd · 2014-12-14 19:01 So is there a way to keep track / have the irc bot remember triggered events and have them all be executed at once on one line of msg? !test calls for a test but if it's being triggered more than once, some of them are lost and don't trigger. I'm looking for a way to have it always trigger and reduce flooding from the bot itself... hope I'm making sense! ---------------------------------------------------------------------- Pteraspidomorphi · 2014-12-14 20:32 Eggdrop has a built in queue which delays messages from the bot to the server. You can implement one yourself on any platform that provides: * An array or list data structure * Timers The principle is easy to understand. Every time you process a trigger you're going to save the current time, as accurately as possible. The next time you process the trigger you want to check when it last happened. If it was more than X seconds ago, process it immediately. Otherwise add it to the end of a list. Then have a timer that runs every Y seconds, takes an event from the beginning of the list and processes it. ---------------------------------------------------------------------- Feyl0rd · 2014-12-14 23:55 Hi! Still really new to the whole irc stuff. But I'm glad you explained it the way you did. Makes me have to test things and figure it out myself. I'm using mIRC as my...client? I think it's called... and I do believe it has all of those things. I don't really know where to begin with what you have here, I understand how it's going to work I just don't know how I would go about actually doing it. I already have the on text and the script that goes there in, it draws things from an ini file and then removes / adds them accordingly. How would it be structured? The timer I mean. Would it be within the seperate little scripts or more like an HTML document and listed to start at the top and end at the bottom? ---------------------------------------------------------------------- Feyl0rd · 2014-12-15 00:36 Also. Tried looking into eggdrop. Nope. I don't even. ---------------------------------------------------------------------- Feyl0rd · 2014-12-15 00:54 on *:TEXT:!buyticket &:#:{ if (!%raffle) { msg $chan Raffle is currently closed! } else { if ($int($2) < 1) { msg $chan Do you really want to buy no tickets?, $nick $+ ..? } elseif ($int($2) > 10) { msg $chan Sorry $nick but you can only buy up to 10 at a Time. } else { var %i = 0, %ticket = $int($2) var %topic = $+(#,.,$nick), %user = $readini(Points.ini,%topic,Points), %end = 10 * %ticket, %delete = %user - %end if (%delete > 0) { writeini -n $qt(Points.ini) %topic Points %delete while (%i < %ticket) { write $qt(Raffle.txt) $nick inc %i } msg $chan $nick you have bought %ticket tickets with %end reputation. } } } } Is currently what I have to work with for what I'm trying to do. ---------------------------------------------------------------------- Pteraspidomorphi · 2014-12-15 01:27 To define functions/commands you want the 'aliases' tab of the scripts editor. You need two: "add to queue" and "process from queue". As far as I can tell from a quick glance mIRC doesn't have arrays but you can use hash tables: /help /hmake You want to keep the amount of elements N on a variable: /help /set Then keep the events waiting to be processed in the hashmap on keys 0 to N-1. Every time you process an event you remove it from position 0, move each event on the hashmap to the previous position, and decrease the N variable. To add a new event just add it in position N and then increment N. The "process from queue" function should be put on a timer, check out: /help /timer You can use an event (remote tab) to run this timer as soon as mIRC starts. The "add to queue" function should be used only if events are being processed too quickly, which you can detect using the method I explained before: Keep the time of the previous event (again, put it in a variable using /set) and then compare with the current time whenever you receive the event. In order to make it easier to process the same event code from both the remote trigger and the queue processing function you should also put it in an alias and call it from both locations. ---------------------------------------------------------------------- Pteraspidomorphi · 2014-12-15 01:34 Scripting in eggdrop is in Tcl. Events are bound using bind: bind pub - !test myproc proc myproc {nick host handle chan text} { putserv "PRIVMSG $chan :Hello world" } http://www.tcl.tk/man/tcl8.5/tutorial/tcltutorial.html putserv sends a raw IRC command. Google IRC RFC for the standard, but essentially all you probably need to know is: * Message syntax: "COMMAND TARGET :TEXT" * PRIVMSG sends a normal message (channel or private), a CTCP request is also a PRIVMSG but the text is surrounded by ascii character 1; the command is the first word. * NOTICE sends a notice, and also doubles as CTCP response if the text is wrapped in ascii character 1. Eggdrop has its own command for setting channel modes: pushmode CHANNEL MODE NICKNAME (nickname only if required) ---------------------------------------------------------------------- Feyl0rd · 2014-12-15 02:27 My only issue with Eggdrop is I couldn't even get it. I mean.. I have some files that I extracted from a tar.gz thing and so I went on an exploration on how to use this... and it took up about an hour and a half of looking to finally give up on it. I wish I was a little more knowledgeable about your previous explanation for the mIRC. It all makes sense I just don't know *how* to do it. What I'll do is tinker with it in hopes that I can get off the ground. ---------------------------------------------------------------------- Pteraspidomorphi · 2014-12-15 02:51 You probably have the linux version. To run (once you have the correct version) edit eggdrop.conf carefully (it's big! you must read everything!) and then launch it (on linux you must compile using ./configure, make, make install). Scripts are added at the very end using the source command. About mIRC I was assuming some scripting knowledge, at least enough for NON-queued event triggers! You may want to look into tutorials for that and general programming tutorials. ---------------------------------------------------------------------- Feyl0rd · 2014-12-15 03:03 Yes! I think it needed to be compiled... so I'll look for a eggdrop for windows? Well I'll give it a look. And yeah... my understanding is lacking and what I'm trying to do seems to require a lot more know-how than what I have. I'll try to get a bunch of things under my belt before I try and tackle this. Baby steps I guess!