Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing Parameters #2

Open
Halogly opened this issue Sep 16, 2024 · 1 comment
Open

Passing Parameters #2

Halogly opened this issue Sep 16, 2024 · 1 comment

Comments

@Halogly
Copy link

Halogly commented Sep 16, 2024

Hello author, although it is not a bug, I still want to give some feedback.
When I use trmenu, there is a function that can open the player's menu by right-clicking the player, in which the menu will automatically pass the name of the right-clicked player into the variable {0}. In order to display other parameters or placeholders of this player, I used parseother expansion. The problem with {username} is the biggest, because I can't pass the player's name in by changing it to {{0}}. I discussed it with my friend for a long time, and finally passed the parameter {0} in through the js function. The code is as follows:

  getPAPIParse: |-
    function getPAPIParse(str) {
      return('%' + str.replace("name", vars("{0}")).replace(/-/g, "_").replace(/</g,"{").replace(/>/g,"}") + '%');
    }
    getPAPIParse(args[0]);

name: '${getPAPIParse_parseother-<name>-<player-level>}'
#Make the name of an item display a placeholder for this player

Regarding the player's name, I found that otherplayer expansion can use {0} to pass the player's name, so I hope you can modify these issues of username slightly.

@Halogly
Copy link
Author

Halogly commented Sep 16, 2024

My friend just simplified the script, now it should be written like this:
name: '&r{js: vars("%parseother_\{" + vars("\{0\}") + "\}_\{player_level\}%")}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant