Telescope Information

Bale

Minion
Every now and then I see a request for mafia to grant full telescope information at the campground. People are told to use the "telescope" CLI command and while that works, it doesn't really make people as happy as they want to be. Now people can be fully happy because I'm adding that functionality to the relay browser.

Here's a script to add full telescope information to the campground. Download this to mafia's /relay directory. (It need to be in /relay, not /script.) It works automatically when you click on your telescope.

After installing this, your browser will tell you what item you need to pass the tower tests. You'll be told if you have that item. If you don't have the item, you'll be informed how to get that item.
 

Attachments

  • campground.ash
    7.7 KB · Views: 340
Last edited:

bumcheekcity

Active member
On floor 1, you see . To kill it you need to get none .

I actually see the darkness and require an inkwell. And have an inkwell.

Line 26 is:

Code:
telescope[[B]"see a strange shadowstrange shadow"[/B]] = new lair("the Darkness", "an ", $item[inkwell], "from a Writing Desk in the Haunted Library");

And needs to be:

Code:
telescope["see a strange shadow"] = new lair("the Darkness", "an ", $item[inkwell], "from a Writing Desk in the Haunted Library");

Script is amazingly useful, of course. I wish mafia had this built in :D
 

Bale

Minion
Whoops! Thanks for catching that typo.

The first post has been updated with the corrected script.

Script is amazingly useful, of course. I wish mafia had this built in :D

I understand the feeling, but Veracity has a good reason for not building it in since she doesn't want to have trouble risking the interaction of the feature with Mr Script's telescope explicator. Since so many people use Mr Script, that might be troublesome. Fortunately, as an optional component nobody has to use this if it causes any trouble.
 
Last edited:

Muhandes

Member
Does it do anything in addition to what the CLI telescope command does? I'm not sure what people are unhappy about with this command, is it that people wish to see the data in the RB?
 

Winterbay

Active member
Not having to go to the CLI and thereby leave the RB is what made me download this script. The command itself probably works just fine, but I'm more of a relay browser user myself and thus not having to go to the CLI is good...
 

Bale

Minion
Does it do anything in addition to what the CLI telescope command does? I'm not sure what people are unhappy about with this command, is it that people wish to see the data in the RB?

It provides a tiny bit more information than the CLI command, but nothing big. This is just for the convenience of people who don't want to leave the relay browser or use CLI commands.
 

Bale

Minion
I'm finding it annoying to see hair spray highlighted in red. I mean, mafia will just autobuy the stuff as soon as I hit the tower so there's no reason for me to care about it. The darn stuff can be purchased for a negligible sum of meat at any time so it is as good as acquired.

I've uploaded v1.2 which marks the hair spray in green, even if you don't have any.
 

lostcalpolydude

Developer
Staff member
I expect that change will cost someone a turn eventually when a person that doesn't automate the tower uses this script and goes into the fight without hair spray because they thought they had it. But seeing it in red would be annoying for a different group of people. And auto-buying it when viewing that page isn't right either. So I guess I'm not really adding anything here.
 

Bale

Minion
You don't have to automate the tower for mafia to autopurchase it. If you click on the tower in the relay browser and you don't have it, mafia will purchase it as long as it is allowed to purchase from NPC stores. Okay, a check to see if NPC purchase is turned on is in order. Added. Now it should cover people who won't have the hair spray purchased for them.

#lostcalpolydude: You did add something here by making me think about that.

v1.3 is now uploaded.
 

slyz

Developer
A problem with campground.php override scripts was reported here: when using summoning skills from the Relay Browser, skills.php redirects to campground.php and the override script is called, resulting in two casts of the summon.

A simple solution was to check the fields for "skilluse", and only call visit_url() in the override script if needed:
PHP:
void main() {
	if ( form_field("skilluse") != 1 ) override();
}
where override() is the new name for the main() of the old version.
 

Veracity

Developer
Staff member
I suggest that a better solution is for this script to kick in only when visiting the telescope; the "skilluse" field only happens when you are redirected to the booksehlf from skills.php. What happens when you summon directly from your bookshelf?

The URL for visiting the telescope has "action=telescope" in it, I believe.
 

heeheehee

Developer
Staff member
In that case, the fix would be
PHP:
void main() {
    if(form_field("action")=="telescopelow") override();
}

(copy-pasted from the other thread, which Bale is also sure to read)
 

Bale

Minion
Read both threads. Fix made. (Thanks for making that update so easy.)

Uploaded new version for the sake of everyone who prefers downloading to editing. :D
 
Last edited:

Bale

Minion
Apparently Bale missed page 2, I guess using Veracity and heeheehee's fix would be better.

I didn't miss it, but I modify the page to add a convenient link at the top since paging through 2 clicks to get that information is tedious to me. My testing shows that I'm not getting an extra summons this way so it seems that lacking a redirect from skills the bug does not occur.

If someone is still getting the bug, please let me know and I'll restrict myself to heeheehee's fix.
 
Last edited:

heeheehee

Developer
Staff member
I can imagine that, say, someone using the relay browser who wants to rest at his campground to use up a disco rest might accidentally rest again. Haven't tested this yet, but it seems possible, judging from how the original problem popped up (i.e. resending an action because of visit_url()).

Edit: Never mind, this doesn't seem to happen.
 
Last edited:

Veracity

Developer
Staff member
It will resubmit the page only if the original request resulted in a redirect, which shows up as a 0-length result to the relay script. I can't think of anything other than skills.php which calls campground.php and gets a redirect back to itself. Which is not to say that KoL will not add such things in the future. For that reason, even if we don't have another current example, I still think it is cleaner for a script which decorates the telescope results to only fire on a URL that will get those results, leaving everything else for KoLmafia to do with as it sees fit, but that's just my opinion. Others (obviously!) don't agree.
 

Bale

Minion
I still think it is cleaner for a script which decorates the telescope results to only fire on a URL that will get those results, leaving everything else for KoLmafia to do with as it sees fit, but that's just my opinion.
Perhaps, but I want to add something to the page on every other result as well and your preferred solution makes that impossible. Ignoring calls to "campground.php?skilluse=1" serves my goal best. What would really be better is if there was a way for the result from the original page could be returned to KoLMafiaASH.getClientHTML so that it will continue on without problem, but that isn't possible for me right now.
 

stannius

Member
A Humble Request: Consider items as present if they are in your closet (as the gcli command does). I put stuff in my closet to prevent accidental use/autoselling.
 
Top