Feature Req: automatical check the "no skills" box in valhalla if there are no skills that could be permed.

ereinion

Member
Does anyone know if there's a script out there who automatically checks the box for whether you want to ascend with no skills marked permanent? Or roughly what snippet would need to be included in an existing relay script?

[Edit: Moved from Community Support to Feature Request -- MCroft]
 
Last edited by a moderator:

MCroft

Developer
Staff member
Does anyone know if there's a script out there who automatically checks the box for whether you want to ascend with no skills marked permanent? Or roughly what snippet would need to be included in an existing relay script?
It would be really nice if it didn't pop up at all, or if you could have a script (or mafia function) to check it if there were no skills available to perm, because you'd permed them all.
 

ereinion

Member
It would be really nice if it didn't pop up at all, or if you could have a script (or mafia function) to check it if there were no skills available to perm, because you'd permed them all.
My thoughts exactly. I might have a look at it myself if there's no such functionality existing, but I figured it was a common enough problem that it was worth asking if it already existed.

Also I think I may have clicked report instead of reply first - sorry about that =p
 

MCroft

Developer
Staff member
Only people wo are trying to script an Ascension would encounter it so it might not be that common :)
Not really (on the first part), still might not be that common).

As a user with all acquired skills hardcore permanent, I get a checkbox that I must approve because I haven't made any skill permanent, even though I literally can't do what it asks. While KoL shouldn't show this warning if it is not possible to perm anything, it does.

What I'm hoping to see is along the lines of if (PermableSkillCount == 0) {PermSkillWarningCheckbox == checked}

I don't know if that solves @ereinion's issue, but it would save me a click/wait/select/click again cycle.

We could also add an autoOverride property if we felt we should have one.
 

ereinion

Member
Not really (on the first part), still might not be that common).

As a user with all acquired skills hardcore permanent, I get a checkbox that I must approve because I haven't made any skill permanent, even though I literally can't do what it asks. While KoL shouldn't show this warning if it is not possible to perm anything, it does.

What I'm hoping to see is along the lines of if (PermableSkillCount == 0) {PermSkillWarningCheckbox == checked}

I don't know if that solves @ereinion's issue, but it would save me a click/wait/select/click again cycle.

We could also add an autoOverride property if we felt we should have one.
Yeah, this would solve my problem - it's only one extra click in Valhalla, but it is getting a bit tedious. Maybe I should just have posted this as a feature request in the first place :)
 

MCroft

Developer
Staff member
It looks like it's just a new function in afterlife.ash, and basically similar to the two that are already there. I'm probably going to ascend this weekend, so I'll see if I can capture the page that needs to be modified and modify it. It should be a relatively isolated change.

Thanks for bringing it up!
 

fronobulax

Developer
Staff member
Not really (on the first part), still might not be that common).

Perhaps I am misunderstanding something?

I thought the prompt only occurred when trying to exit Valhalla. So responding to it is part of leaving Valhalla. Is there another or different prompt or is my casual definition of "scripting an Ascension" as meaning anything that happens in Valhalla including the action that enters and leaves Valhalla not a correct or widely shared definition?
 

MCroft

Developer
Staff member
Perhaps I am misunderstanding something?

I thought the prompt only occurred when trying to exit Valhalla. So responding to it is part of leaving Valhalla. Is there another or different prompt or is my casual definition of "scripting an Ascension" as meaning anything that happens in Valhalla including the action that enters and leaves Valhalla not a correct or widely shared definition?
It's shifted since the original post, which was looking for a relay script to get around it. We discussed the matter and I wanted to make it a feature of KoLmafia, not requiring a script.

It's not for automating an ascension, it's for changing a GUI feature that adds unnecessary friction.

When I am trying to ascend in the relay browser, I have no available skills to perm. Despite this sad and/or lucky condition, this checkbox and warning show up even though the condition that cannot be met. It's a technically true but practically useless warning from KoL.

My goal is to check it and suppress the warning if there are no permeable skills.

Basically, replace this:
JavaScript:
<p style="color:red">Are you sure you want to reincarnate without marking any skills permanent?
<br />
<label>
<input type="checkbox" class="req" value="1" name="noskillsok" /> yes
</label>
</p>
with something like this:
JavaScript:
<p style="color:orange">You are reincarnating without any skills made permanent, because you have no skills to make permanent.  Try learning more skills.  Knowledge is power.</p>

By removing the "req" class, it keeps the page from stopping you.

Does that make sense?
 

Crowther

