Clarify SoundSetVolume with positive offset Topic is solved

Share your ideas as to how the documentation can be improved.
EFH52
Posts: 16
Joined: 21 Mar 2016, 10:00

Clarify SoundSetVolume with positive offset

06 Sep 2023, 12:28

SoundSetVolume is inconsistent with the v2 documentation:

Code: Select all

NewSetting
Type: Number or String

Percentage number between -100 and 100 inclusive (it can be a floating point number). If the number begins with a plus or minus sign, the current setting will be adjusted up or down by the indicated amount. Otherwise, the setting will be set explicitly to the level indicated by NewSetting.

Code: Select all

SoundSetVolume "+1"
This does increase the volume by 1

Code: Select all

SoundSetVolume +1
This only sets the value of the volume to 1 and only 1.

Use of a number OR string doesn't ring true where only sending a string obtained the expected result.
geek
Posts: 1054
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

Re:

06 Sep 2023, 13:02

"Number or String" is accurate, but SoundSetVolume +1 doesn't pass literally +1, it passes the result of the expression + 1 (space added for clarity), which is just 1. When + used as a unary operator (an operator with only one operand, in this case the number 1) it is documented to do this:
Unary plus (+): +N is equivalent to -(-N). This has no effect when applied to a pure number, but can be used to convert numeric strings to pure numbers.
which is not terribly helpful to the your case here.

There is no bug, but there is room for documentation improvement. I suggest changing "If the number begins with a plus or minus sign" to "If a negative Number is provided, or a String with a leading plus or minus sign". Note the new capitalization of the word Number, now referring to the type rather than the concept of a number.
User avatar
Ragnar
Posts: 627
Joined: 30 Sep 2013, 15:25

Re: Clarify SoundSetVolume with positive offset  Topic is solved

07 Sep 2023, 09:04

Thanks for reporting. I've updated the docs.

Return to “Suggestions on Documentation Improvements”

Who is online

Users browsing this forum: No registered users and 3 guests