moving from 127.0.0.1 to localhost for relay browser broke all my greasemonkey script

stufff

New member
Not sure when the change was made, I think it was some time in the last few weeks. With userscripts.org shut down none of these scripts are being updated anymore so it looks like most of them are going to stay broken. I tried manually editing the scripts to add new @include lines, just replacing 127.0.0.1 with localhost, but that doesn't seem to work as the scripts still aren't working. Would it be possible to get an option to switch back to using 127.0.0.1 so I can continue using my GM scripts?
 

lostcalpolydude

Developer
Staff member
Not sure when the change was made, I think it was some time in the last few weeks. With userscripts.org shut down none of these scripts are being updated anymore so it looks like most of them are going to stay broken. I tried manually editing the scripts to add new @include lines, just replacing 127.0.0.1 with localhost, but that doesn't seem to work as the scripts still aren't working. Would it be possible to get an option to switch back to using 127.0.0.1 so I can continue using my GM scripts?

There's no reason that should not have worked.
 

xKiv

Active member
There's no reason that should not have worked.

Greasemonkey 2.0 mande @grant directives mandatory, with the exception of scripts that were already installed - but once you change the script (even to modify an @include), it's now new and requires @grant for each GM_* function it calls. So maybe modifying the script *is* a reason for it not working.
 

stufff

New member
There's no reason that should not have worked.

That's exactly how I felt! Unfortunately reality doesn't seem to agree with us. For example, the Lair Item Spoiler script is a very simple script that just tells me what specific items I'm missing when I use the telescope on the Sorceress lair and gives links (many of which are outdated now) to the zones to find the items. It has the following header:

// RetroFrog Lair Item Spoiler
//
// ==UserScript==
// @name Lair Item Spoiler
// @namespace http://retrofrog.hardcoreoxygenation.com/kol
// @include *kingdomofloathing.com/campground.php*
// @include *kingdomofloathing.com/lair1.php*
// @include *127.0.0.1:600*/campground.php*
// @include *127.0.0.1:600*/lair1.php*
// @description Version 0.3
//
// ==/UserScript==

To which I added, between the last @include and @description, the following:
// @include *localhost:600*/campground.php*
// @include *localhost:600*/lair1.php*

When I click the bottom telescope and check my currently running GM scripts, it shows me that that GM script is loaded but it doesn't actually do what it is supposed to anymore.

Same thing with Old Style Action bar, which just keeps the old combat action form open every turn (I use for easier funkslinging):
// ==UserScript==
// @name KoL Old-style combat
// @namespace redacted@googlemail.com
// @description Automatically shows the old combat form as well as the new action bar
// @include *kingdomofloathing.com/fight.php
// @include *127.0.0.1*/fight.php
// @include *localhost*/fight.php
// ==/UserScript==

I don't know what I'm doing wrong, but these scripts worked before the change to localhost and I can't get them to work now.
 
Last edited:

stufff

New member
>Greasemonkey 2.0 mande @grant directives mandatory, with the exception of scripts that were already installed - but once you change the script (even to modify an @include), it's now new and requires @grant for each GM_* function it calls. So maybe modifying the script *is* a reason for it not working.

Not completely sure I follow what you're saying, but I didn't see a @grant line in any of the scripts after a quick search. Do you know what I'd need to do to fix the issue if it is the problem you described?
 

Veracity

Developer
Staff member
Would it be possible to get an option to switch back to using 127.0.0.1 so I can continue using my GM scripts?
I don't use Greasemonkey, so I don't really have a dog in this fight, but I'm not automatically opposed to having a setting.

It does seem problematic, however; there will be no incentive for the authors of Greasemonkey scripts to support localhost, since there will be many authors who will not lift a finger to change, instead saying "just use KoLmafia's backwards compatibility setting". And if it is true that it is difficult (or impossible) for (some) users to convert scripts on their own, that's a problem.

Seems like we should consider reverting the change. Or, perhaps, making it preference controlled but off by default, so that if we ever have to switch for real for permanent some day, it will be trivial.
 

Bale

Minion
Seems like we should consider reverting the change. Or, perhaps, making it preference controlled but off by default, so that if we ever have to switch for real for permanent some day, it will be trivial.

I prefer this. It makes the future safer.
 

lostcalpolydude

Developer
Staff member
If there had been a preference before ads were added (and if they had stuck around), most people wouldn't have even known the setting was there to change, and changing the default value would not have changed it for existing users, so it would have mostly been pointless. So there's a reasonable chance that a setting wouldn't be too useful. Even if something changes and mafia just plain won't log in with the current setup, lots of people would end up asking what needs to change, and telling them to update to a fixed version of mafia is as easy as telling them to change a setting.
 

xKiv

Active member
Not completely sure I follow what you're saying, but I didn't see a @grant line in any of the scripts after a quick search. Do you know what I'd need to do to fix the issue if it is the problem you described?

Search the script for GM_, and for each GM_$foo function found, add a line that grants it:
// @grant GM_$foo


If this is this problem, then your (already modified) scripts weren't working even after mafia reverted to 127.0.0.1.
(which is to say, you don't have to do this if the scripts work after the revert)
 

stufff

New member
Search the script for GM_, and for each GM_$foo function found, add a line that grants it:
// @grant GM_$foo


If this is this problem, then your (already modified) scripts weren't working even after mafia reverted to 127.0.0.1.
(which is to say, you don't have to do this if the scripts work after the revert)

Thanks! This is indeed the problem with every KoL script I use. The update to localhost happened at pretty much the same time as my update to GM2.0 so all my scripts broke for two independent reasons. Going through and fixing most of these manually as they aren't being maintained and the authors have mostly quit playing.
 

Veracity

Developer
Staff member
So, what do you think, now that we changed back to using 127.0.0.1 again? That was for the benefit of people running old un-supported scripts with older versions of Greasemonkey who didn't know how to (or didn't want to learn how to) edit their scripts.

I hope you left both localhost and 127.0.0.1 in the ones that you maintain. :)
 
Top