I've been messing around with the counter scripts trying to get around one issue and so far had no luck. The main issue is that if I am on a bounty hunt and the fortune cookie counterscript triggers, sometimes when it gets back from obtaining the semi-rare, the goals will have been cleared, so my bounty script just keeps plugging away at the bounty location - even though the lucre has already been obtained. This tends to occur when the turn on which the final bounty item is obtained / would be obtained falls exactly on the same turn that the fortune cookie counter is up. (I can't reproduce this with any consistency unfortunately - but it gets annoying when it does happen)
So to get around that, I decided to try manually obtaining the count till the next fortune cookie number and handle it inside the bounty script.
e.g.
Next Cookie number is 56, so adventure 55 turns, and then spend 1 turn at the desired semi-rare location. Then add the bounty goal back in and continue.
The code I use to get the exact value of the counter is this:
As you can see - this code is rather ugly - but it works. What I'm hoping is that there is a better way to do this - that is - to get the specific value of a certain counter without having to loop through each number.
Any suggestions?
So to get around that, I decided to try manually obtaining the count till the next fortune cookie number and handle it inside the bounty script.
e.g.
Next Cookie number is 56, so adventure 55 turns, and then spend 1 turn at the desired semi-rare location. Then add the bounty goal back in and continue.
The code I use to get the exact value of the counter is this:
Code:
// return next semi-rare value or -1 if there is no next value
int getNextSemiAdv() {
String checkRare;
// To save processing time - do an overall check first
if (get_counters("Fortune Cookie", 0, my_adventures()) == "") {
return -1;
}
// One does exist - so iterate to find the number
for i from 0 upto my_adventures() {
if (get_counters("Fortune Cookie", i, i) != "") {
return i;
}
}
return -1;
}
As you can see - this code is rather ugly - but it works. What I'm hoping is that there is a better way to do this - that is - to get the specific value of a certain counter without having to loop through each number.
Any suggestions?