String placeholders/variables ??

  • 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!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

alleg0

Member
Jan 30, 2017
1
0
0
29
Skript Version: Skript 2.2 (dev28c)
Skript Author: Bensku
Minecraft Version: 1.11.2
---

My whole goal of this skript is to make it so the user of the skript can customize the format for the page selection bar, and the arrows or what they use for the page buttons will have json implemented into them. for instance

<left='&c<---'> will make the left arrow for:

<--- Page: 2 --->

and it will have json implemented into it
I need a way to take what is inside my placeholders ''s and make that the text shows and a button that clicks.
But I do not know how to make the skript find <left='(some text)'> to then replace it with the (some text).

Full Code:

code_language.skript:
options:
    Format: <left='&c<---'> Page = <pgNum> <right='&a--->'>

command /page <number>:
    trigger:
        set {_fmt} to "{@Format}"
        replace all "<pgNum>" in {_frmt} with "%arg 1%"
        replace all "<left='(text)'>" in {_frmt} with "(text)||cmd:/page 0"
        json ("%player%", "%{_frmt}%")

Addons using (including versions):
I am using json.sk.

Troubleshooting:

Have you tried searching the docs? Yes
Have you tried searching the forums? Somewhat, did not know exactly what to search, I tried searching string variable replacement.
What other methods have you tried to fix it? none, just searched and searched.
 
Skript Version: Skript 2.2 (dev28c)
Skript Author: Bensku
Minecraft Version: 1.11.2
---

My whole goal of this skript is to make it so the user of the skript can customize the format for the page selection bar, and the arrows or what they use for the page buttons will have json implemented into them. for instance

<left='&c<---'> will make the left arrow for:

<--- Page: 2 --->

and it will have json implemented into it
I need a way to take what is inside my placeholders ''s and make that the text shows and a button that clicks.
But I do not know how to make the skript find <left='(some text)'> to then replace it with the (some text).

Full Code:

code_language.skript:
options:
    Format: <left='&c<---'> Page = <pgNum> <right='&a--->'>

command /page <number>:
    trigger:
        set {_fmt} to "{@Format}"
        replace all "<pgNum>" in {_frmt} with "%arg 1%"
        replace all "<left='(text)'>" in {_frmt} with "(text)||cmd:/page 0"
        json ("%player%", "%{_frmt}%")

Addons using (including versions):
I am using json.sk.

Troubleshooting:

Have you tried searching the docs? Yes
Have you tried searching the forums? Somewhat, did not know exactly what to search, I tried searching string variable replacement.
What other methods have you tried to fix it? none, just searched and searched.
code_language.skript:
replace all "<pgNum>" with "%arg 1%" in {_frmt}
dunno if that works, but if it does, then do that on the other one as well.
 
Status
Not open for further replies.