Charged Magnet auto equip

halfvoid

Member
no bueno

You can't access the CLI output from within a script.

The best way would be to write a little custom combat script for it that sets a counter. Like this:

Code:
void main(int initround, monster foe, string url) {
   if (foe == $monster[rock snake] || foe == $monster[rock homunculus] || 
       foe == $monster[rock fish] || foe = $monster[clod hopper])
      cli_execute("counters add 31 rockmonster");
}

You can use this by specifying it in your CCS:

[ default ]
consult isitarockmonsterorwhat.ash
consult SmartStasis.ash
attack


By the way, it's 31 because once you finish the combat it will be 30. Then, in your betweenBattleScript, include something like this:

Code:
if (get_counters("rockmonster",0,0) != "") equip($item[charged magnet]);
   else equip($item[whatever offhand item you normally use])

That should keep you rolling in rock monsters. I think.

tried implementing this.
made a isitarockmonsterorwhat.ash with the exact code above (plus one missing "=")
added that to the begining of my ccs.
added the second part to somewhere in the middle of BBB.
and it appears to absolutely not work at all.
i've got my secondary off hand item set to be a spiky turtle shield.
 

Catch-22

Active member
tried implementing this.
made a isitarockmonsterorwhat.ash with the exact code above (plus one missing "=")
added that to the begining of my ccs.
added the second part to somewhere in the middle of BBB.
and it appears to absolutely not work at all.
i've got my secondary off hand item set to be a spiky turtle shield.

halfvoid, have you read what I wrote in my post regarding the counter? That's probably what is happening.
 

zarqon

Well-known member
Yes, Spiny and Catch-22 revealed my quick solution of always using 30 to be inadequate. Since the number of between-rock-monster adventures varies within a range, you can't really use counters, unless you set it to the minimum value, then adventure until encountering a rock monster. Which would be a good bit more complicated than what I wrote about above, involving a counterScript (to equip the magnet), a CCS (to detect when you finally encounter the rock monster and reset the counter), and a betweenBattleScript (to check available counters and re-equip your previous offhand item if there is a rock monster counter).
 

Catch-22

Active member
Yes, Spiny and Catch-22 revealed my quick solution of always using 30 to be inadequate. Since the number of between-rock-monster adventures varies within a range, you can't really use counters, unless you set it to the minimum value, then adventure until encountering a rock monster. Which would be a good bit more complicated than what I wrote about above, involving a counterScript (to equip the magnet), a CCS (to detect when you finally encounter the rock monster and reset the counter), and a betweenBattleScript (to check available counters and re-equip your previous offhand item if there is a rock monster counter).

No, it's not entirely broken. You just need to set the counter to 25 and reset the counter when you encounter a rock monster. You should equip the charged magnet initially to "calibrate" the counter.

So instead of:
Code:
cli_execute("counters add 31 rockmonster");

Try:
Code:
cli_execute("counters clear");
cli_execute("counters add 25 rockmonster");

and instead of:
Code:
if (get_counters("rockmonster",0,0) != "") equip($item[charged magnet]);
   else equip($item[whatever offhand item you normally use])

Try:
Code:
if (get_counters("rockmonster",0,0) = "rockmonster") equip($item[charged magnet]);
if (get_counters("rockmonster",24,24) = "rockmonster") equip($item[whatever offhand item you normally use]);

The downside to using counters is that you will clear all your counters, instead of just the one you want. This leads me to two feature requests :)

1. The ability in CLI to clear a counter based on it's label ie. counters clear rockmonster
2. The ability in ASH to get a counter value based on it's label ie. get_counter("rockmonster") returns the counter value, or null if there is no counter/value.

Also I'm not sure if it's a bug or a "feature", but I've noticed that you can have multiple counters with the same label and that an already existing counter can't be added to. Might account for some of the strange behavior appearing when using counters.

Code:
> counters add 5 test

Unexpired counters:
test (5)

> counters add 5 test

Unexpired counters:
test (5)

> counters add 6 test

Unexpired counters:
test (5)
test (6)

If you're clearing all the counters, then it shouldn't affect you.
 
Last edited:

halfvoid

Member
The downside to using counters is that you will clear all your counters, instead of just the one you want. This leads me to two feature requests :)

1. The ability in CLI to clear a counter based on it's label ie. counters clear rockmonster
2. The ability in ASH to get a counter value based on it's label ie. get_counter("rockmonster") returns the counter value, or null if there is no counter/value.

Also I'm not sure if it's a bug or a "feature", but I've noticed that you can have multiple counters with the same label and that an already existing counter can't be added to. Might account for some of the strange behavior appearing when using counters.

Yeah, if it weren't for keeping track of my he-boulder's major rays i would have tried that next. The ability to clear individual counters would very much make me happy as well.
 
Top