Bounty! 2 million meat for macro!

StDoodle

Minion
Works like a charrrrm! Well, except that my use of visit_url() in certain circumstances needs to be re-evaluated so as not to page load over the end-of-macro message for macros that don't finish the fight. But that's a ... I won't say "minor" issue, as I suck at regex... but completely doable.

Actually, that's a whole 'nother issue, as touched on in the "Bug" for fight.php override thread... if I want to modify the fight page (say, after a partial macro that doesn't finish the fight), but I don't want to lose the text from immediately after the macro, do I need to parse it* and store it to a file? That's the only solution I can think of, but as I've demonstrated, I don't really understand how override scripts function. ;) If I understand the order of operations on relay scripts (roughly), it might be nice to get a "buffer previous_response()" or the like... but again, I could well be missing something.

* Can't just store the buffer straight away into a map, or strange things seem to happen when there are tabs. Understandably. Though there's really no reason I couldn't just split_string() with a matcher that matched tabs as well as line breaks. And then rebuild it with some foreach appendage.

Also; I'll stop rambling now. I'm just excited! Thanks!

P.S. I claim your bounty.

No problem! Gift package ok? To Veracity (#121572), or is there a multi you'd rather receive it on?
 

Veracity

Developer
Staff member
Actually, that's a whole 'nother issue, as touched on in the "Bug" for fight.php override thread... if I want to modify the fight page (say, after a partial macro that doesn't finish the fight), but I don't want to lose the text from immediately after the macro, do I need to parse it* and store it to a file? That's the only solution I can think of, but as I've demonstrated, I don't really understand how override scripts function. ;) If I understand the order of operations on relay scripts (roughly), it might be nice to get a "buffer previous_response()" or the like... but again, I could well be missing something.
When the user clicks on a link that calls your relay script, your relay script can issue multiple visit_url calls and save the result text from each one. There's nothing to stop it from, somehow, combining the results into a single page and returning it to KoLmafia to display to the user. You want to combine the results of multiple invocations of the relay script - because the user has clicked multiple links in succession - and modify the result of the page which finishes the fight?

Can't just store the buffer straight away into a map, or strange things seem to happen when there are tabs. Understandably.
Well, it would be "understandable" if you were writing the map into a file and reading it in again. Data with tab characters. Huh.

But I don't see why there'd be a problem with simply storing data in a map and fetching it from the same map in a later execution. Unless ASH re-initializes global maps across invocations. It might.

No problem! Gift package ok? To Veracity (#121572), or is there a multi you'd rather receive it on?
Send it to my ascending multi - Tebryn (#1764512) - please. He's currently doing a string of 30 slime tube runs and will then do his first basement dive and is burning through his purse quickly. My main has more meat than she knows what to do with but can't send him meat without, perhaps, attracting the attention of #6.

Thanks!
 

StDoodle

Minion
You want to combine the results of multiple invocations of the relay script - because the user has clicked multiple links in succession - and modify the result of the page which finishes the fight?

Not exactly. If you submit a partial macro -- one that doesn't finish the combat, one way or another -- and then grab the page text with visit_url() [0-parameter], you end up with the "twiddle your thumbs" message. As near as I can tell, to avoid said message, I'll need to save previous page data for use any time a fight stops automation. But I could be wrong, and won't get the chance to really play around with this for another day or two.

I will, at some point, probably be aggregating all of the fight data, though. While on that subject, is there any good way to tell that you're in a distinct fight? Since there are a plethora of 0-adventure "adventures" I'm not sure if I can do anything without saving the latest round number.
Well, it would be "understandable" if you were writing the map into a file and reading it in again. Data with tab characters. Huh.

Exactly; I think I mentioned that, but my thoughts (ramblings) were a bit scattered. ;) Most of KoL doesn't use tabs -- hell, most of KoL uses random capitalization and no more than one or two line breaks per page, with tags opening and closing in random order, which I'm sure you're all too aware of -- but a lot of the newer javascript and some css is copypasta'd from elsewhere and / or done by CDM, so there are some random standards floating around that need to be accounted for. :p

But I don't see why there'd be a problem with simply storing data in a map and fetching it from the same map in a later execution. Unless ASH re-initializes global maps across invocations. It might.

It's possible I've just been overriding things, but I don't think so... or maybe I'm just not clear on how to declare a global at a higher level than the override script? I've never really given that any thought, but I'm not sure I can make anything persist across page loads in an override without explicitly passing it around some how.

Send it to my ascending multi - Tebryn (#1764512) - please.

Sent!
 

Bale

Minion
Badly enough that I still don't recognize the reference but maybe I just don't watch it enough to have vast sections of dialog memorized.

The original was something like, "Jayne, my days of not taking you seriously have certainly come to a middle." I think the episode was "Our Mrs. Reynolds", one of my favorites.
 
Last edited:

StDoodle

Minion
Hmmm... there appears to be an unintended(?) side effect to the recent change; overrides no longer seem to apply to the end of a fight.
 

Veracity

Developer
Staff member
I have no idea what that means. Nothing was changed regarding when overrides are applied. The only thing that changed was one line in the three-argument form of visit_url.

Can you elaborate, please?
 

StDoodle

Minion
Gah, you're too quick; I meant to edit that just now to "nothing to see here, move along..."

To elaborate; don't redeclare the variable used to save page text. :eek:
 
Top