Active member
The problem for me isn't the time spent checking a box for an unneeded warning. The problem is KoL warning me erroneously causes me to click it by reflex and in the rare case I have a skill to perm I might mess up. I'd love a fix for this and I've given up on expecting KoL to fix an obvious bug.
 

MCroft

Developer
Staff member
So the fix I have in draft is basically overkill for @Crowther 's case, because it currently always turns that off. I wasn't planning on submitting it until I'd tested it, so I'll see if I can make it more specific to can't instead of just don't make me click the box.
 

fronobulax

Developer
Staff member
You have not permed any skills says nothing about whether there skills available to perm. That depends upon both available skills that are unperm'd and available karma. I think the proposed solution may be heading in that direction.
 

MCroft

Developer
Staff member
yes, I'm discussing WIP, not proposed new feature. I just need to get into a position to test it, which may be a couple of days. I do not plan to just disable the box, but only to disable the requirement if you can't fulfill the mandate.
 

ereinion

Member
What I was thinking of if I was going to write a relay script for this, was to check if there were any skills to be found in the permery, and if not disable the box. I think that'll require an extra server hit though, which goes against the design philosophy of mafia?
 

MCroft

Developer
Staff member
Here's what I've got in draft for afterlife.ash. It might make a decent relay script right now (if you include the rest of afterlife.ash).

If I write it better, it would cache this value so it didn't need to hit the permery more than one extra time.

Mafia's design philosophy is hard to pin down, but making unneeded calls to KoL is frowned upon.



JavaScript:
void modify_decision( buffer page )
{
  // get permery
  buffer permery = visit_url("afterlife.php?place=permery");
  if ( permery.conatains_text( "It looks like you've already got all of the skills from your last life marked permanent.  There's nothing we can do for you here!" ) ) {
    string no_perm_warning = "<p style="color:red">Are you sure you want to reincarnate without marking any skills permanent?<br /><label><input type="checkbox" class="req" value="1" name="noskillsok" /> yes</label></p>";
    string no_perm_ok = "<p style="color:orange">You are reincarnating without any skills made permanent, because you have no skills to make permanent.  Try learning more skills.  Knowledge is power.</p>";
    string_replace(page, no_perm_warning, no_perm_ok);
  }
}

void main()
{
    buffer page = visit_url();
    if ( page.contains_text( "The Astral Pet Salesman" ) ) {
        modify_pet_store( page );
    } else if ( page.contains_text( "The Deli Lama Counterman" ) ) {
        modify_deli( page );
    } else if ( page.contains_text("Are you sure you want to reincarnate without marking any skills permanent?" ) ) {
        modify_decision( page );
    }
    write( page );
}
 

heeheehee

Developer
Staff member
One thing that stands out to me (and is especially visible in the syntax-highlighted code block above) is the quote nesting.
 

MCroft

Developer
Staff member
good catch. I haven't run this and can't until I ascend, but it would've failed, so I'll fix it. This is why I will test it before I commit..
 

ereinion

Member
I tested it out when ascending today, and it worked great with a few minor adjustments. The orange text was a bit tricky to read, but I'm just going to ignore it anyway, so... ^_^ Thanks a lot for the help.

- edit - Strike that. The "once more into the breach..." button no longer seems to lead into your next life with the code below running.

JavaScript:
void modify_decision( buffer page )
{
  // get permery
  buffer permery = visit_url("afterlife.php?place=permery");
  if ( permery.contains_text( "It looks like you've already got all of the skills from your last life marked permanent.  There's nothing we can do for you here!" ) ) {
    string no_perm_warning = "<p style=\"color:red\">Are you sure you want to reincarnate without marking any skills permanent?<br /><label><input type=\"checkbox\" class=\"req\" value=\"1\" name=\"noskillsok\" /> yes</label></p>";
    string no_perm_ok = "<p style=\"color:orange\">You are reincarnating without any skills made permanent, because you have no skills to make permanent.  Try learning more skills.  Knowledge is power.</p>";
    replace_string(page, no_perm_warning, no_perm_ok);
  }
}

void main()
{
    buffer page = visit_url();
    if ( page.contains_text( "The Astral Pet Salesman" ) ) {
        modify_pet_store( page );
    } else if ( page.contains_text( "The Deli Lama Counterman" ) ) {
        modify_deli( page );
    } else if ( page.contains_text("Are you sure you want to reincarnate without marking any skills permanent?" ) ) {
        modify_decision( page );
    }
    write( page );
}
 

MCroft

Developer
Staff member
Hmm. Did for me. Wasn't fast, but this code didn't change anything related to that. Are you still in a position to test it?
 
Top