Feature - Rejected Make "fold"-command also fold towel if no other option is available

Winterbay

Active member
I'm not sure if this is a feature request or a bug, but I'll err on the side of feature :)

When trying to make a makeshift cape today from my towel I used the fold command and got the following result:
Code:
[COLOR=olive]> fold makeshift cape[/COLOR]

[COLOR=red]You      don't have anything transformable into that item![/COLOR]

I do have a towel so I thought this a bit odd. I went to the relay browser (and got two horrible relay failures on the way, debug log attached just in case it has anything to do with anything, could just've been a side effect of CHIT I guess) and used the fold command on the towel to get a makeshift turban. I then went back to the CLI and got the following:
Code:
You acquire an item: makeshift turban

[COLOR=olive]> fold      makeshift cape[/COLOR]

Using 1 makeshift turban...
You acquire an      item: makeshift cape
Finished using 1 makeshift turban.

So, I propose that the fold command also work with the towel directly if no other item that can be folded is available.
 

Fluxxdog

Active member
IIRC, that was intentional. If it doesn't show up in get_related($item[],"fold") then mafia doesn't consider it for any folding purposes. The original item, such as an iceberglet, is always excluded as it can never be transformed back in to it.

Wish I could remember who I talked with about that. Maybe and old bug/FReq?
 

Theraze

Active member
And you can use the gCLI to "use towel" and make it into one of the foldable items already manually...
 

lostcalpolydude

Developer
Staff member
I don't think protecting an unused towel (mall price < 3k currently) is as important as any IotM foldables, so a special case wouldn't be a bad idea from that perspective. It would have to be a special case though, if it's worth adding.
 

Theraze

Active member
The issue is more in that, as you say, it's a special case, different from all other foldables. Is the additional functionality worth forking behaviour?
 

Winterbay

Active member
Ahh yes, there are more problematic foldables. I'll just make an alias for "fold towel" to "use towel" then :)
 
You should post the debug log in a separate thread to get that looked at. I took a quick look this morning because I was curious, but didn't see a connection between the stack trace and the log to suggest a fix. Did you have debug log turned on when this happened? I assume you can't reproduce. It's odd because I'd expect to see more "----- From Browser -----" lines than you have. The only fix in the short term may be to add further debugging logic if the space isn't found, like:

Code:
		if ( spaceIndex != -1 )
		{
			this.requestMethod = requestLine.substring( 0, spaceIndex );
			boolean usePostMethod = this.requestMethod.equals( "POST" );
			this.path = requestLine.substring( spaceIndex + 1, requestLine.lastIndexOf( " " ) );

			if ( this.path.startsWith( "//" ) )
			{
				// A current KoL bug causes URLs to gain an unnecessary
				// leading slash after certain chat right-click
				// commands are used.
				this.path = this.path.substring( 1 );
			}

			this.request.constructURLString( this.path, usePostMethod );
		}
		else
		{
			StaticEntity.printStackTrace( e, "Horrible relay failure - " + requestLine );
		}

note this is thoroughly untested, and I'm sure there's a far better way to do this.
 

roippi

Developer
I think since it constitutes a weird forking of behavior, rejecting. If we were to make "fold" always consume the source item, it would be fine, but consensus seems to be that we don't want to do that.
 

roippi

Developer
And the debug log doesn't really make sense to me. It essentially says that java couldn't find a space in this string:

Code:
GET /chatlaunch.php HTTP/1.1

which, um.. has two.

Edit: well, it's not that string. It's another string just like it. Presumably the next GET from the browser, which is somehow malformed.
 
Last edited:

Winterbay

Active member
You should post the debug log in a separate thread to get that looked at. I took a quick look this morning because I was curious, but didn't see a connection between the stack trace and the log to suggest a fix. Did you have debug log turned on when this happened? I assume you can't reproduce. It's odd because I'd expect to see more "----- From Browser -----" lines than you have. The only fix in the short term may be to add further debugging logic if the space isn't found, like:

Code:
        if ( spaceIndex != -1 )
        {
            this.requestMethod = requestLine.substring( 0, spaceIndex );
            boolean usePostMethod = this.requestMethod.equals( "POST" );
            this.path = requestLine.substring( spaceIndex + 1, requestLine.lastIndexOf( " " ) );

            if ( this.path.startsWith( "//" ) )
            {
                // A current KoL bug causes URLs to gain an unnecessary
                // leading slash after certain chat right-click
                // commands are used.
                this.path = this.path.substring( 1 );
            }

            this.request.constructURLString( this.path, usePostMethod );
        }
        else
        {
            StaticEntity.printStackTrace( e, "Horrible relay failure - " + requestLine );
        }

note this is thoroughly untested, and I'm sure there's a far better way to do this.

The only thing I did was press the relay browser icon...
 
And the debug log doesn't really make sense to me. It essentially says that java couldn't find a space in this string:

Code:
GET /chatlaunch.php HTTP/1.1

which, um.. has two.

Edit: well, it's not that string. It's another string just like it. Presumably the next GET from the browser, which is somehow malformed.

Yup, but that "next GET" should have had be printed out to the debug log (with the corresponding "---- FROM BROWSER -----" line), no? and it didn't seem to be. Hence my recommendation for more info when this error occurs, in a prior post.

Winterbay, if you can duplicate in the future, you *might* (and again, forgive my ignorance, I could be completely off base) get more info by turning the debug log on first, then hitting the relay browser button. That being said, you still got messages that only seem to come from having debug log turned on, hence my suspicion of me missing something.
 

Winterbay

Active member
I think that "horrible relay failure" is different in some way than a normal NPE or so ion what is dumped out, but I may be completely off...
 
Top