event triggers

I know of at least 3 users who are using trade response scripts (I'm sure there will be more to come) and I've done some experimentation with infinite looping such a script and found undesirable effects. My idea for a solution is to set up event triggers like moods. Kolmafia catches recent events and displays them in the recent events tab/window already, and I was thinking that when kolmafia finds a recent event it could trigger a script like moods.

A personal preference would be to have a seperate trigger for trade offer recieved, trade offer accepted, and new message recieved.

Message recieved would actually not be usefull to me, however I would set trade offer recieved to run my trade response script, and trade offer accepted to refresh inventory, and run my script which places items I collect into my DC.
 

Nightmist

Member
But to know when a recent event has occurred wouldn't you need to inf-loop one of the event displaying pages anyway so why not just inf-loop the trades page? Unless your talking about just casual "I'm not actually using it as a bot, im just manually running it when I'm told about a recent event that is about my trades" in which case it would be quite useful for the lazy//forgetful person.


PS. What "undesirable effects" did you find with the inf-looping? Just curious >>
 
[quote author=Nightmist link=topic=537.msg2603#msg2603 date=1161490173]
PS. What "undesirable effects" did you find with the inf-looping? Just curious >>
[/quote]

undesireable effects:
#1 needless server hits to "makeoffer.php"
#2 gradual memory usage increase
#3 kolmafia being locked in a script not allowing other things to be done.



[quote author=Nightmist link=topic=537.msg2603#msg2603 date=1161490173]
But to know when a recent event has occurred wouldn't you need to inf-loop one of the event displaying pages anyway so why not just inf-loop the trades page? Unless your talking about just casual "I'm not actually using it as a bot, im just manually running it when I'm told about a recent event that is about my trades" in which case it would be quite useful for the lazy//forgetful person.
[/quote]

inf loop an event displaying page? No, kolmafia would just catch the event in chat. If I am logged on, I am in chat.

I am a multi tasker...when I come here to read the most recent posts I do not log out of kol. In the time it takes me to post this reply, the event has scrolled past in chat, and I have someone freaking "why aren't you responding to my trade offer? I really need to ascend, but I need that extra meat to buy my chow meins!"

As for it being beneficial to lazy people, the benefits wont be that great because most lazy people will be to lazy to do the up-front work required to set this up in advance.
 

Nightmist

Member
Oh yeah, chat >>. I tend to be in /trade if I'm in chat... which in my opinion seems more resource draining then a main.php refresh every 3 or so minutes but I guess it would be more speedy as well. (Depends on the amount of chatting going on I guess)

Effectively this requested feature would require one to be logged into chat then? (Since other methods require hitting some page like the main page every now and then?)

Ah... those undesirable effects... I've never personally left mafia on long enough for it to start taking up any significant amount of memory but scripts do have problems with 1 and 3.

If this is added would the buffbot module be updated to support this too? (Do the "pointless" server hits when checking for Kmails exceed the hittage from a "empty//near empty" chat? (Does KWE still show the trade//kmail received messages? Since that should be about the most quiet place I can think of?)

xD Sorry if I'm being really really thick today but I haven't had any sleep for the last 38+ hours. >>
 
trade messages...message recieved messages...so and so logged on messages...mmg messages they all come through on all chat channels including kwe.

Would using chat be better than repeatedly hitting main.php or your inbox for buffbots? If you are already in chat yes. If not, I don't think so. I don't have enough knowledge of the server-side workings of kol to know for sure, but I think chat hits the servers a lot more often than the buffbot interface ever dreamed of hitting them.

I'm sure Holatuwol questioned this when writing the buffbot interface, and chat was determined a bad option for it, but that would only be the case if a player was not in chat already. If they are already in chat, then chat is hitting the server already, and chat would prove the better option than repeated extra server hits even if they were on a 5 minute cycle.

Effectively, this feature would only be usefull to those already in chat, and not usefull to those who aren't. The buffbot interface might benefit from it when the player is already in chat, but I don't believe this is often the case for the real buffbots.
 

Nightmist

Member
I specifically chose KWE as the example chat room because of its "No player messages" and so I expect it to hammer the server only when a match is taking place. (Although if chat "refreshes" a blank chat even when player messages are disabled then it probably does hit harder then the current method)
I don't really know how chat works so it's hard to say anything conclusive.

Just trying to sum up what we have here:
1. A "trigger" system for "events". Eg If get trade request then run X script.
2. These events are gathered from chat notifications. (How about event notification on other pages, if its using chat then wouldn't other pages that contain event notification need to be ignored to avoid doubling?)
3. Effectively it's a "moods" that run on "events" rather than various statistics?
 
[quote author=Nightmist link=topic=537.msg2607#msg2607 date=1161524297]
I specifically chose KWE as the example chat room because of its "No player messages" and so I expect it to hammer the server only when a match is taking place. (Although if chat "refreshes" a blank chat even when player messages are disabled then it probably does hit harder then the current method)
I don't really know how chat works so it's hard to say anything conclusive.
[/quote]

My guess which may be totally wrong is that since kwe would still hit the servers php scripts which pool information from the database, that the net effect would be the same as any other channel. The servers script just builds a near empty response. The script server must always respond in some way though in order to prevent a request timed out error in IE or whatever browser you use.

[quote author=Nightmist link=topic=537.msg2607#msg2607 date=1161524297]
Just trying to sum up what we have here:
1. A "trigger" system for "events". Eg If get trade request then run X script.
2. These events are gathered from chat notifications. (How about event notification on other pages, if its using chat then wouldn't other pages that contain event notification need to be ignored to avoid doubling?)
3. Effectively it's a "moods" that run on "events" rather than various statistics?
[/quote]

1. Yes
2. I have never seen the same event notification twice...not saying it won't happen though. It would need to pool all event notifications in order to catch them all I think. If Main.php displays an event notification, I don't think chat will, and vice versa.
3. In a nutshell yes. I couldn't fit my full trade response script into a mood trigger setting, but I would put "call traderesponse.ash" in. for trade accepted I would put in "inv refresh; call sewerdisp.ash". For messages I would leave it blank, however the guy wanting to create a pulverise bot would call his script via the message trigger. Those buying gifts from other players might use a message trigger to pay what they offered.
 
Top