%PlayerDataFor%Player%variable not working if using global variables or $args instead of Player name #339


  • Defect
  • Enhancment
  • Invalid
Open
  • Caley19_ created this issue May 22, 2022

    I have few commands that goes like this: (they are a bit more complex, this is just a quick example)

    /quest $arg1
    runcmd:
    - '$Script$%PlayerDataFor%qst_$arg1%title=Empty quest title'

    - '$Script$%PlayerDataFor%qst_$arg1%description=Empty quest description'

    - '$Script$%PlayerDataFor%qst_$arg1%reward=Empty reward'

    (I'm trying to use PlayerData as "data storage" for each quest, so a quest named "mine_stone" will be saved under PlayerData "qst_mine_stone")

     

    Instead of adding new variables for the "qst_$arg1" player, it writes all those variables to the player who executes the command. Same problem with using global variables, for example:

    - '$Script$%Variable%quest.player=qst_$arg1'

    - '$Script$%PlayerDataFor%quest.player%title=Empty quest title'

    - '...'

    gives same result as above.

     

    There's a workaround for this, running commands such as:

    "- $RUN_CONSOLE$/mycmd-playerdata set qst_$arg1 variable value".

    Its messy, but I can live with it.

     

    The worse thing is that PlayerData's array variables work this same way - you get the same result when using "%PlayerDataFor%qst_$arg1%variable.addlist=value" or "%PlayerDataFor%quest.player%variable.addlist=value". All values will be written to the player who executed the command, not the player set in variables/$args used instead of Player name. And I can't find a other ways how to edit arrays in PlayerData. /mycmd-playerdata doesn't have options such as "addlist" or "removelist" so I can't do any workarounds. Not sure if I'm missing something.  I also tried to manually create those variables and use scripts above to rewrite them and it still didn't worked.

    Any ideas how to make this work or any feedback is very welcome. If it would be possible to implement "addlist" and "removelist" options (/mycmd-playerdata addlist player array value) that would be very helpfull, fixing those PlayerDataFor issues would be even better. Thanks.

  • Caley19_ added the tags Defect Enhancment Invalid May 22, 2022
  • Caley19_ edited description May 22, 2022

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