KoLmafia & Stasis

holatuwol

Developer
I'm open to the idea of implementing something which makes the mining quest trivial, because there's something I've been curious about for awhile, and if the ASH community will solve it for me, I'll yield on the mining quest.  Assume that you will have the following four functions added to the list of functions available to the ASH:

string location_to_url( location )
string visit_url( string )
boolean contains_text( string, string )
void refresh_sidepane()

Assume that visit_url() follows redirects and returns the response text located at that redirect.  If it encounters a choice adventure, then it will automatically take the choice and return the text found there.  This redirect following includes fight pages.

My request is that someone implement a full-blown stasis script for stasis-ing at the 8-bit realm.  You won't have the ASH interpreter for it, so no testing (or even valid compilation) is necessary.  I'd like to see what stasis looks like, in an automated environment.  If anyone completes a stasis script which embodies all the mathematical calculations handled by people who currently use a stasis-like strategy, all four functions will be added.  Otherwise, assume that none of these functions will exist.
 

Tirian

Member
Stasis & Combat Control & access to HTML output

I'll take a swing at a stasis script. I wrote this to be a little more general than the 8-bit realm just because I could. I've never tried stasis myself (and especially not as a pro), so I don't know if there is a need for a NUKE attack as well that really seriously puts an end to the battle with Thrust Smack or Stream of Sauce. But it's easy enough to see where it would go.

A few notes:

I made up a few functions that I didn't write here. my_ml() returns your current monster level surplus, my_skill_discount() returns the amount of -MP on skills that you cast from wearing a wizard hat or stainless suspenders or what have you, and my_mp_string() would return "Mana Points", "Mojo Points", or "Muscularity Points" depending on your class. Even though I didn't write them here, I'd write them in a working script rather than expecting you to implement them for me. :)

Also, I skipped a few functions like battle_with_item(...) and battle_with_skill(...) that would construct the appropriate URL, pass it through visit_url(...), and pass back the HTML. If you truly let us use visit_url() to handle our own combat, then these would be staples of mine alongside battle_with_weapon, battle_with_two_items, and battle_escape. You could either incorporate that into ASH or not -- you might as well as it saves us from the potential of misformatting our raw URLs and making the servers cry. And if this is the path we went down, I don't know that I'd ever use adventure() again. Not because I'd turn into a stasis freak, but because combat turn-by-turn control would let me use Saucy Salve to heal and various poking skills to intelligently manage my plinking style. That's ... wow ... final frontier. I didn't recognize that this function was quite that powerful.

And there are a few kludges. First, even though the stasis users probably use dual seal tooths (or spices or turtle summoning or what have you), I can't necessarily catch the results of a dual use because we asked for a boolean-returning contains_text and not an int-returning text_contain_count. In theory, if these items always do 2-3 damage and never miss then we could figure out if we did a total of 4, 5, or 6 damage by seeing which hit amounts were there or missing, but that's another five lines of code for later. Also, note that if you restore your MP with a seltzer then I disable checking for a saucesphere hit in the next round because if the seltzer returned 5 MP the "parser" wouldn't be able to see a saucesphere hit for 5 HP damage. If the player was never that close to running out of MP or used a better MP restorer (like MMJ or blue pixel potions), they wouldn't need that line of protection.

