WTF Relay script collection

Bale

Minion
* Add a is_unrestricted() check

Why is that helpful? Right now SkillsWTF checks for have_skill() and if a skill is restricted mafia tells you false for have_skill(). For instance, if I wasn't currently in t69 I could summon Clip Art, but...

Code:
[COLOR="#80800"]> ash is_unrestricted($skill[Summon Clip Art])[/COLOR]

Returned: false

[COLOR="#80800"]> ash have_skill($skill[Summon Clip Art])[/COLOR]

Returned: false
 

xKiv

Active member
This would be possible... I think.

Everything is possible, as long as you don't mind uglydirty code and are willing to provide the potentially unlimited time and memory required.



Why is that helpful? Right now SkillsWTF checks for have_skill() and if a skill is restricted mafia tells you false for have_skill(). For instance, if I wasn't currently in t69 I could summon Clip Art, but...

Code:
[COLOR="#80800"]> ash is_unrestricted($skill[Summon Clip Art])[/COLOR]

Returned: false

[COLOR="#80800"]> ash have_skill($skill[Summon Clip Art])[/COLOR]

Returned: false

Are you sure this also works for all non-bookshelf skills? I know I had to add a is_unrestricted check somewhere yesterday, for skills like jingle bells, curiosity, etc ...
 

ckb

Minion
Staff member
Why is that helpful? Right now SkillsWTF checks for have_skill() and if a skill is restricted mafia tells you false for have_skill().

Weird. I think you are right on this. But it was not working yesterday for me. Probably because I had just ascended and my skills were not re-set and re-calculated. It is working for me today when I have a fresh login.
Hopefully, "14501: Refresh skills when breaking ronin in a restricted path" will solve this.
 

Bale

Minion
Are you sure this also works for all non-bookshelf skills? I know I had to add a is_unrestricted check somewhere yesterday, for skills like jingle bells, curiosity, etc ...

Yes. I am in Heavy Rains right now and have previously hardcore permed everything that is hardcore permable:

Code:
[COLOR="#80800"]> ash $skill[Jingle Bells].have_skill()[/COLOR]

Returned: false
 
Last edited:

Darzil

Developer
I think we currently have an issue which is causing us not to remove skills on ascension. Restarting mafia sorts it.
Code:
> ash have_skill( $skill[summon crimbo candy] )

Returned:     true
I also have permed everything that is hardcore permable, but see all non-bookcase skills after ascending.
 

Bale

Minion
I made the Heavy Rains skills appear at the top through a very simple, albeit kludgy, method:

Code:
Index: skills.ash
===================================================================
--- skills.ash	(revision 17)
+++ skills.ash	(working copy)
@@ -170,12 +170,9 @@
 	report += "\n";
 	report += "\n";
 	
-	
-	//skip these skills (because they are weird)
-	//62	Managerial Manipulation
-	//107	Summon Annoyance
-	//111	Psychokinetic Hug
-	foreach skl in $skills[] {
+	void add_skill(skill skl) {
+		if(report.contains_text(skl))
+			return; // Don't list skills twice!
 		iis = to_int(skl);
 		if (  have_skill(skl) &&
 				my_mp() >= mp_cost(skl) &&
@@ -361,6 +358,16 @@
 
 		}
 	}
+	
+	if(my_path() == "Heavy Rains")
+		for x from 16000 to 16030
+			add_skill(to_skill(x));
+	//skip these skills (because they are weird)
+	//62	Managerial Manipulation
+	//107	Summon Annoyance
+	//111	Psychokinetic Hug
+	foreach skl in $skills[]
+		add_skill(skl);
 
 	//report += "</tbody>";
 	report += "\n";
 
Last edited:

ckb

Minion
Staff member
I made the Heavy Rains skills appear at the top through a very simple, albeit kludgy, method:

Bale - This is very similar to my first thoughts about re-ordering these, but I wanted a more flexible approach to allow for future paths with more skills like this. So I split the report string to allow rows to go to the top/middle/bottom depending on type. This is also a more ChIT-like setup :)

Now by default special path skills are always on top, normal class skills are in the middle, and non-class/non-path skills are on the bottom. You can always re-sort them with the column headings.

Also, Pasta Thralls now highlight yellow!


svn update
 
Last edited:

Bale

Minion
Bug Report / Feature Request thingy for skillsWTF:

When a skill leads to a choice adventure, skillsWTF prevents the choice adventure override from activating. Fortunately this is easy to fix, on a skill by skill basis. My problem is that to create a filter for Rain Man faxing I need to do it with a choice override. I took care of it on my local SVN, but I might not be the only one who has this problem so I thought I'd report it here.

All that is necessary is for main() to look like this:

Code:
void main()
{
	if(form_field("whichskill") == "16011") return; // Don't override "Rainy Fax Dreams on your Wedding Day"
	SkillWTF();
}
 

