Feature - Implemented enable after-adventure script after manual adventuring

AlbinoRhino

Active member
OK...I've been paying careful attention since I started playing today and made notes but I don't know how helpful they will be because I still have no idea what is causing the script to run twice.

I started out in the hidden city, the script consistently ran only once after each turn (all turns played in the browser with the cli in the chat pane). To the Palindome, still only ran once after each turn. To the Lab, and the script started running twice after each turn for 3 or 4 turns (about 40 turns total played at this point) , then returned to only running once. (Between the palindome and the lab I changed familiars from the hound dog I had been using from the start of play to the happy medium.) Switch back to hound. To the white forest, and the script only ran once after each turn. Switched to npzr, 1 turn for mega gem, and script ran 2X after that adventure. Killed Dr. Awkward, script ran 1X after. Changed gear. 1 turn at Oasis, script ran 1X. 1 turn @ Desert, script ran 2X AND I got an error with debug_log along with a red cli message "Script execution aborted".

Checked the script menu and all scripts were present, so that problem appears fixed, thanks V.

Continued with 3 turns at desert, script ran 1X after first adv., and ran 2X after the next 2 adv.. Got Gnasir, script ran 1X. Switched back to hound. 1 turn getting hydrated, script ran 1X. At this point, when continuuing at the Oasis, the script ran after mood & restore ran. Got the stone rose, and the script did not run at all after.

Oasis for 3 turns, script ran 1X each.

Desert 1X, script 1X. Switch to NPZR. Got Gnasir, script ran 1X. Next fought locust, script ran 2X and again got the error, debug_log and "Script execution aborted" message.

I can't make heads or tails of any of it, but I hope someone else can ! :)
 

Attachments

  • DEBUG_20120318.txt
    4.9 KB · Views: 29

AlbinoRhino

Active member
My script will also sell, closet, smash various items. It appears the debug_logs are occurring when one of those actions is performed. With 2 instances of the script running (they do appear to be running simultaneously because the messages the script prints to the cli are printed twice but often they are mixed together rather than printing one complete set of messages and then printing the set again), one instance of the script will sell (etc.) the item and then the other instance will cause the error by trying to sell (etc.) the item again, which no longer exists in inventory.


EDIT: One further note. Just finished eating using the queue in the item manager and noticed that the script ran twice while mafia was processing the consumption queue. No adventuring at all.
 
Last edited:
Okay ... this is getting weird. Looking back on my recent relay browser adventures I spotted this:
[194] Orc Chasm
Encounter: Flaming Troll
Round 0: Gnocchi Masala wins initiative!
Round 0: Gnocchi Masala casts RAVIOLI SHURIKENS! (auto-attack)
Round 2: flaming troll takes 110 damage.
Round 2: Gnocchi Masala wins the fight!
You gain 52 Meat
You acquire an item: Trollhouse cookies
You gain 5 Beefiness
You gain 15 Wizardliness
You gain 3 Sarcasm
afterAdventureScript
betweenBattleScript
Calling Universal Recovery for type=HP, amount=0
Calling Universal Recovery for type=MP, amount=0
afterAdventureScript
And then this:
[191] Orc Chasm
Encounter: me4t begZ0r
Round 0: Gnocchi Masala wins initiative!
Round 0: Gnocchi Masala casts RAVIOLI SHURIKENS! (auto-attack)
Round 2: me4t begz0r takes 110 damage.
Round 2: Gnocchi Masala wins the fight!
You acquire an item: meat vortex
You gain 6 Fortitude
You gain 11 Mysteriousness
You gain 5 Smarm
betweenBattleScript
Calling Universal Recovery for type=HP, amount=0
Calling Universal Recovery for type=MP, amount=0
Is KM multi threaded? Could we be having threading issues?
 

Veracity

Developer
Staff member
This is irritating. Revision 10807 will trigger the script when the charpane says we have used an adventure, and only that.
This will require further thought, which I will have no time for today.
 

AlbinoRhino

Active member
With r10807, and testing in the castle, it appears the script only runs after non-combats. It does not run at all after fights or choices.
 

Veracity

Developer
Staff member
> get betweenBattleScript

ashq print( "About to adventure in " + my_location() )

> get afterAdventureScript

ashq print( "Just ran an adventure!" )
I then adventured in the Relay Browser. Here are a few samples:

About to adventure in Giant's Castle