I also don't know how "full-blown" you were looking for. This covers the combat itself, which is what you can't do in ASH at the moment. As far as managing moxie boosts and the MCD to precisely set the "unsafeness" of a location, I've got a solid working model of that for plinking that I can PM you if you haven't seen it in a while. (I think it's a little too spoilery for public distribution at this point, as a single script now does all of my non-quest adventuring for me.)

Code:
location eight = $location[ 8-bit realm ];
string [ location, monster ] Mpotential_enemy;
Mpotential_enemy [ eight, $monster[ blooper ]] = "blooper.jpg";
Mpotential_enemy [ eight, $monster[ bullet bill ]] = "bullet.jpg";
Mpotential_enemy [ eight, $monster[ buzzy beetle ]] = "buzzy.jpg";
# ... you get the idea

monster get_enemy( location zone, string html )
{
  foreach eek in Mpotential_enemy[ zone ]
    if contains_text( html, Mpotential_enemy[ zone, eek ])
      return eek;
  return $monster[ none ];
}

void one_stasis_adventure( location zone )
{
  int TOOTH_DAMAGE = 2;
  int DESIRED_END_ROUND = 28;
  float HEALTH_THRESHOLD = 0.4;

  skill HEAL = $skill[ saucy salve ];
  skill DELAY = $skill[ shake hands ];
  item ATTACK = $item[ seal tooth ];
  item MP_RESTORE = $item[ knob goblin seltzer ];

  int combat_round = 0;
  boolean ignore_next_saucesphere = false;

  string combat_result = visit_url( location_to_url( zone ));
  monster eek = get_enemy( zone, combat_result );

  if (eek == $monster[ none ])
  {
    print( "Non-combat adventure" );
    return;
  }
	
  int enemy_hp = monster_base_hp( eek ) + my_ml();

  # This is something that would appear on a battle screen but not on an
  # end-of-battle screen.
  while ( contains_text( combat_result, "Run Away" ))
  {
    refresh_sidepane();
    if ( !ignore_next_saucesphere )
    {
      # if you gained mp, then you got a saucesphere hit
      for restore from 1 to 5
        if ( contains_text( combat_result, "gain "+int_to_string(restore)+" "+my_mp_string()))
          enemy_hp = enemy_hp - restore;
    }
    ignore_next_saucesphere = false;
    combat_round = combat_round + 1;

    # my first concern is staying alive, so heal if necessary and restore
    # mp first if I don't have enough to heal
    if ( my_hp() < my_max_hp() * HEALTH_THRESHOLD ) 
    {
      if ( my_mp() < mp_cost(heal) - my_skill_discount()) 
      {
        combat_result = battle_with_item( MP_RESTORE );
        ignore_next_saucesphere = true;
        continue;
      }
      combat_result = battle_with_skill( HEAL );
      continue;
    }

	if ( enemy_hp > ( DESIRED_END_ROUND - combat_round ) * TOOTH_DAMAGE )
	{
      combat_result = battle_with_item( ATTACK );
      for damage from 1 to 4
        if ( contains_text( combat_result, "takes "+int_to_string(damage)+" HP damage" ))
          enemy_hp = enemy_hp - damage;
      continue;
	}

    combat_result = battle_with_skill( DELAY );
  }

  # the battle is over. I don't figure I care if I won, lost, or timed out.
  return;

}

Remember to be kind, as this took me more than ten minutes to write. :)
 

holatuwol

Developer
Stasis & Combat Control & access to HTML output

Tirian said:
I also don't know how "full-blown" you were looking for.  This covers the combat itself, which is what you can't do in ASH at the moment.

Just the combat itself; there's not much equipment to setup for the 8-bit realm (I think).  My curiosity is the mathematics behind what happened at the cyrpt in this video, but I'm told the 8-bit realm is easier for demonstrating the mathematics behind stasis (probably due to the lack of elemental resistance factors), which is why I chose it for the example.

What you've done so far shows how people come up with the healing decision (a health threshold) and the "should I start spamming my instant death skill" decision (a round threshold).  The only thing you're missing that I'd like to see is how entangling noodles and other deleveling skills fit into the picture, which might very well be the heart of your plinking strategy.  Do you think you could PM me on the plinking strategy?  In combination, that might probably cover all my stasis curiosities.
 

picklish

Member
Stasis & Combat Control & access to HTML output

