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

Mikioul

New Member
Mar 20, 2017
7
0
0
25
Hello, i made a translate system for my skript, and i want to send a function in a message :

the function :
code_language.skript:
function Translate(p: player, msg-fr: text, msg-en: text) :: text:
    return "%colored {_msg-%{language.%{_p}%}%}%"

I have this (its work !)
code_language.skript:
open virtual chest inventory with size 4 named "%Translate({_p}, ""{@gui_prefix} &7» &fBuches pleines"", ""{@gui_prefix} &7» &fLogs"")%" to {_p}
This line work, and return the good translate for name of gui !

But when i want some variables in the text (so add %%) it doesnt work :
exemple :
code_language.skript:
set slot 27 of current inventory of {_p} to sign named "&6&lINFORMATIONS" with lore "%Translate({_p}, ""||&7Couche selectionée &8&l» &f&o%{btl.snow-layer.status.%{_p}%}%"", ""&7Selected Layer &8&l» &f&o%{btl.snow-layer.status.%{_p}%}%"")%"
 
What exactly doesn't work... is it what it returns or does the function not trigger?

Try removing the || after Translate({_p}. But, I'm not sure what exactly your issue is, so please be more specific on which part doesn't work.
 
Is it the return of text with variable does not work,
when i make only text, it work perfectly (example 1) but i can add a variable (example 2),
i think its a problem with % sign but im not sure

(i remove ||, and don't change anything :/)
 
The issue is you can't use variables in escaped strings for whatever reason. For doing such a thing you would need to set it on another line. In this case you don't need to put it in a string because the function already returns one so you can just do it in one line
 
Status
Not open for further replies.