Solved How to use name of clicked item in a 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.

Hackusater

Active Member
Aug 5, 2017
74
2
8
34
I am trying to do somethine like:
code_language.skript:
function EXAMPLE(p: player, c: name of clicked item):
   send "test" to {_p}
   if {_c} is "TEST":
      send "it worked" to {_p}

on inventory click:
      function EXAMPLE(player, name of clicked item)
But I can't and I get the error "Cannot recognize the type of 'name of clicked item'"


How to use name of clicked item in a function?
 
code_language.skript:
function EXAMPLE(p: player, c: string):
    send "test" to {_p}
    if {_c} is "TEST":
        send "it worked" to {_p}
 
on inventory click:
    if clicked item is not air:
        EXAMPLE(player, name of clicked item)
 
code_language.skript:
function EXAMPLE(p: player, c: string):
    send "test" to {_p}
    if {_c} is "TEST":
        send "it worked" to {_p}
 
on inventory click:
    if clicked item is not air:
        EXAMPLE(player, name of clicked item)
Thank you! It worked! But now I am facing another problem. If I do something like:
code_language.skript:
function EXAMPLE(p: player , c: string):
    if {_c} is "TEST":
        give glowstone dust to the {_p}
I get an error saying:
code_language.skript:
Can't understand this condition/effect: give glowstone dust to the {_p}
 
Status
Not open for further replies.