Bug - Fixed CCS only runs one line on visit_url combats

Theraze

Active member
Not sure quite how long this has been going on, but combats called with visit_url/run_combat are only running one line of the CCS currently. My line 1 is Smart Stasis, and once it stops trying to do stasis, combat aborts. Aborting and doing a run_combat manually will solve the issue, doing a 5 second wait with the run_combat works as well. My current workaround was putting my spam attack macro into the end of Smart Stasis, and now my client works as it did before this change happened.

Not sure exactly when it changed... think it was a month or two though. Here are two combats from my tavern script:
[483] Tavern Cellar (row 3, col 5)
Encounter: drunken rat
Round 0: Theraze wins initiative!
> Monster value: 290
> HP/round from Mosquito: 3.75
> Profit per round: 13.33
[483] Tavern Cellar
[483] Tavern Cellar (row 3, col 5)
Round 3: Theraze executes a macro!
Round 3: Theraze attacks!
Round 4: drunken rat takes 49 damage.
You gain 12 Meat
You acquire an item: rat whisker
You gain 1 Strengthliness
You gain 2 Mysteriousness
You gain 1 Smarm
[484] Tavern Cellar
Encounter: The Tavern Cellar
[484] Tavern Cellar (row 4, col 5)
Encounter: drunken rat
Round 0: Theraze wins initiative!
> Monster value: 290
> HP/round from Mosquito: 3.75
> Profit per round: 0
[484] Tavern Cellar
[484] Tavern Cellar (row 4, col 5)
Round 3: Theraze executes a macro!
Round 3: Theraze attacks!
Round 4: drunken rat takes 54 damage.
You gain 11 Meat
You acquire an item: rat whisker
You acquire an item: rat appendix
You gain 2 Beefiness
You gain 3 Magicalness

The tavern cellar between adventures is it checking for which squares are unlocked... the issue is that when this part of the script hits:
PHP:
 if (contains_text(page, "Combat"))
 {
  run_combat();
 }
it starts combat, but doesn't finish it. Using my newer one-line consult (where Smart Stasis runs its attack with weapon spam automatically instead of letting mafia run it as another line), I get this as, using the same visit_url/run_combat:
[341] Tavern Cellar (row 4, col 4)
Encounter: drunken rat
Round 0: Theraze wins initiative!
> Monster value: 290
> HP/round from Mosquito: 2.25
> Profit per round: 6.67
Round 1: Theraze executes a macro!
Round 1: Theraze attacks!
Round 2: drunken rat takes 29 damage.
You gain 10 Meat
You acquire an item: rat whisker
You gain 1 Enchantedness
You gain 3 Cheek
[342] Tavern Cellar
Encounter: The Tavern Cellar
[342] Tavern Cellar (row 3, col 4)
Encounter: drunken rat
Round 0: Theraze wins initiative!
> Monster value: 290
> HP/round from Mosquito: 2.25
> Profit per round: 6.67
Round 1: Theraze executes a macro!
Round 1: Theraze attacks!
Round 2: drunken rat takes 28 damage.
You gain 10 Meat
You acquire an item: rat whisker
You acquire an item: rat appendix
You gain 4 Cheek
You can still see the SS display bits above, but combat runs properly...

I'm reporting this now because Xenthes had the same issue with using a different consult script and it reminded me that, instead of just helping people to run workarounds, I should really make a bug report. :D
 

StDoodle

Minion
Aaaaaaaaaah....I ran into this when using visit_url() to construct and send macros in a consult script, but assumed it was the macro itself that broke mafia's ability to run anything further in the CCS. It didn't strike me as a bug for mafia to have problems with unsupported behavior, but if that happens with run_combat() and non-macro visit_url() too, I can see the problem.
 

Winterbay

Active member
Yes, this is definitely happening at times. Especially with scripts that try to use visit_url to automate the Rat Cellar or Hidden City (well, at leats BCC's one). I have built myself an alias that seems to be working to get myself out of the situation but it's still annoying :)
 

Theraze

Active member
I'm currently experiencing it with the Rat Cellar, Spooky Forest for level 2 and unlocking the temple (using visit_url to bypass mafia's lack of complex goals, so I can just set the steps I want using visit_url repeatedly and without screwing up personal settings), and Mr Alarm detection for level 11. Using zarqon's Hidden City system which actually uses adv1 instead of visit_url on that, so no issues there...
 