[340045] Giant's Castle
Encounter: Procrastination Giant
Round 0: Brianna wins initiative!
Round 1: Brianna attacks!
Round 2: procrastination giant takes 1146 damage.
Round 2: Brianna wins the fight!
After Battle: Gort winks at you.
You gain 388 Meat
You gain 10 Beefiness
You gain 9 Enchantedness
You gain 14 Chutzpah
Just ran an adventure!
A combat.

About to adventure in Giant's Castle

[340049] Giant's Castle
Encounter: Wheel in the Clouds in the Sky, Keep On Turning
A choice adventure which did NOT consume an adventure.

About to adventure in Giant's Castle

[340049] Giant's Castle
Encounter: What are the Odds?
You acquire an item: plot hole
You acquire an item: chaos butterfly
Just ran an adventure!
A non-combat

About to adventure in Giant's Castle

[340050] Giant's Castle
Encounter: Wheel in the Clouds in the Sky, Keep On Turning
Just ran an adventure!
A choice adventure which DID consume an adventure.

I see no bugs.
 

AlbinoRhino

Active member
A choice adventure which did NOT consume an adventure.

My choice was set to not turn the wheel, so that explains that.

I just adventured 27 more times at the castle. About half with charpane override and half without. No difference in behavior noted from that change.

2 non-combats, script ran. 1 choice, using adventure, script ran. 24 combats, script ran 4 of 24 times. Earlier I never saw it run once after a fight.

I'm confused.
 

AlbinoRhino

Active member
OK. Further experimentation, has led to a discovery. I play with the cli open in the chat pane. If I keep combats short and sweet (such as just using attack, like your example above) the script will run. The cli updates quickly, because there is not a lot of info being printed to it. However, using the script button to fight, as I normally do, and a rather long fight description is printed to the cli (rave & disco combos, or stasis etc.) is when the script is not running. (Although, as I said above, it did run 4 times, using a macro script.) I'm not sure what this means but the issue is definitely related to the amount of text the combat messages generate. I closed the browser cli and attempted a few more adventures and the behavior persisted. Long fight text, no script. Short simple attack, script runs.
 

Veracity

Developer
Staff member
The script runs whenever a charpane refresh comes in and we believe you are not "busy" - i.e., doing something that will prevent scripts from executing - and the adventure count has ticked up.

It's hard to imagine why the adventure count would tick up 4 times - thus triggering 4 script calls - when you run a macro.
 

AlbinoRhino

Active member
The script runs whenever a charpane refresh comes in and we believe you are not "busy" - i.e., doing something that will prevent scripts from executing - and the adventure count has ticked up.

It's hard to imagine why the adventure count would tick up 4 times - thus triggering 4 script calls - when you run a macro.

Sorry, I was referring to my previous post where I stated that the script ran after 4 of 24 fights. And I was indicating that I was using a script which produced a lot of text (as opposed to a short attack). In other words, it will sometimes run after lengthy battle text, but mostly not. Short battle text = always runs.
 
Last edited:

Veracity

Developer
Staff member
Perhaps I should try detaching the script processing from the charpane refresh and just run it after an "adventure", whether or not it actually used an adventure, if we are not in the middle of a choice or a fight.

Revision 10809 makes it so. It works fine for me - better, in fact, since it does not wait for the charpane to refresh.
 

AlbinoRhino

Active member
I am still getting the same behavior with r10809. I've now determined that it is when one uses the "script" button which mafia adds to the CAB that the script does not run. Using any of the KoL-provided buttons on the actual CAB, including a CAB button that submits a macro script, works just fine. It's only when the "script" button is used that the after-battle script does not run. Earlier, I was using the "script" button which produced lengthy battle text, and the normal CAB buttons when just attacking and was misled into thinking the issue was related to the length of the messages printed to the cli for battle. Now it has become clearer with further experimentation that the "script" button is the cause. Setting my CCS to just "attack" and using the "script" button will still fail to run the script, even though the battle messages are brief.
 

Veracity

Developer
Staff member
I throw up my hands.

Get me a log, from pressing the "script button" until when the battle finishes and things settle down. Thanks.
 

AlbinoRhino

Active member
I think this is what you want. Used "Start debug log" from help menu, clicked "script" button" in browser, then "Stop debug log" in help menu.

However, the forum attachments tool says the file is too large.
 

Veracity

Developer
Staff member
That's pretty obscure. It looks like when you pressed the "script" button, it submitted:

fight.php?action=macro&macrotext=xxx

...but it did it as a FightRequest, not a RelayRequest. That is almost certainly the issue, since the "run after adventure script from URLs submitted in the Relay Browser" depends on it being a RelayRequest.

I'm going to have to study this and figure out why it is working that way. It's nothing that I have ever looked at before.
 
Top