1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  2. LOOKING FOR A VERSION OF SKRIPT??:

    You can always check our our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Placeholders + Variables

Discussion in 'Skript' started by CustomWorldYT, Jul 2, 2018.

Thread Status:
Not open for further replies.
  1. CustomWorldYT

    CustomWorldYT Member

    Joined:
    Jun 17, 2018
    Messages:
    15
    Likes Received:
    0
    I'm developing Skript, and I want a command to edit messages of plugin in-game, because not every person is friend with Skript's options. I'm using variables to save pieces of messages, that can be edited in-game using command "/edit prefix &a&lNew Prefix &b&l>>" (for example). But now, I want to make messages compatible with placeholders like %arg 1%, %player%, etc. Every time I use "/edit mutemsg &c%player% &eis muted." (for another example), it will just show %player% in the chat, not player name.

    Skript Version:2.2 (dev. 36)
    Skript Author: CustomWorldYT (Me)
    Minecraft Version: 1.12.2

    ---
    Code:

    Code (Skript):
    1.  
    2. set {cw.lang::muted} to "&cPlayer &e[B]%player% [/B]&cis muted." #How to put placeholders into variables to use it with message effects?
    3. message "%{cw.lang::muted}%" to player #If staff will use "/edit mutemsg &e%player% &cis muted." for example, it will just show "%player%" in the chat, not player name.
    4.  
    Errors on Reload:

    Code (Skript):
    1. None, it will just show %player% in the chat. However, if I want to create variable on Skript start containing placeholder, it will show me %player% cannot be used in "on skript start" event, or similar message.
    Console Errors: (none)

    Code (Skript):
    1. None...
    Other Useful Info:

    Addons using (including versions):
    No addons currently.

    Troubleshooting:

    Have you tried searching the docs? Yes
    Have you tried searching the forums? Yes
    What other methods have you tried to fix it?
    I tired to double the percents (%%player%%), but it didn't helped and it showed "%%player%%" again.
     
  2. Best Answer:
    Post #2 by Efnilite, Jul 2, 2018
  3. Efnilite

    Supporter

    Joined:
    May 12, 2018
    Messages:
    218
    Likes Received:
    14
    Medals:
    Try using placeholder-placeholders:
    Example command:
    Code (Skript):
    1. /set msg-1 &cTest {player}
    Code (not tested though)
    Code (Skript):
    1. set {var} to "&cTest {player}"
    2.  
    3. command /test:
    4.     trigger:
    5.         set {_lang::*} to "%{var}%"
    6.         replace all "{player}" with "%player%" in {_lang::*}
    7.         send "%{_lang::*}%"
     
  4. CustomWorldYT

    CustomWorldYT Member

    Joined:
    Jun 17, 2018
    Messages:
    15
    Likes Received:
    0
    This might work, thank you very much.
     
Thread Status:
Not open for further replies.
Loading...