Illarion's stasis script - help requested

I

IllarionDS

Guest
Hi everyone.
I'm having a crack at writing a stasis script, using the new "consult" custom combat option, but I'm running into some trouble.

Note the various function declarations using "...(monster eek)", e.g.:

Code:
void main(int iRound, monster enemy, string sText)
int MaxExpectedDamage(monster eek)

When I run it as written, I get "Bad monster name", which I believe is related to these declarations (though I can't be sure, as the only output I get - despite the debug prints - is:
Code:
Encounter: Knob Goblin Harem Girl 
Bad monster name 
Script aborted!

If I change the declarations to use $monster instead, I get:
Code:
Encounter: Knob Goblin Harem Girl 
')' Expected at line 100 in file scripts\ASHStasis.ash

(line 100 being the function declaration using $monster)

Does anyone have any idea where I'm going wrong? It's been a couple of months since I tried any real ASH scripting I'm afraid, so I'm a little rusty.

It's obviously work in progress, so please be kind!
 

Attachments

  • ASHStasis.ash
    2.7 KB · Views: 106

holatuwol

Developer
The value being passed to the script was always an empty string, and no monster matches the empty string. I debugged this by letting the parameter be a string instead of a monster and printing it, saying to myself, "That ... why is it blank?" And figuring out why after a bit of digging. Sorry about that. :)
 

BDrag0n

Member
I'm interested, but now posing a question here since hopefully someone can answer it.

Is there any way to make an in-combat script pop up the mini-browser to finish the fight? It seems like abort should, but I've not had the guts to try it!
 

illarion

Member
I was also wondering that.

Let's try...

Yup,
Code:
cli_execute("abort");

works fine.

A question for Hola:
Does the third parameter passed in via Consult (string sText, in my code) only contain the HTML for the first round or something?
I've been trying to use something like this:

Code:
  iStart = index_of(sText, "You lose " );
	  iEnd = index_of(sText, " hit point" );
	  if (dbug) { print("iStart = " + iStart + "iEnd = " + iEnd); } 
	  if (iStart > 0 && iEnd > 0)
	  {
			sTemp = substring(sText,iStart+9,iEnd );
			iDamTaken = string_to_int(sTemp);
			if (dbug) { print("Took Dam: " + iDamTaken); }
	  }
to track damage you take, but iStart and iEnd always come up as -1, ie substring not found - though it works fine in a test harness I've written.

I've tried with a regex as well, with the same results (it just doesn't believe "You lose " or " hit point" exist in the text - though the page source in the relay browser shows them.
 

holatuwol

Developer
... Actually, yes. It only contains text pertaining to the last round internally processed. Fixed, will be available in the next release.
 

BDrag0n

Member
I've identified an issue with the damage parsing script, but I'll be damned if I can figure out a way past it.

iDamage shows correctly, if you're getting hit. However, if the words "hit point" show up anywhere else on the screen (such as if you've cast Salve, or if you're running Jal as well) then Mafia gets confused and infinite loops e.g.
Code:
iCurDelevel=6 
Enemy Atk=136-6 to 119 mox - noodle. 
Parsing damage 
iStart = 2943 iCheck = 3315 
Script succeeded! 
Round 2 
iCurDelevel=6 
Enemy Atk=136-6 to 119 mox - noodle. 
Parsing damage 
iStart = 2969 iCheck = 3344

I've tried changing sTemp to a substring of "You lose " to "Attack with ", and then taking substring of that for the iDam check, but it loops again so I'm obviously doing something wrong.
 

illarion

Member
OK, I think this is fixed, but Illarion is powerlevelling at the moment and can't test.

v1.11 at http://forums.hardcoreoxygenation.com/viewtopic.php?p=28104#28104
Latest problem, new as of 9.6 I believe.

Sometimes (can't yet determine the trigger), consult custom combat gets "stuck", with the round number not updating.
For my stasis script, this of course means fights time out at round 30.

So gCLI output goes:
Code:
Round 1 
Delevel => 0 
iCurDelevel=0 
Enemy Atk=69-0 to 57 mox - noodle. 
Parsing damage 
iStart = -1iEnd = 0 
Delevel => 6 PostNoodle, stored iCurDelevel=6
Script succeeded! 
[b]Round 2 [/b]
iCurDelevel=6 
Parsing damage 
iStart = -1iEnd = 0 
Attack and miss 
Script succeeded! 
[b]Round 2[/b] iCurDelevel=6 
Parsing damage 
iStart = -1iEnd = 0 
Attack and miss 
Script succeeded!

... ad infinitum.
 

illarion

Member
- Round 27: illarion attacks with fear-inducing body language!
- Round 27: illarion casts the enchanted spell of SAUCY SALVE!
You gain 5 Mana Points
You lose 5 hit points
- Round 28: illarion attacks with fear-inducing body language!
- Round 28: illarion casts the enchanted spell of SAUCY SALVE!
- Round 29: illarion casts the enchanted spell of THRUST-SMACK!
- Round 29: illarion casts the enchanted spell of SAUCY SALVE!
You gain 14 hit points
You gain 13 hit points
- Round 2: illarion casts the enchanted spell of ENTANGLING NOODLES!
- Round 2: illarion attacks with fear-inducing body language!
- Round 2: illarion attacks with fear-inducing body language!
- Round 2: illarion attacks with fear-inducing body language!
- Round 2: illarion attacks with fear-inducing body language!
- Round 2: illarion attacks with fear-inducing body language!
- Round 2: illarion attacks with fear-inducing body language!
- Round 2: illarion attacks with fear-inducing body language!
- Round 2: illarion attacks with fear-inducing body language!
- Round 2: illarion attacks with fear-inducing body language!
- Round 2: illarion attacks with fear-inducing body language!
- Round 2: illarion attacks with fear-inducing body language!
- Round 2: illarion attacks with fear-inducing body language!
- Round 2: illarion attacks with fear-inducing body language!
- Round 2: illarion attacks with fear-inducing body language!
- Round 2: illarion attacks with fear-inducing body language!
- Round 2: illarion attacks with fear-inducing body language!
 

illarion

Member
That's verbatim. Weird looking in several ways, I know.

I've emailed you the whole log, the relevant portion is right near the end (though from memory, it should have happened a good few times elsewhere in that session also).
 
Top