Bale

Minion
Oh, in case anyone is curious, this is a useful choice.ash to filter down your Rain Man list. It's got a few tiny issues (like the gremlins not being sorted with the others), but it works quite nicely.

Code:
buffer rainy_fax(buffer page) {
	page.replace_string(">Make: <", ">Make (full list):<");
	
	buffer filter;
	filter.append("<form action=choice.php method=post><input type=hidden name=pwd value=");
	filter.append(my_hash());
	filter.append("><input type=hidden name=whichchoice value=970>Make (useful monsters): <select name=whichmonster>");
	matcher select;
	foreach mon in $strings[7-Foot Dwarf Foreman, alley catfish, Baa'baa'bu'ran, Bailey's Beetle, Blooper, Bram the Stoker, dirty thieving brigand, 
	  gaudy pirate, ghost, giant swarm of ghuol whelps, Knob Goblin Elite Guard Captain, lobsterfrogman, mountain man, modern zmobie, ninja snowman assassin, 
	  Orcish Frat Boy Spy, piranhadon, Quantum Mechanic, remains of a jilted mistress, screambat, sleepy mariachi, writing desk] {
		select = create_matcher('<option value=\\d+>'+mon+'</option>', page);
		if(select.find())
			filter.append(select.group(0));
	}
	// Gremlins are trickier
	filter.append('<option value=549>batwinged gremlin</option>');
	filter.append('<option value=547>erudite gremlin</option>');
	filter.append('<option value=553>spider gremlin</option>');
	filter.append('<option value=551>vegetable gremlin</option>');
	
	filter.append("</select><input type=hidden name=option value=1><input type=submit class=button name=choice2 value='and Fight!'></form>");
	
	return page.insert(index_of(page, '</form><form ')+ 7, filter);
}

buffer annotate(buffer page) {
	if(page.contains_text('bgcolor=blue><b>Rainy Fax Dreams on your Wedding Day</b>'))
		return rainy_fax(page);
	return page;
}

void main() {
	switch(form_field("whichchoice")) {
	case "793":	// The Shore, Inc. > Gift Shop
	case "189":	// O Cap'm, My Cap'm > Set an Open Course for the Virgin Booty
		return;
	}
	visit_url().annotate().write();
}
 
Last edited:

lostcalpolydude

Developer
Staff member
Bug Report / Feature Request thingy for skillsWTF:

When a skill leads to a choice adventure, skillsWTF prevents the choice adventure override from activating. Fortunately this is easy to fix, on a skill by skill basis. My problem is that to create a filter for Rain Man faxing I need to do it with a choice override. I took care of it on my local SVN, but I might not be the only one who has this problem so I thought I'd report it here.

All that is necessary is for main() to look like this:

Code:
void main()
{
	if(form_field("whichskill") == "16011") return; // Don't override "Rainy Fax Dreams on your Wedding Day"
	SkillWTF();
}

My first thought is to write it like this, to make it easier to add more cases in the future. Maybe it's overkill though.
Code:
void main
{
	int whichskill = form_field("whichskill").to_int();
	switch ( whichskill )
	{
	case 16011:
		return;
	default:
		SkillWTF();
	}
}

Edit: And I see that's basically what you have in the script you posted.
 
Last edited:

lostcalpolydude

Developer
Staff member
I would suggest replacing giant swarm of ghuol whelps with swarm of ghuol whelps. They give the same beeps and stats, but have less HP.
 

ckb

Minion
Staff member
I like the idea of keeping this flexible, so I did this, so we can easily add more later:

Code:
void main()
{
	// Don't override skill 16011 "Rainy Fax Dreams on your Wedding Day"
	if ($strings[16011] contains form_field("whichskill")) {
		return;
	}
	
	SkillWTF();
}
 

Bale

Minion
Edit: And I see that's basically what you have in the script you posted.
Yeah, that's my basic way of doing things when there is more than one option. It just seemed like overkill for a simple suggestion to ckb.


I like the idea of keeping this flexible, so I did this, so we can easily add more later:

Code:
void main()
{
	// Don't override skill 16011 "Rainy Fax Dreams on your Wedding Day"
	if ($strings[16011] contains form_field("whichskill")) {
		return;
	}
	
	SkillWTF();
}
If you prefer to keep it flexible, I believe that the switch-case data structure which lost suggested actually is slightly faster as well as providing more flexibility. Although it seems unnecessary to convert the string to an integer.

Code:
void main()
{
	switch ( form_field("whichskill") ) {
	case "16011": // Don't override skill 16011 "Rainy Fax Dreams on your Wedding Day"
		return;
	default:
		SkillWTF();
	}
}


I would suggest replacing giant swarm of ghuol whelps with swarm of ghuol whelps. They give the same beeps and stats, but have less HP.
That's a wonderful idea! Can anyone else think of any they'd want to RainFax that I missed?
 