Veracity

Developer
Staff member
The bug title is a little misleading...

CCS:

Code:
[ default ]
item spices
item spices
attack with weapon

vu.ash:

Code:
string text = visit_url( "adventure.php?pwd&snarfblat=82" );
if ( text.contains_text( "Combat" ) ) {
  run_combat();
 }

Test:

> vu.ash

[277486] Giant's Castle
Encounter: Raver Giant
Round 0: Chondara wins initiative!
Round 1: Chondara executes a macro!
Round 1: Chondara uses the spices!
Round 2: raver giant takes 1 damage.
Round 2: Chondara uses the spices!
Round 3: raver giant takes 1 damage.
Round 3: Chondara attacks!
Round 4: raver giant takes 1556 damage.
After Battle: Trorg sits on your fallen opponent's body, blows a smoke ring, and winks at you.
You gain 629 Meat
You acquire an item: Angry Farmer candy
You acquire an item: Mick's IcyVapoHotness Rub
You gain 7 Strongness
You gain 23 Magicalness
You gain 13 Roguishness
You gain a Moxie point!

I guess I'll have to make a dummy consult script to disable macroization of the CCS and try again; with macroization, run_combat has no problem doing all the lines of the CCS, as you can see.
 

Veracity

Developer
Staff member
Here is another test:

CCS:

Code:
[ default ]
consult consult.ash
item spices
item spices
attack with weapon

consult.ash:

Code:
int main( string round, string encounter, string text )
{
  print( "In round " + round + " fighting " + encounter );
  return 0;
}

vu.ash:

Code:
string text = visit_url( "adventure.php?pwd&snarfblat=82" );
if ( text.contains_text( "Combat" ) ) {
  run_combat();
 }

Test:

> vu.ash

[277489] Giant's Castle
Encounter: Alphabet Giant
Round 0: Chondara wins initiative!
(unable to macrofy due to action: consult consult.ash)
In round 1 fighting alphabet giant
Round 1: Chondara uses the spices!
Round 2: alphabet giant takes 1 damage.
Round 2: Chondara uses the spices!
Round 3: alphabet giant takes 1 damage.
Round 3: Chondara attacks!
Round 4: alphabet giant takes 1541 damage.
After Battle: Trorg sits on your fallen opponent's body, blows a smoke ring, and winks at you.
You gain 558 Meat
You acquire an item: original G
You gain 8 Strongness
You gain 24 Enchantedness
You gain 12 Chutzpah
 

Theraze

Active member
Hmm... maybe it's an issue with multiple consults? I think the problem may have arisen when I took zarqon's suggestion to cut server hits of doing the consult for spamattack to finish the fight. I'll try to remember to test after rollover...

1) Start with your initial test consult, follow with a combat macro.
2) Start with your initial test consult, follow with attack with weapon.

For the record, his spam attack consult/macro is here: http://kolmafia.us/showthread.php?5234-Spam-attack-and-save-servers
 

Theraze

Active member
Hmm... doing either vu.ash or vu2.ash both fail to break combat... here's vu2.ash:
Code:
void OneAdventure()
{
 if (to_float(my_hp()) / my_maxhp() < to_float(get_property("hpAutoRecovery")))
  restore_hp(0);
 buffer page = visit_url("adventure.php?snarfblat=82");
 
 if (contains_text(page, "Combat"))
 {
  run_combat();
 }
}
void main()
{
 OneAdventure();
}

I should have a new ascender today or tomorrow, so I can see if it still breaks or if it's working now with the Level 3 script that gave that combat from above.

Edit: Well, level 2 script (which does the same) did this today...
> level 2

Council of Loathing

We still need a mosquito larva, Adventurer. Please find us one, in the Spooky Forest.
Countdown: 1 second...
Waiting completed.

