Change variable value from double to integer #314


  • Enhancment
Open
  • SpaceYoshiTV created this issue Oct 19, 2021

    Hi there,

    I don't think that this is currently possible with MyCommand, and this would be a very helpful feature for all math-related script actions.

    I am currently trying to create a script for a command that converts a player's exp into experience bottles.

    The problem that occurs here: the original exp value is an integer, but gets divided by 7 into a double. I would like for it to stay an integer.

    For example: 55/7 results in 7.85...

    I would like it to result in either 7 (integer behaviour), or rounded up to 8.

    Most commands (like /give, or the built-in addItem API option) don't accept doubles and will make the whole script fail.

    - '$RUN_CONSOLE$/mycmd-playerdata set_silent $player MaxBottles $exp'
    - '$Script$%PlayerData%MaxBottles/7'

    ...

    - '%PlayerOptions%addItem: EXPERIENCE_BOTTLE:$PlayerData%MaxBottles%'

    I would like to suggest a feature that makes it possible to keep an integer value, or transform a double into one.

     

  • SpaceYoshiTV added a tag Enhancment Oct 19, 2021
  • realcommandandorder posted a comment Oct 24, 2021

    please use placeholderapi-math expansion

  • SpaceYoshiTV posted a comment Oct 24, 2021

    Thank you, this solution works.


To post a comment, please login or register a new account.