[quote author=Tirian link=topic=250.msg1887#msg1887 date=1155517601]If you truly let us use visit_url() to handle our own combat, then these would be staples of mine alongside battle_with_weapon, battle_with_two_items, and battle_escape. You could either incorporate that into ASH or not -- you might as well as it saves us from the potential of misformatting our raw URLs and making the servers cry.[/quote]
Whoa. I'm nowhere near being able to stasis, so it's interesting to see how one might implement it.

Raw URLs make script writers cry, not the servers. On that note, I don't know where you developer folks are going with this, but I'm going to throw in my two meat pastes here and say that instead of raw URL access for fights, I would vastly prefer an interface for it. If I had to make one up off the top of my head, I'd say:
Code:
boolean battle_with_weapon()
boolean battle_with_skill(skill foo)
boolean battle_with_item(item foo)
boolean battle_with_two_items(item foo, item bar)
boolean battle_escape()
boolean in_battle()
boolean won_last_battle()
monster current_monster()

...with some other interface to parse results, like:
Code:
int lastround_hpchange()
int lastround_mpchange()
int lastround_damage_to_monster()
boolean lastround_weapon_succeeded()
boolean lastround_skill_succeeded()
boolean lastround_item_succeeded()
boolean lastround_item2_succeeded()
 

holatuwol

Developer
Stasis & Combat Control & access to HTML output

Picklish said:
n that note, I don't know where you developer folks are going with this

I'm only intending to go as far as visit_url and contains_text.  Fully customized combat and scriptable stasis happen to be among the things which become feasible once script-writers are given those two functions.  At this time, I have no intention of making the fight system "user friendlier" to ASH script-writers than it already will be with the introduction of those two functions.

As for why I'm adding the other two functions, location_to_url is nothing more than a mapping that anyone can write, and refresh_sidepane is functionally equivalent having your mini-browser open when you run scripts, as KoLmafia will refresh your sidepane regardless of the request synchronization setting in that case.  So, making these two things explicit makes sense.  As for your suggestions:

boolean battle_with_weapon()
boolean battle_with_skill(skill foo)
boolean battle_with_item(item foo)
boolean battle_with_two_items(item foo, item bar)
boolean battle_escape()


I'm not sure what a boolean value should mean in this case.  Did the battle finish, or was the action successful?  Or should you get the string that came out of it instead?  These functions are all rather vague.

boolean in_battle()
boolean won_last_battle()
monster current_monster()


KoLmafia does not currently track any of this information.  It has knowledge of it when you're fighting as a result of a redirect that it, internally, is taking care of, but other than that, it's rather clueless.

int lastround_hpchange()
int lastround_mpchange()


This information KoLmafia could theoretically start tracking, as it does have knowledge of this information between requests (it uses it to figure out if you got beaten up).  However, I don't see any motivation behind the naming you've chosen.  So, rejected.

int lastround_damage_to_monster()
boolean lastround_weapon_succeeded()
boolean lastround_skill_succeeded()
boolean lastround_item_succeeded()
boolean lastround_item2_succeeded()


KoLmafia does not track any of this information.
 

peterbones

New member
Stasis & Combat Control & access to HTML output

Veracity - Thanks much. I can't think of anything else that can't be calculated using maps and whatnot right now.

holatuwol - I know I kindof suggested the visit_url and contains_text functions, but you do realize that this gives us the power to write a super-great ascension bot, right? I think it's fine, because of a few things, namely:

1: It's already possible, you're just making it slightly easier.
2: No one should be able to program an ascension bot that's as good as a skilled player. If they can, then KoL's a solved problem and needs to be changed.
3: I believe if it can be automated, it's not worth doing. I don't necessarily want other people to be able to ascend without having any skill at all. But if I can write a script to ascend the way I want, why should I spend the time to just click the buttons over and over rather than script it?

But I hope you feel the same way. Anyway, just pointing out the inevitable ethical issues.
 

holatuwol

Developer
Stasis & Combat Control & access to HTML output

macman104 said:
Holatuwol, did my safeadv(location) function, on the last page get rejected? or missed? or is it still stewing?

Still pondering. I don't like the name safeadv(), but the best name I can come up with is perfect_dodge(), which is a name which makes sense, but doesn't read well in any of the code examples. One which reads better is moxie_survival(), but it doesn't make much sense as a name. I'll come up with something (or wind up choosing one of the two).


peterbones said:
holatuwol - I know I kind of suggested the visit_url and contains_text functions, but you do realize that this gives us the power to write a super-great ascension bot, right?

I've known it for the last 10 months, back when people requested that the URL string-contains functionality for the CLI. People usually request it once or twice a month (either for the ASH or the CLI), so you're far from being "the" person who suggested it. And while there is an auto-ascension issue associated with a visit_url feature, the aspect of it I dislike most is the fact that it lets people freely automate new content.

However, stasis has been lingering on my mind, and I'm still not sure how the damage balancing act works. So, if someone clarifies that aspect for me (so far, I've seen how people balance current health, round count, and pre-battle prepration), I'm willing to bend on the auto-ascension bot issue and on the new content automation issue.

On that note, I've received the email that Tirian sent me and it illustrates the pre-battle preparation aspects that I know are associated with stasis. So, thanks to the email, I do have a more complete picture of what's going on and I understand the disco aerobics in the video linked earlier. So, eventhough the script is still missing the level-manipulation aspect of stasis balanced against the damage reduction aspect of stasis, I'll let people who actually use stasis handle that part.