[57] Spooky Forest
Encounter: spooky mummy
Round 0: Theraze loses initiative!
(unable to macrofy due to action: consult SmartStasis.ash)
Monster value: 59.2
Profit per round: 0
Round 1: Theraze executes a macro!
Round 1: Theraze attacks!
You lose 1 hit point
You lose 1 hit point
Round 2: Theraze attacks!
Round 3: spooky mummy takes 8 damage.
You gain 8 Meat
You gain 1 Sarcasm
So... no problems with visit_url/combat just yet. Maybe it got fixed in the interim. That would be nice. It was just reported by Xenthes as having issues yesterday...
 
Last edited:

Winterbay

Active member
I have run in to the same type of problem at times when I use the relay browser and when I click the "script"-button it runs SmartStasis and then exits from that and doesn't run spamattack. It changes the button to "again" and when I click that kol states that I twiddle my thumbs and the button changes back to "script" and clicking that again generally finishes the fight (similary to what a manual run_combat() do).
 

StDoodle

Minion
Out of curiosity; any chance this is related to the issue where, on some occasions that I've yet to find rhyme or reason to, my relay override for the fight page doesn't fire?
 

Theraze

Active member
Happening again today...
> level 3
Council of Loathing
The owner of the Typical Tavern is still bugging us about his rat problems. Perhaps you could help him?
You have not yet slain the Boss Bat. He can be found in the Bat Hole, in the Nearby Plains.
We still need you to neutralize the Goblin King, Adventurer.
Countdown: 1 second...
Waiting completed.
Conditions list cleared.
Mood swing complete.
lastTavernSquare => 0
lastTavernAscension => 7
tavernLayout => 0000000000000000000000000
[223] Tavern Cellar
Encounter: The Tavern Cellar
Searching for "anti-anti-antidote"...
Purchasing anti-anti-antidote (1 @ 30)...
You acquire an item: anti-anti-antidote
You spent 30 Meat
Purchases complete.
_meatpermp => 8.0
_meatperhp => 6.6666665
_version_BalesUniversalRecovery => 3.78
Purchasing some magical mystery juices for use as a combat restorative.
Searching for "magical mystery juice"...
Purchasing magical mystery juice (2 @ 100)...
You acquire magical mystery juice (2)
You spent 200 Meat
Purchases complete.
Restoring HP! Currently at 15 of 24 HP, 20 of 40 MP, current meat: 353 ... Target HP = 23.
Visiting Doc Galaktik...
Restore 9 HP at Doc Galaktik's
You gain 9 hit points
You spent 90 Meat
Cure purchased.
[223] Tavern Cellar (row 2, col 5)
Encounter: drunken rat
Round 0: Theraze wins initiative!
(unable to macrofy due to action: consult SmartStasis.ash)
Checking for updates (running ZLib ver. : 21)...
_version_zlib => : 21
You have a current version of ZLib.
Monster value: 290
Checking for updates (running First Things First ver. 4.0)...
_version_FTF => 4.0
You have a current version of First Things First.
HP/round from Mosquito: 2
Profit per round: 0
Checking for updates (running SmartStasis ver. 2.6)...
_version_SS => 2.6
You have a current version of SmartStasis.
map_use_for_items.txt => 2009-12-31T23:06:36-06:00, checked 20110120
You have the latest use_for_items.txt. Will not check again today.
[223] Tavern Cellar
KoLmafia thinks it is round 2 but KoL thinks it is round 1
Unexpected error, debug log printed.
[223] Tavern Cellar (row 2, col 5)
KoLmafia thinks it is round 3 but KoL thinks it is round 1
Unexpected error, debug log printed.
Round 3: Theraze executes a macro!
Round 3: Theraze attacks!
KoLmafia thinks it is round 4 but KoL thinks it is round 2
Round 4: drunken rat takes 14 damage.
Round 4: Theraze wins the fight!
You gain 10 Meat
You acquire an item: rat whisker
You gain 3 Strongness
You gain a Muscle point!
You gain 1 Sarcasm
[224] Tavern Cellar
Encounter: The Tavern Cellar
[224] Tavern Cellar (row 3, col 5)
Encounter: Staring Down the Barrel
You acquire ice-cold Willer (3)
[225] Tavern Cellar
Encounter: The Tavern Cellar
[225] Tavern Cellar (row 4, col 5)
Encounter: drunken rat
Round 0: Theraze wins initiative!
(unable to macrofy due to action: consult SmartStasis.ash)
Monster value: 290
HP/round from Mosquito: 2
Profit per round: 6.67
[225] Tavern Cellar
KoLmafia thinks it is round 2 but KoL thinks it is round 1
Unexpected error, debug log printed.
[225] Tavern Cellar (row 4, col 5)
KoLmafia thinks it is round 3 but KoL thinks it is round 1
Unexpected error, debug log printed.
Round 3: Theraze executes a macro!
Round 3: Theraze attacks!
KoLmafia thinks it is round 4 but KoL thinks it is round 2
Round 4: drunken rat takes 15 damage.
Round 4: Theraze wins the fight!
You gain 10 Meat
You acquire an item: rat whisker
You gain 3 Beefiness
You gain 1 Wizardliness
You gain 1 Cheek

