Variable outside skript

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

Turb032

Active Member
Jan 16, 2020
109
0
16
21
Hi guys, I just wanted to know if it's possible to take a variable from "outside" a Skript. Thank you!
 
Assuming you mean take the value of one of Skript's variables and use it elsewhere, you could set up a db and have Skript save variables there.
 
You can use Ersatz to create placeholders with PlaceholdersAPI. This is the method I would recommend. If you still need help, post your code and I can show you how to use it.

I''ll give an example: I assume you know how to use variables so, say you want your scoreboard plugin to show how many Coins a player has. The Coins are managed by an economy skript that stores the Coin amounts in the variable {Coins::%player's uuid%} (Using a list variable is recommended for this). This is how you would skript the PAPI placeholder:

Code:
on placeholder request with prefix "eco":
  if the identifier is "coins":
    set the result to "{Coins::%player's uuid%}"
This would create a PAPI placeholder that looks like this: %eco.coins%

Then, in your scoreboard plugin, just put %eco.coins% and you're done!
 
You can use Ersatz to create placeholders with PlaceholdersAPI. This is the method I would recommend. If you still need help, post your code and I can show you how to use it.

I''ll give an example: I assume you know how to use variables so, say you want your scoreboard plugin to show how many Coins a player has. The Coins are managed by an economy skript that stores the Coin amounts in the variable {Coins::%player's uuid%} (Using a list variable is recommended for this). This is how you would skript the PAPI placeholder:

Code:
on placeholder request with prefix "eco":
  if the identifier is "coins":
    set the result to "{Coins::%player's uuid%}"
This would create a PAPI placeholder that looks like this: %eco.coins%

Then, in your scoreboard plugin, just put %eco.coins% and you're done!
Thank you! I'll try this.
[doublepost=1589704264,1589702677][/doublepost]It gives me an error: "Can't compare the indentifier with a text", this is the code i've done:
Code:
on placeholder request with prefix "cash":
    if the indentifier is "player":
        set the resault to "{cash.%player%}"

the variable {cash.%player%} it's a normal variable that i created
[doublepost=1589704668][/doublepost]
You can use Ersatz to create placeholders with PlaceholdersAPI. This is the method I would recommend. If you still need help, post your code and I can show you how to use it.

I''ll give an example: I assume you know how to use variables so, say you want your scoreboard plugin to show how many Coins a player has. The Coins are managed by an economy skript that stores the Coin amounts in the variable {Coins::%player's uuid%} (Using a list variable is recommended for this). This is how you would skript the PAPI placeholder:

Code:
on placeholder request with prefix "eco":
  if the identifier is "coins":
    set the result to "{Coins::%player's uuid%}"
This would create a PAPI placeholder that looks like this: %eco.coins%

Then, in your scoreboard plugin, just put %eco.coins% and you're done!
Oh but wait, i meant creating a variable in skript ({lalala.%player%}) set it to something, than changing .sk file, and than put the variable i created in the skript before, into the skript i'm using.
 
Status
Not open for further replies.