string location_to_url( location ): Added
string visit_url( string ): Added
boolean contains_text( string, string ): Added
void refresh_status(): Added
 

picklish

Member
Stasis & Combat Control & access to HTML output

[quote author=holatuwol link=topic=250.msg1894#msg1894 date=1155531072]
I'm only intending to go as far as visit_url and contains_text. Fully customized combat and scriptable stasis happen to be among the things which become feasible once script-writers are given those two functions. At this time, I have no intention of making the fight system "user friendlier" to ASH script-writers than it already will be with the introduction of those two functions.[/quote]
By that argument, why did you write any ASH functions at all? Why did we need anything more than visit_url/contains_text and the few Miscellaneous (by the ASH reference grouping) commands? It's not just more user friendly; it's abstracted. There's a difference.

Raw URLs in ASH scripts are like raw SQL in Javascript. It'd be a maintenance nightmare. Besides that, wouldn't visit_url/contains_text enable mall botting, chatbots, and other things you've tried to avoid?

[quote author=holatuwol link=topic=250.msg1894#msg1894 date=1155531072]As for your suggestions:[/quote]
Uff da...you truly must enjoy rejecting things. Like you say, I was proposing suggestions, not a finalized API for approval. That being said:

[quote author=holatuwol link=topic=250.msg1894#msg1894 date=1155531072]
boolean battle_with_weapon()
boolean battle_with_skill(skill foo)
boolean battle_with_item(item foo)
boolean battle_with_two_items(item foo, item bar)
boolean battle_escape()


I'm not sure what a boolean value should mean in this case. Did the battle finish, or was the action successful? Or should you get the string that came out of it instead? These functions are all rather vague.[/quote]Hitting the buttons in battle sometimes fails. Sometimes you're not in a battle. Sometimes you don't have an item. Sometimes you don't have a skill. Sometimes you don't have MP for a skill. Sometimes you only have one of an item and you use it twice. There are lots of reasons doing any of those could fail.

[quote author=holatuwol link=topic=250.msg1894#msg1894 date=1155531072]
boolean in_battle()
boolean won_last_battle()
monster current_monster()
int lastround_damage_to_monster()
boolean lastround_weapon_succeeded()
boolean lastround_skill_succeeded()
boolean lastround_item_succeeded()
boolean lastround_item2_succeeded()

KoLmafia does not currently track any of this information. It has knowledge of it when you're fighting as a result of a redirect that it, internally, is taking care of, but other than that, it's rather clueless.[/quote]
It's a question of doesn't and not of can't, correct?

[quote author=holatuwol link=topic=250.msg1894#msg1894 date=1155531072]
int lastround_hpchange()
int lastround_mpchange()


This information KoLmafia could theoretically start tracking, as it does have knowledge of this information between requests (it uses it to figure out if you got beaten up). However, I don't see any motivation behind the naming you've chosen. So, rejected.[/quote]
lastround_hpchange() seems pretty clear to me about finding out the hp change in the last round of combat. I have a habit of grouping with a common prefix so that related commands sort together lexicographically. If ASH allowed for pass-by-reference, I would have just had a single function that returned all that info.
 

Tirian

Member
Stasis & Combat Control & access to HTML output

[quote author=picklish link=topic=250.msg1906#msg1906 date=1155551688]
Uff da...you truly must enjoy rejecting things.[/quote]

In Holatuwol's defense, this thread is dedicated to exposing data that KoLmafia is already calculating, not about creating new functionality. If these things are approved, their implementation is lightning-fast because it's just adding a handler in the ASH code to a data structure that is already in the source code. Lots of good ideas have been rejected here because the underpinnngs aren't quite the way we expected them to be.

What I suspect will happen here will be more gradual, that we'll play with the visit_url() functions for a month or two and then someone will write a good library of wrapper functions and that interface will be promoted to the language itself. But we've barely begun to imagine how to script combat in ASH, and it probably makes some sense to not lock down the interface yet.

[quote author=macman104 link=topic=250.msg1902#msg1902 date=1155544383]
But it's certainly not by any means a name where you immediately know its function (which, despite some of the longer command names, is something I really like, all ASH commands are intuitive, no guessing what that function does).[/quote]

You can still get stung. I just added a few sentences to familiar_equipment's description in the manual, because a user's intuition concluded that familiar_equipment( $familiar[ leprechaun ] ) would return the item that your Leprechaun was wearing, where it is actually a hardcoded map that returns a generic familiar-specific gear for generic Leprechauns. It's an art rather than a science.
 

picklish

Member
Stasis & Combat Control & access to HTML output

[quote author=Tirian link=topic=250.msg1908#msg1908 date=1155558914]
In Holatuwol's defense, this thread is dedicated to exposing data that KoLmafia is already calculating, not about creating new functionality.[/quote]
Fair enough. I'm really just trying to voice some concerns, I guess. It does seem to me though that this whole thread has morphed into general feature request territory. The visit_url and stasis discussion aren't related to internal data either.

[quote author=Tirian link=topic=250.msg1908#msg1908 date=1155558914]
But we've barely begun to imagine how to script combat in ASH, and it probably makes some sense to not lock down the interface yet.[/quote]
I'm not convinced of that. There's a very finite set of information that the player can know about and a limited set of actions they can take. Giving them access to those in some form will enable a script to do anything a player can. Sure, there are better and worse ways of presenting this, but any interface will have to these particular things.
 

Veracity

Developer
Staff member
Re: Stasis & Combat Control & Access to HTML output

Topic split from "Access to Internal Data" thread.
 

holatuwol

Developer
Re: Stasis & Combat Control & access to HTML output

picklish said:
By that argument, why did you write any ASH functions at all?

I'm curious about stasis, but I only had a rudimentary understanding of how all the factors interacted.  As such, if the community was willing to answer my nagging curiosity, providing wrappers around existing internal function calls (subject to various limitations) in exchange for the information I wanted appeared to be a fair exchange.


picklish said:
Raw URLs in ASH scripts are like raw SQL in Javascript.  It'd be a maintenance nightmare.

There is nothing stopping anyone from writing their own wrapper functions.  What you've requested is that KoLmafia have wrappers built-in, rather than having to write your own.  There is a fundamental difference.  One, you customize it to suit your needs, and in the other, I customize it to balance everyone else's needs.


Besides that, wouldn't visit_url/contains_text enable mall botting, chatbots, and other things you've tried to avoid?

Mallbots are not possible with contains_text and visit_url alone; you need the actual indices where the matches occurred in order to determine which store had the price you wanted.  Brute-forcing a million stores and an infinite number of price combinations is too slow and too useless for a mallbot.

As for chatbots, just as using raw URLs in the command-line interface refuses to let you use message sending URLs, the raw URLs in the new ASH function refuse to let you use chat sending URLs as well as message sending URLs.  When the functions were added, I already added the restrictions on the ability to create a chatbot.  As I previously indicated, the main thing I'm against that visit_url provides is the ability to automate new content, but I was willing to exchange that for an understanding of game mechanics.


picklish said:
Uff da...you truly must enjoy rejecting things.  Like you say, I was proposing suggestions, not a finalized API for approval.

Realistically speaking, KoL is not so complicated that a "suggestion" and a "finalized API" would be fundamentally different. And in truth, rather than an itemized rejection list, the answer I had prepared was, "You failed to follow the guidelines so all of your suggestions were rejected".  However, I decided to spend more than a couple minutes dismissing everything, giving different reasons wherever applicable.  And in doing so, now I get guilt-tripped by being told "you truly must enjoy rejecting things".  You didn't do anything to help me understand why you wanted what you wanted.  Why should I implement anything?


picklish said:
boolean battle_with_weapon()
boolean battle_with_skill(skill foo)
boolean battle_with_item(item foo)
boolean battle_with_two_items(item foo, item bar)

Hitting the buttons in battle sometimes fails.  Sometimes you're not in a battle.  Sometimes you don't have an item.  Sometimes you don't have a skill.  Sometimes you don't have MP for a skill.  Sometimes you only have one of an item and you use it twice.  There are lots of reasons doing any of those could fail.

boolean lastround_weapon_succeeded()
boolean lastround_skill_succeeded()
boolean lastround_item_succeeded()
boolean lastround_item2_succeeded()

Okay, look at those eight functions and then ask yourself why you want the success value to be (a) returned and then (b) cached for later use.  Then, ask yourself, "Okay, if I can micro-manage success of item and skill usage, will I do anything different in my scripts?"  Those are the two questions that I asked, and I had no answer.  As such, your request was vague, and I told you as much.

When you make proposals for functions, I ask for real code examples showing you will actually use the provided information.  I don't follow a "It'd be nice to have..." route, as that'd be a waste of time.  I'd implement all this complex logic and then nobody would use it.  Show me that you care about the feature enough to do more than ask for it and more often than not, it gets implemented.


picklish said:
boolean in_battle()
boolean won_last_battle()
monster current_monster()
int lastround_damage_to_monster()
boolean lastround_weapon_succeeded()
boolean lastround_skill_succeeded()
boolean lastround_item_succeeded()
boolean lastround_item2_succeeded()

It's a question of doesn't and not of can't, correct?

Correct.  What thread were you in?  Access to internal data.


picklish said:
lastround_hpchange() seems pretty clear to me about finding out the hp change in the last round of combat.  I have a habit of grouping with a common prefix so that related commands sort together lexicographically.  If ASH allowed for pass-by-reference, I would have just had a single function that returned all that info.

Internal functions allow pass by reference; you've seen that with the file_to_map functions.  When I say "I don't see the motivation behind the naming you've chosen," it doesn't mean "The use isn't obvious to me." What it means is, "My guidelines indicate that you need to provide a defense of your name.  You have failed to do so."

I would also like a defense of the actual usefulness of the function if you're not naming an internal function, which you also failed to do.  A status refresh gives you the resulting value of the change; is there a reason that knowing the difference (rather than knowing the end result) makes a difference?  Is there a reason you don't want to use your own pre-declared variables for this purpose?
 

holatuwol

Developer
Re: Stasis & Combat Control & access to HTML output

On a related note, I do recognize that I come off as an asshat whenever I reject a suggestion, and especially when I hammer that rejection into the ground. I take no enjoyment in cackling and say, "NOOOOO REJECTED!" while pushing red buttons, and actually, I take satisfaction in saying, "Available in the next release." However, please recognize that scripting is my least favorite part of KoLmafia, and I treat it accordingly.

Therefore, your mission whenever making an ASH feature request, should you choose to accept it, is to make me understand that there are some really interesting innovations that are possible with it. Without that understanding, I'll likely not accept any "convenience" suggestions.
 

macman104

Member
Re: Stasis & Combat Control & access to HTML output

Ok, so I appealed to my clanmates at HCO/HCN for assisstance in this problem. One member has provided a fairly good step-by-step decision process of the decision making, and is as follows:
Chopper Dave said:
An aside: EVERYTHING depends on your expected damage per round. This directly determines your stasis efficiency. You want to maximize monster level (and therefore MP gained) while minimizing the damage to your character per round. A perfectly balanced strategy results in max ML with 1hp damage per round.

decision 1: Hero stasis or "classic" stasis. Of course you choose this automatically based on your shield and skills.

decision 2: Stats adjustment One of the most critical parts of stasis, and potentially hard to do in code. If you are classic stasis, you want moxie that is at least 6 or 7, preferably 10 below the no-hit moxie of the weakest monster in the area. Either adjust your gear or play with the MCD to get this right. If you are going Hero, try to get your muscle as high as you can and keep that moxie 15 below the weakest monster's no-hit value.

decision 3: Healing
Use the cheapest way possible to fill your HP to a safe level, which depends greatly on where you are adventuring.

decision 4: Buffs! Everyone is at a different point in skills, so I think this code would probably consist of a list of buffs you want maintained. You need to git rid of all the MP you gained from the last round, leaving enough to cast your first couple of noodles and a few extra for salve. I usually leave 5-6 MP remaining, depending on monster HP. You stats also decide which skills are played, since some of them are needed to tweak your stats, i.e. Madrigal, Powerballad, Rage. Another decision is whether or not to run Jabanero. This decreases the efficiency of your MP gained, but is necessary if you can't get your damage per round under 4.

Combat!
The first couple of rounds of combat are very important. You will need to first delevel the monster (if needed) so that it is still hitting you, but for the least amount of damage possible. As stated before, this is 7-10 above your moxie for classic style, and about equal or below for Hero style. As you get into harder areas, you will get to a point where damage does not go down even when you delevel more.

From here, it goes exactly the same as d00m's combat script. Attack with the no-hit method of your choice and heal yourself in combat if your hp gets too low. A special case is that of the SS solitaire, in which case salve is by far the most efficient healing method and should be used to fill your hp before the battle is over. Another special case is the Jellyfish in Menagerie level 3, which can change your battle deleveling strategy if you get poisined.

That's about all I know for now. I have not really touched upon the importance of stasis gear, but I think that part would be a little difficult to code for, given the insane number of permutations. The parts that would be most helpful for me if they were scripted are:

combat: deleveling to a level specified by the user; healing; auto-attack till round=28, then thrust-smack

out of combat: restore health, maintain/build buffs
I'm going to be expanding on that with that, and trying to further develop the micro-management for stasis, I'll keep in touch, but hopefully for now it satiates your appetite, and maybe Tirian will find a way to reflect these thoughts.
 

peterbones

New member
Re: Stasis & Combat Control & access to HTML output

[quote author=holatuwol link=topic=350.msg1899#msg1899 date=1155542641]

I've known it for the last 10 months, back when people requested that the URL string-contains functionality for the CLI.  People usually request it once or twice a month (either for the ASH or the CLI), so you're far from being "the" person who suggested it.  And while there is an auto-ascension issue associated with a visit_url feature, the aspect of it I dislike most is the fact that it lets people freely automate new content.

[/quote]

I didn't mean to imply that I was "the" person who suggested it. Not to be a jackass, but if you read my post I just pointed out that I realized it might seem odd to point out the drawbacks after promoting the idea. Still, my apologies, and I withdraw any claim I may have unintentionally made to having invented a somewhat obivous function. Ok, that was being a jackass.

The automating new content thing I understand much better as an argument against. I remember being so pissed when people starting writing scripts to automate curing people of the plague. Before they became widespread, I could go to the hall of brains, copy a name, click on the blowgun and paste the name in, worked 9 out of 10 times. Afterwards, I was lucky if one in 50 got through.
 

Veracity

Developer
Staff member
Re: Stasis & Combat Control & access to HTML output

[quote author=peterbones link=topic=350.msg1920#msg1920 date=1155587440]
The automating new content thing I understand much better as an argument against.  I remember being so pissed when people starting writing scripts to automate curing people of the plague.  Before they became widespread, I could go to the hall of brains, copy a name, click on the blowgun and paste the name in, worked 9 out of 10 times.  Afterwards, I was lucky if one in 50 got through.
[/quote]
I remember that too.

The whole plague was over days earlier than it would have been because certain well known asshats who have some level of scripting skill decided to automate the process. They hammered the servers hard and probably deprived thousands of people from the chance to get an empty serum blowpipe via their own efforts. And when the forum community complained bitterly about it, said asshats were completely unapologetic. "Unless Jick tells me to stop, I'm going to keep doing this because it demonstrates what a studly programmer I am. Nyah, nyah!"

It certainly opened my eyes to why SOME uses of 'bots qualify as abuse of the community; that was certainly a canonical example. And it proved beyond doubt that certain people are social retards...
 

picklish

Member
Re: Stasis & Combat Control & access to HTML output

[quote author=holatuwol link=topic=350.msg1915#msg1915 date=1155582751]
There is nothing stopping anyone from writing their own wrapper functions. What you've requested is that KoLmafia have wrappers built-in, rather than having to write your own. There is a fundamental difference. One, you customize it to suit your needs, and in the other, I customize it to balance everyone else's needs.[/quote]
My original statement of "why did you write any ASH functions" and most of my worry comes down to this. If KoLmafia has wrappers built in, then everybody can use the same API, can share scripts, and can know that the API will continue to work in the future (or, will only have to be fixed in one place.) If they write wrappers, then everybody has their own (possibly broken) wrappers and everybody has to fix their scripts if anything ever changes. It's all about abstraction. I just fundamentally don't like the idea of raw URLs in a script. Maybe nobody else is bothered by this concept and I should just shut up. :p

I hope you don't think it's a question of laziness or of not wanting to write it myself. I'll probably write my own KoLmafia functions to do this on my local branch if you're not going to, but that doesn't help anybody else. Like most folks, I prefer features to be rolled back into the main line. :)

[quote author=holatuwol link=topic=350.msg1915#msg1915 date=1155582751](snip chatbot workaround)[/quote]
That makes a lot of sense to do it that way and is a good idea of getting around that issue.

[quote author=holatuwol link=topic=350.msg1915#msg1915 date=1155582751]
However, I decided to spend more than a couple minutes dismissing everything, giving different reasons wherever applicable. And in doing so, now I get guilt-tripped by being told "you truly must enjoy rejecting things".[/quote]
I'm honestly really sorry if you felt guilt tripped by what I said. I was more miffed by the presentation and delivery than by the content. I have no problem with "I don't like this because of reason X." It's the bold, red, "so, rejected" bit with terse responses that comes off a mite strong.

[quote author=holatuwol link=topic=350.msg1915#msg1915 date=1155582751]You didn't do anything to help me understand why you wanted what you wanted. Why should I implement anything?[/quote]
Maybe I just assumed too much, but I thought it would be extremely clear from context why those would be useful, especially following the stasis script, which used most of those functions.

[quote author=holatuwol link=topic=350.msg1915#msg1915 date=1155582751]Okay, look at those eight functions and then ask yourself why you want the success value to be (a) returned and then (b) cached for later use.[/quote]
(b) isn't really an issue for me. It's really (a) that's important.

I figured in the boolean return value could be used more for an immediately handled try/catch idiom in the cases that it can action could fail. For example, you could try to use an item, but say you really didn't have it (because of a bug in your script or somesuch). Instead of continuing to attack with the bogus item, you could catch that case and attack with your weapon instead. Maybe your script miscalculated the MP usage for a particular skill and thinks you can use it. Maybe your script thinks you have a skill that you don't (or that you can use a skill in combat that you can't.) Those are just a few failure cases off the top of my head. I just tend towards the "if it can fail, you need a method of informing somebody about that failure" attitude. I hope that explains it a little more clearly. :)

I would have no problem with a round counting function or a last_action_failed() function instead. I'm really just concerned with knowing if those actions failed.

[quote author=holatuwol link=topic=350.msg1915#msg1915 date=1155582751]Then, ask yourself, "Okay, if I can micro-manage success of item and skill usage, will I do anything different in my scripts?"[/quote]
Yes. If I'm fighting a monster that blocks skills and I use a delevelling skill or item, it's pretty critical that I find out if it worked or not so I know if it's weak enough to start attacking. Granted, there are only two cases where that's an issue, but it can be important.

[quote author=holatuwol link=topic=350.msg1915#msg1915 date=1155582751]Correct. What thread were you in? Access to internal data.[/quote]
...which is why you were having a discussion about stasis and functions that visit arbitrary urls. ;)

[quote author=holatuwol link=topic=350.msg1915#msg1915 date=1155582751]Internal functions allow pass by reference; you've seen that with the file_to_map functions.[/quote]
Ah, true enough. My mind was still in script land and not in internal-function land.

And as for the lastround_mpchange() and lastround_hpchange(), you make a great point. From the point of view of writing a script, you only really care about the absolutes which you can get from the status update. And, if somebody really wanted relative values, they could calculate that themselves from round to round.

Finally, I'm sorry the scripting isn't interesting to you. It's probably pretty obvious that I'm a diamond sort of player with a thing for scripting and optimization (and pickles!)
 

holatuwol

Developer
Re: Stasis & Combat Control & access to HTML output

picklish said:
...which is why you were having a discussion about stasis and functions that visit arbitrary urls. ;)
Pff, people wanted access to an internal function and I presented my conditions. I say that falls under internal data. But I'm a little biased. Just a little. ;)
 

peterbones

New member
Re: Stasis & Combat Control & access to HTML output

visit_url wasn't giving me the same result as when I'd implemented a similar function on my own, so I got confused and went to the source...

Code:
			String location = string.toStringValue().toString();
			String url = location.indexOf( "?" ) != -1 ? location.substring( 0, location.indexOf( "?" ) ) : location;
			if ( url.indexOf( "send" ) != -1 || url.indexOf( "chat" ) != -1 || url.indexOf( "search" ) != -1 )
				return STRING_INIT;

			KoLRequest request = new KoLRequest( client, url, true );
			request.run();

Unless my eyes decieve, the post "?" parameters are stripped before the url is visited. Is this a nerf?  Because that would make me very sad.
 

holatuwol

Developer
Re: Stasis & Combat Control & access to HTML output

I made a typo, actually. I was thinking about allowing the word "search" after the question mark, so I truncated it for the check, and accidentally used the truncated version. However,t now that you mention it, there's no good reason any standard URL will have the word "search" after the question mark. Fixed.
 
Top