Bug 1 7-ball translates to 17-ball in the cli

ereinion

Member
I have a script in which a line having this cli-equivalent happens:

Code:
> ash item it = $item[7-ball];cli_execute("smash " + to_string(item_amount(it)) + " " + to_string(it));

Now, what I get as output to my cli is:

Code:
[COLOR=red][17-ball] requested, but none available.[/COLOR]
Returned: false

The same happens when I just put

Code:
[COLOR=olive]> smash 1 7-ball[/COLOR]

into the cli.

I expect this is a problem that happens quite rarely, but it may still be something which should be looked at before an unfortunate accident happens :D
 

Theraze

Active member
Is 15989 why this now happens? This is on r15989.
> ash $item[548].to_string()

Returned: 668 scroll

> ash $item[548].to_string().to_item().to_string()

Returned: scroll of drastic healing
 

lostcalpolydude

Developer
Staff member
Apparently there was a script actually triggering that, somehow, so I reverted the change. Making all of this stuff work together seems complicated.
 

Theraze

Active member
No, with 15989, $item[668 scroll] resolves to $item[scroll of drastic healing] rather than $item[668 scroll] which I noted initially through Guide spitting out a lot of warnings in the gCLI. Then I tested it through direct $item calls, but it's easier to show the bug report by demonstrating that mafia is munging the item itself with the value. :) No guarantee of me typo-ing the spelling or getting weird results like with the pearl items skipping the pearl divers when you're trying to make jewelry.

Edit: Anyways, confirmed working again in r15990. Thanks.
> ash $item[548].to_string().to_item().to_string()

Returned: 668 scroll
 
Last edited:

Theraze

Active member
As a workaround for ereinion, you could probably replace your code with this to force it to the 7-ball:
Code:
ash item it = $item[7-ball];cli_execute("smash 0" + to_string(item_amount(it)) + " " + to_string(it));
 

heeheehee

Developer
Staff member
You could just use the pilcrow syntax for forcing a particular item:
Code:
cli_execute("smash " + to_string(item_amount(it)) + " \xb6" + to_int(it));
> smash 1 ¶1906

Pulverizing 7-ball...
You acquire twinkly powder (3)
7-ball smashed.

edit: yet another option that'd avoid this entirely would be something along the lines of "smash * 7-ball".
 
Last edited:

Theraze

Active member
True, when you want the full item_amount, the gCLI equivalent is just *, and is a much easier choice rather than hacking in the number manually.
 

ereinion

Member
Does using the pilcrow hold any benefits over just inserting a zero after "smash"? The actual line in the script reads

Code:
cli_execute("smash 0" + to_string(item_amount(it) - keep_amount[it]) + " " + to_string(it));

at the moment, so I'm pretty sure the asterisk is out of the question.

At any rate, my initial concerns over this wasn't so much to find a workaround (it is nice, but also a niche enough case that I can just handle it manually), but rather that someone who actually have a 17-ball in their inventory could be up for a nasty surprise, if they for some reason try a command similar to the ones outlined in the initial post.
 
Top