Bug - Fixed Cannot use Sofa — r11337 (Sofa command accepts invalid number of turns)

fronobulax

Developer
Staff member
r11338
Resting failed - no Clan Sofa available.

but my clan does have a sofa and i was able to rest in it for one adventure, from the relay browser, immediately after the message.
 

lostcalpolydude

Developer
Staff member
How did you manage that? I just tried to get that error message, first using the sofa command and then by having the clan sofa be the only thing checked in MP restorers, and it works flawlessly for me. Then I switched clans and got the expected error message.
 

fronobulax

Developer
Staff member
Dunno. The character in question has not changed clans in a couple of years. Am running UR. Happened twice while bccascend was running. Can pay close attention tomorrow if that is helpful. The preferences are per character, right? I have a character in a different clan and that clan does not have a sofa and I just unchecked that as an option for that character, but there should be no interaction.
 

fronobulax

Developer
Staff member
You've had the crap beaten out of you... attempting to find some more crap.
Casting Tongue of the Otter 1 times...
You gain 13 hit points
You lose an effect: Beaten Up
Tongue of the Otter was successfully cast.
Restoring HP! Currently at 13 of 166 HP, 218 of 476 MP, current meat: 16232 ... Target HP = 158.
Restoring MP! Currently at 13 of 166 HP, 218 of 476 MP, current meat: 16232 ... Target MP = 258.
Executing request...
Resting failed - no Clan Sofa available.
BCC: You aborted, so so am I. This abort may have been caused by a rogue condition not being met. If this is unexpected, please paste the CLI output, as well as the results of typing 'condition check' without the quotes, into the mafia CLI window now.
Visiting Comfy Sofa in clan rumpus room

[2122] Rest in Clan Sofa (1 turns)
You gain 65 hit points
You gain 65 Mana Points
Resting completed.

Still there as of r11342. I got the abort than manually rested. (I didn't really expect this to be fixed but figured I might have more information). BCCAscend, UR and WHAM all in use. Looking at the code all I can think of is that there are alternative response texts and I am getting one that was unexpected.
 

lostcalpolydude

Developer
Staff member
UR uses the sofa command to rest on the sofa, and it checks the rumpus room to see if there's a sofa (every time it wants to use the sofa, apparently...), so it should be resting on the sofa properly.

When you rest in the relay browser, are you getting a message that doesn't include "You take a nap"? Actually, mafia is doing the same check on relay browser sofa uses, and you don't have the error message there, so never mind.
 

fronobulax

Developer
Staff member
UR uses the sofa command to rest on the sofa, and it checks the rumpus room to see if there's a sofa (every time it wants to use the sofa, apparently...), so it should be resting on the sofa properly.

When you rest in the relay browser, are you getting a message that doesn't include "You take a nap"? Actually, mafia is doing the same check on relay browser sofa uses, and you don't have the error message there, so never mind.

Correct. After my idle speculation I noticed that the relay browser text has "You take a nap" (or something that I expect would match the string in code). probably need to put a debugger on this but not sure when.
 

fronobulax

Developer
Staff member
Got it. The command "sofa 0" was being attempted and that did not make any sense, hence the incorrect failure message. While there might be a FR here I'm going to talk to Bale, first.
 

Bale

Minion
Well, it was a bug that my script attempted sofa 0, so I fixed it. However, I suspect that has been camouflaged all along by mafia just not caring about the error,
 

lostcalpolydude

Developer
Staff member
That looks like something that can reasonably get fixed on mafia's end too (maybe aborting with a different message when you try spending less than 1 turn on the sofa rather than actually trying to do it). I updated the thread title to something more related to the actual issue.
 

fronobulax

Developer
Staff member
Well I wasn't sure whether I wanted a feature request or not. Basically this is a "function call" that expects one parameter. What is the appropriate behavior if the parameter is missing? What if it it present but nonsensical? Ignoring any precedents set by other cli or ash functions, I gravitate towards sofa and sofa 1 being synonyms. If that is true then sofa 0 should be equivalent to sofa and that just masks the UR feature and anything similar. On the other hand if the command is sofa x and we abort if x is absent or less than 1, do we perhaps consider that sofa 100 is probably not what the user wanted either? (KoL may tak care of that but I'm not going to burn turns checking). My answer also depends upon how we respond to the error. Is sofa 0 so evil that we should abort in the same way sqrt(-1) is pretty much fatal, or do we emit a message but continue? At least this time I did not perpetuate silently replacing the offending parameter with "1" and continuing :)
 

Catch-22

Active member
I think it's pretty obvious, sofa 0 shouldn't be interpreted as "attempt to rest on the sofa 0 times" it's just "rest on the sofa 0 times" in other words, do nothing.
 

fronobulax

Developer
Staff member
I think it's pretty obvious, sofa 0 shouldn't be interpreted as "attempt to rest on the sofa 0 times" it's just "rest on the sofa 0 times" in other words, do nothing.

But since the current behavior is to abort with a message that says there is no sofa, we are having this discussion. You and I once thought alike and would have said "do nothing silently" but my opinion has changed to at least emit a message which is not quite "do nothing".
 

Catch-22

Active member
Hmm well the way I see it, when asked to rest on the sofa 0 times, doing nothing is the appropriate response.

When asked to rest on the sofa 1 or more times but that fails, printing a message is the appropriate response.
 

Fluxxdog

Active member
Hmm well the way I see it, when asked to rest on the sofa 0 times, doing nothing is the appropriate response.
Attempting to rest 0 times on the sofa has KoL return it's own version of an error message. That should be relayed or noted at the least.
 

Catch-22

Active member
Attempting to rest 0 times on the sofa has KoL return it's own version of an error message. That should be relayed or noted at the least.

KoL handles a lot of bogus things that KoLmafia simply won't let you do.

Example 1: I have a camp scout backpack equipped, and I try to equip another one. KoLmafia just silently ignores me (because that's a stupid request). KoL on the other hand, would say "You don't have the item you're trying to equip." which is true, because I only have one.

Example 2: If I equip an ASCII shirt and I try to equip another one, KoLmafia silently ignores my silly request, KoL says:

You equip an item: ASCII shirt

Item unequipped: ASCII shirt

So I think it's important to note that when it comes to stupid requests, KoLmafia has a history of silently ignoring them. I consider "sofa 0" to be a stupid request, like trying to equip an ASCII shirt when you already have one equipped.
 
Last edited:

Catch-22

Active member
Ignoring the request for "sofa 0" is saving a server hit.

Yup, and it's just standard KoLmafia practice. If your request is stupid, it will just ignore you :)

For another example, try "use 0 angry farmer candy".

KoLmafia successfully uses 0 angry farmer candy, ie. it does absolutely nothing. If you try to multiuse 0 angry farmer candies in KoL, you'll get "That doesn't make any sense.".

Edit: This patch does a whole lotta nothin' when you try to rest on the sofa for 0 turns.
 

Attachments

  • sofa0.patch
    1.3 KB · Views: 23
Last edited:
Top