Last edited:

Bale

Minion
If anyone likes (and is using) the Rain Man choice adventure script I posted earlier in this thread, I have finished developing it and it is pretty sweet. You can now download the current version of that script from its own thread.

There's no more reason to clutter up ckb's thread with my script.
 

ckb

Minion
Staff member
ckb, I use the following shop.starchart.ash to keep me from accidentally making the wrong star item in hardcore. You are welcome to add it to "Shops WTF" if you desire. Since "Shops WTF" only relates to a single shop right now, it seems that you need at least one more in order to keep the plural or else reduce it to "Shop WTF". ;)

It took me a while, but I finally got around to this and overhauled Shops WTF to now handle ALL shops and all stores. Now anything that hits store.php or shop.php will be infused with WTF power!

It now adds current available quantity via available_amount() to the item as well pretty modifier descriptions. This includes coloring for quality for food/booze.
If the item is a quest item, it will be highlighted yellow. If the item is a quest item AND you have more than 1, it will remove the MAKE or BUY button.

I think this should make it maintain most of the functionality of the old damachine shop script while expanding this generally to all shops and stores. I tested a few (well, the ones I had easy access to), but there may be some issues for strange KoL html I did not account for.
(Us relay scripters have come to loath the html of loathing)

Also, 1st post updated with new description.

Enjoy.
 

Bale

Minion
Very nice! There's just one little problem... it is really hard to import that into other shop scripts. I have scripts for shop.starchart and shop.shore to which I would like to add processing for ShopWTF. Unfortunately ShopWTF() both calls visit_url() and does write() at the end so there is no way for me to add any processing to another shop override.

Could you change ShopWTF so that it has a function to which I can pass the page as a parameter and it will return the altered page?

Code:
buffer ShopWTF(buffer page) {
	// Do all the neat stuff that ShopWTF does here.
	
	return page;
}

void ShopWTF() {
	buffer page;
	page.append(visit_url());
	ShopWTF(page).write();
}

That way, I would like to be able to do this with my shop.shore (The bold red highlights are the only mods I would need to utilize showWTF):

Code:
[COLOR="#FF0000"][B]import <shopWTF.ash>;[/B][/COLOR]

buffer telescope(buffer page) {
	
	void dynamite() {
		if(available_amount($item[stick of dynamite]) < 1) page.replace_string("<b>dude ranch souvenir crate</b>",
			"<font color=\"green\"><b>dude ranch souvenir crate<br />(stick of dynamite needed)</b></font>");
	}

	void orchid() {
		if(available_amount($item[tropical orchid]) < 1 && available_amount($item[packet of orchid seeds]) < 1) page.replace_string("<b>tropical island souvenir crate</b>",
			"<font color=\"green\"><b>tropical island souvenir crate<br />(tropical orchid needed)</b></font>");
	}

	void fence() {
		if(available_amount($item[barbed-wire fence]) < 1) page.replace_string("<b>ski resort souvenir crate</b>",
			"<font color=\"green\"><b>ski resort souvenir crate<br />(barbed-wire fence needed)</b></font>");
	}
	
	if(!can_interact() && my_path() != "Bugbear Invasion") {
		if(my_path() == "Bees Hate You") {
			orchid();
		} else if(get_property("telescopeUpgrades") == "7" && !in_bad_moon()) {
			switch(get_property("telescope7")) {
			case "see a wooden beam":
				dynamite(); break;
			case "see a formidable stinger":
				orchid(); break;
			case "see a pair of horns":
				fence(); break;
			}
		} else {
			dynamite();
			orchid();
			fence();
		}
	}
	
	// If dinghy plans are needed, you will always need to buy them! Otherwise it is time to look into that UV-resistant compass 
	if(get_property("lastIslandUnlock").to_int() < my_ascensions() && page.contains_text("dinghy plans"))
		page.replace_string("<b>dinghy plans</b>", "<font color=\"green\"><b>dinghy plans</b></font>");
	else if(available_amount($item[UV-resistant compass]) + available_amount($item[ornate dowsing rod]) == 0)
		page.replace_string("UV-resistant compass", "<font color=\"green\"><b>UV-resistant compass</b></font>");
	
	return page;
}

void main() {
	visit_url().telescope().[COLOR="#FF0000"][B]ShopWTF().[/B][/COLOR]write();
}


If you aren't willing to do that, it will be easy enough for me to fork my local copy on SVN, but it seems like a helpful change for any other scripters who would want to modify various shops.
 

ckb

Minion
Staff member
Could you change ShopWTF so that it has a function to which I can pass the page as a parameter and it will return the altered page?

Yes, I can do that.
I had noticed that is the way you handle your relay scripts, and now I know why. And that is helpful.
I will likely update most of my relay scripts to work this way as more flexibility is more better.
But sleep first. Update tomorrow.
 
Top