Solved Save the Local Variable of the function

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

couger44

Supporter
Feb 19, 2017
713
31
28
Chile
Is there a way this works?
code_language.skript:
function worldexpNivelDelJugador(p: player, variable: string):
    if {worldexp.nivel.%{_p}%} is between 1 and 4:
        set {_%{_variable}%} to "&8[%{worldexp.nivel.%{_p}%}%] %coloured {_p}'s prefix%%{nombre.%{_p}%}%%coloured {_p}'s suffix%"
    else if {worldexp.nivel.%{_p}%} is between 5 and 9:
        set {_%{_variable}%} to "&7[%{worldexp.nivel.%{_p}%}%] %coloured {_p}'s prefix%%{nombre.%{_p}%}%%coloured {_p}'s suffix%"
    else if {worldexp.nivel.%{_p}%} is between 10 and 14:
        set {_%{_variable}%} to "&f[%{worldexp.nivel.%{_p}%}%] %coloured {_p}'s prefix%%{nombre.%{_p}%}%%coloured {_p}'s suffix%"
    else if {worldexp.nivel.%{_p}%} is between 15 and 19:
        set {_%{_variable}%} to "&2[%{worldexp.nivel.%{_p}%}%] %coloured {_p}'s prefix%%{nombre.%{_p}%}%%coloured {_p}'s suffix%"
    else if {worldexp.nivel.%{_p}%} is between 20 and 24:
        set {_%{_variable}%} to "&3[%{worldexp.nivel.%{_p}%}%] %coloured {_p}'s prefix%%{nombre.%{_p}%}%%coloured {_p}'s suffix%"
    else if {worldexp.nivel.%{_p}%} is between 25 and 29:
        set {_%{_variable}%} to "&5[%{worldexp.nivel.%{_p}%}%] %coloured {_p}'s prefix%%{nombre.%{_p}%}%%coloured {_p}'s suffix%"
    else if {worldexp.nivel.%{_p}%} is between 30 and 34:
        set {_%{_variable}%} to "&1[%{worldexp.nivel.%{_p}%}%] %coloured {_p}'s prefix%%{nombre.%{_p}%}%%coloured {_p}'s suffix%"
    else if {worldexp.nivel.%{_p}%} is between 35 and 39:
        set {_%{_variable}%} to "&e&l[%{worldexp.nivel.%{_p}%}%] %coloured {_p}'s prefix%%{nombre.%{_p}%}%%coloured {_p}'s suffix%"
    else if {worldexp.nivel.%{_p}%} is between 40 and 44:
        set {_%{_variable}%} to "&a&l&ki&2&l%{worldexp.nivel.%{_p}%}%&a&l&ki&f %coloured {_p}'s prefix%%{nombre.%{_p}%}%%coloured {_p}'s suffix%"
    else if {worldexp.nivel.%{_p}%} >= 45:
        set {_%{_variable}%} to "&3&l&ki&b&l&ki&9&l&o%{worldexp.nivel.%{_p}%}%&b&l&ki&3&l&ki&f %coloured {_p}'s prefix%%{nombre.%{_p}%}%%coloured {_p}'s suffix%"
Basically what I want to do here is that in the second argument of the function you can "save" the variable placed to be able to use it later.My question is whether that is possible, for example to do something like this: (Taking the function that I wrote earlier)
code_language.skript:
on chat:
    cancel event
    worldexpNivelDelJugador(player, "_n")
    if player has permission "world.chat.suscrito":
        if {suscrito.%player%} is not set:
            broadcast "&7&ki%{suscrito.%player%}%&7&ki&a %{_n}%&f &9»&b» &6&l%message%"
#...
[doublepost=1556071252,1556066436][/doublepost]I just found a way to do it.
 
Status
Not open for further replies.