Solved Read the item on an itemframe

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

mrxqware

Member
Apr 19, 2017
17
0
0
23
Hi peeps,

I would like to make a player click an itemframe with an item and then it will broadcast the item.

I tried this one already with ExtraSK:

Code:
on right click:
    if the shown item on targeted entity is stone:
         broadcast "It is a stone!" (idk if I can use %targeted entity%)

But the code doesn't work at all, idk if ExtraSK still works.

Does anyone know a way how to accomplish this?
 
https://skunity.com/search?search=targeted block#

I don't know if this will help:

code_language.skript:
on right click on a item frame:
    set {_iframe} to targeted entity
        if the shown item on {_iframe} is stone:
            broadcast "It is a stone!"

Or maybe this:

code_language.skript:
on right click on a item frame:
    make player execute command "/targeted"

command /targeted:
    trigger:
        if the shown item on targeted entity is stone:
            broadcast "It is a stone!"

Maybe the problem is the use of shown item inside a "on right click" event. I don't know.
 
https://skunity.com/search?search=targeted block#

I don't know if this will help:

code_language.skript:
on right click on a item frame:
    set {_iframe} to targeted entity
        if the shown item on {_iframe} is stone:
            broadcast "It is a stone!"

Or maybe this:

code_language.skript:
on right click on a item frame:
    make player execute command "/targeted"

command /targeted:
    trigger:
        if the shown item on targeted entity is stone:
            broadcast "It is a stone!"

Maybe the problem is the use of shown item inside a "on right click" event. I don't know.

Thank you for your answer.
I keep getting stuck at this point/error:

Code:
Can't compare 'the shown item on targeted entity' with an item type (frameshop.sk, line 6: if the shown item on targeted entity is stone:')
 
Try this:
code_language.skript:
    on right click on a item frame:
        set {_frameitem} to the shown item on targeted entity
            broadcast "%{_frameitem}%" #debug, to see what the heck is set in the variable
            if {_frameitem} = stone:
                broadcast "It is a stone!"
 
  • Like
Reactions: mrxqware
Try this:
code_language.skript:
    on right click on a item frame:
        set {_frameitem} to the shown item on targeted entity
            broadcast "%{_frameitem}%" #debug, to see what the heck is set in the variable
            if {_frameitem} = stone:
                broadcast "It is a stone!"

gives the following error:

Code:
Can't understand this expression: 'the shown item on targeted entity' (frameshop.sk, line 2: set {_frameitem} to the shown item on targeted entity')

I will try another ExtraSK version idk if that could fix it. ExtraSK loaded without problems, but it's weird that the expression doesn't work
[doublepost=1496515559,1496515042][/doublepost]@aescraft it worked!!!!! I had the wrong plugin/version, thanks alot for your help.
 
However the code does something, I can't use it with itemframes placed under eachother. It only detects the lower row of frames. Is there a way to get a better output?
 
Status
Not open for further replies.