Time to test a vu.ash and vu2.ash that run against the haunted kitchen...

Edit: And... vu.ash and vu2.ash both ran fine. And, though initially restarting the Level 3 script retained the same issues, after running the vu/vu2, level 3 finished the last 2 rats in the cellar without an issue. I'm stumped here... Maybe editing the CCS settings to set it to use consult consult.ash is fixing whatever the issue is?
 
Last edited:

Veracity

Developer
Staff member
Happening again today...

Code:
225] Tavern Cellar (row 4, col 5)
Encounter: drunken rat
Round 0: Theraze wins initiative!
(unable to macrofy due to action: consult SmartStasis.ash)
Monster value: 290
HP/round from Mosquito: 2
Profit per round: 6.67
[225] Tavern Cellar
KoLmafia thinks it is round 2 but KoL thinks it is round 1
Unexpected error, debug log printed.
[225] Tavern Cellar (row 4, col 5)
KoLmafia thinks it is round 3 but KoL thinks it is round 1
Unexpected error, debug log printed.
Round 3: Theraze executes a macro!
Round 3: Theraze attacks!
KoLmafia thinks it is round 4 but KoL thinks it is round 2
Round 4: drunken rat takes 15 damage.
Round 4: Theraze wins the fight!
You gain 10 Meat
You acquire an item: rat whisker
You gain 3 Beefiness
You gain 1 Wizardliness
You gain 1 Cheek
Debug logs for the "Unexpected errors"?
 

Theraze

Active member
Ah... well noted. Here it is. Looks like the issue is that it's trying to parse "consult SmartStasis" as a number instead of as words...
 

Attachments

  • DEBUG_20110120.txt
    45.1 KB · Views: 30

Veracity

Developer
Staff member
You'll be happy to know that I can now reproduce this at will and am putting in debug logging and such to try and figure out what the heck is going on.

CCS:

Code:
[ default ]
consult consult.ash
consult consult2.ash
item spices
item spices
attack with weapon

consult.ash:

Code:
int main( string round, string encounter, string text )
{
  print( "Consult: In round " + round + " fighting " + encounter );
  throw_item( $item[ seal tooth ] );
  return 0;
}

consult2.ash:

Code:
int main( string round, string encounter, string text )
{
  print( "Consult2: In round " + round + " fighting " + encounter );
  throw_item( $item[ seal tooth ] );
  return 0;
}

vu.ash:

Code:
string text = visit_url( "adventure.php?pwd&snarfblat=82" );
if ( text.contains_text( "Combat" ) ) {
  run_combat();
 }

test:

> vu.ash

[281423] Giant's Castle
Encounter: Raver Giant
Round 0: Chondara wins initiative!
(unable to macrofy due to action: consult consult.ash)
Consult: In round 1 fighting raver giant
Round 1: Chondara uses the seal tooth!

[281423] Giant's Castle
KoLmafia thinks it is round 3 but KoL thinks it is round 2
Round 3: Chondara attacks!
KoLmafia thinks it is round 4 but KoL thinks it is round 3
Round 4: raver giant takes 1557 damage.
Round 4: Chondara wins the fight!
After Battle: Trorg sits on your fallen opponent's body, blows a smoke ring, and winks at you.
You gain 666 Meat
You gain 11 Strengthliness
You gain 17 Wizardliness
You gain 10 Sarcasm
...and that break in the middle is because it stopped and I had to finish it in the Relay Browser...
 
Top