Calling of CounterChecker-script from within another script

Winterbay

Active member
With a script like Bumcheekascend that uses visit_url to perform certain actions, such as adventuring at the Twin peak, Mafia updates the turn counter and deducts other counters just fine however between battle stuff such as the betweenBattleScript and counterScript will not fire.

So, is there any way to trigger a counterScript or betweenBattleScript from within another script between visit_url calls?

I have the following set up in BCAscend, in the betweenBattle()-function built for this reason, but since I can only pass on one parameter to the counterScript it doesn't really work out very well.
Code:
if (get_counters("fortune cookie", 0, 0) == "Fortune Cookie" && get_property("counterScript") != "") cli_execute("call " + get_property("counterScript Fortune Cookie") + " Fortune Cookie");
 

nworbetan

Member
I'm not sure if I completely understand what you mean by "I can only pass on one parameter to the counterScript". Is that limitation caused by the way counter scripts work in general, or the counter script you're using, or is it related to how you need to check for individual specific counters when you use get_counters("check for this", x, x)? And what exactly doesn't work well with the code you're using?

I personally have only ever used "fortune cookie" and "semirare window begin" as arguments to get_counters(), and I've never used a counterScript, but still, I'm sure you're not trying to do anything that's impossible.
 

Theraze

Active member
On a counter script, the main looks like the following:
Code:
boolean main(string name, int remain) {
Each counter needs to be passed, individually, by name, including how many turns remain. Currently, there's no easy way to find out if you have a counter if you don't already know what it is. I believe the easiest way to meet this request involves something like returning a map of counters with name and turns. The problem with this is that you can have multiple counters with the same name (like the fortune cookie counter) so it would need an int as the record number or something like that to keep them from overwriting each other.
 

Winterbay

Active member
Yep, as Theraze says any counter-script needs to have a main like that, just as a between battle scritp or a consult script needs to have a certain setup on their mains. In this case the script requires 2 inputs and you can only enter one via the command line and so the other needs to be entered manually by the user which is sub-optimal in a very automated script like BCAscend.
 

Bale

Minion
I believe that the best solution for this problem would be to allow the passing of multiple parameters to a script on the command line.

Multiple parameters could be separated by tab characters. "\t"
 

Theraze

Active member
Combining that as well as offering some method for getting a full list of counters would solve the request... without the second though, you'd need to parse a full list of every possible counter that you wanted reporting on for visit_url hits every attempt. Messy/slow code there...
 

Winterbay

Active member
Well, I'm mainly interested in parsing fortune cookie counters, because honestly those are the only one that I can think of that is so time sensitive (i.e. the other counters does not generally account for something that will happen on the next turn and only on the next turn).
 

Theraze

Active member
Dance counter override next turn, that it takes 3 turns burned on a shore trip, holiday monsters with a guaranteed override because they've hit their max turn... I can keep coming up with more if you like, but all of these are important to how much you 'believe' in that next turn and its worth. :)
 

Winterbay

Active member
Ahh yes of course, however none of those are counters that I would expect BCAscend to have problem with in conjunction with visit_url (which was my rather narrow scope) :)
 

Theraze

Active member
Well, I was listing those as items that would override and wipe out your semirare, making the targetted location irrelevant. :) Any major counter (or multi-adventure turn-burn, such as the -10 adventure bugbear NC) that happens to fall on your semirare turn overrides it, right? So if you're parsing that anyways, may as well make sure there's a reason for your calling the script. Or give an informative message to the user along the lines of "Stop using dance cards or fortune cookies. You're doing it wrong." or something else similarly useful. :p
 

lostcalpolydude

Developer
Staff member
Wandering monsters will never override a semirare. I don't think there's any multi-adventure thing that an ascension script would want to do that needs visit_url().
 

Theraze

Active member
Really? I'm fairly certain I got a "must have been the wrong number" on a wandering elf earlier this Crimbo on a 1 FC (certain adventure) counter. But hey, counter-fail isn't listed in the logs, so I have nothing but my memory to prove it.
 

Theraze

Active member
So basically, wandering monsters WOULD override your semi-rare if they weren't specifically set not to, since they're the third most likely and semirares are the seventh. So if it did override, it was probably a KoL bug. Or a 'feature' of this Crimbo.
 
Top