Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: effect "add/remove (scoreboard) tag" #346

Closed
jaylawl opened this issue Jan 18, 2017 · 15 comments
Closed

Suggestion: effect "add/remove (scoreboard) tag" #346

jaylawl opened this issue Jan 18, 2017 · 15 comments
Labels
completed The issue has been fully resolved and the change will be in the next Skript update. enhancement Feature request, an issue about something that could be improved, or a PR improving something. priority: medium Issues that are detrimental to user experience (prohibitive bugs or lack of useful implementation).

Comments

@jaylawl
Copy link
Contributor

jaylawl commented Jan 18, 2017

As of minecraft 1.9+, we are able to save (custom!) tags in the NBT data of players or any other entities. The limit for custom tags per entity is 1024 to my knowledge, but it may be even higher than that.

This is how you add tags by vanilla commands:
minecraft:scoreboard players tag <player/uuid> <add/remove> <any custom tag here>

The same is currently possible with the SkStuff add-on, and checking for the existance of a tag in an entities NBT isn't too bad:

on some event:
    if "%tag ""Tags"" of event-player's nbt%" contains "1337"
        # code

However when we get to adding tags using SkStuff, it gets a bit more complicated, because the dataTag "Tags" is a compound list ... >_> Here's how i currently do it, but im new to Skript and i'm sure there's easier ways to achieve the same effect:

set {_tags} to tag "Tags" of event-player's nbt
replace "[" and "]" and in {_tags} with ""
set {_tags} to "%{_tags}%,""new tag"",""another new tag"""
add "{Tags:[%{_tags}%]}" to event-player's nbt

Q: "Why don't you just use variables?"
A: Because variables are virtually useless for non-player entities unless you install 10000 add-ons. Kinda.

Cheers for reading this

@TheBentoBox
Copy link
Member

I can attest that this would be very useful, as I have developed an API script to give me easy access and manipulation of scoreboard tags, and I now use it VERY extensively on my server. It helps a lot when variables are a pain to use, allowing you to store (text) data relevant to a mob across restarts without any issue, which is automatically "garbage collected" when a mob dies.

For now, you can access my API on the SkUnity forums here, and it should do exactly what you want. But I definitely agree that inherent Skript support would make sense and would be very useful.

For Bensku: here's the commit where scoreboard tag support was added. Should be very simple.

@TheBentoBox TheBentoBox added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. enhancement Feature request, an issue about something that could be improved, or a PR improving something. and removed bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. labels Jan 18, 2017
@TheBentoBox
Copy link
Member

(oops mislabelled cause I'm so used to bug reports!)

@jaylawl
Copy link
Contributor Author

jaylawl commented Jan 18, 2017

Oh yeah! Totally forgot about the aspect of garbage collection, which is indeed a very huge plus for this. So glad i'm not alone on this! 👍

Thanks for redirecting me, i'm gonna grab some coffee and check that API out :)

@jaylawl
Copy link
Contributor Author

jaylawl commented Jan 21, 2017

@TheBentoBox, i can't really figure out how to send private messages on here, but i had to thank you for showing me your tag api right there. It finally taught me how to create my own functions using skript, something i couldn't figure out before or find any tutorials about. :) So i basically just recreated the whole thing, but with some key differences here and there. Here's the code if you wanna take a look at it: https://hastebin.com/uwijizetus.vbs

So: thanks!

@TheBentoBox
Copy link
Member

@TheLimeGlass : potential to port this from Skellett to vanilla Skript with a PR? I think this sort of thing would make sense in vanilla Skript but of course it's up to you if you want to submit a PR for it. You'd make the most sense to do it given you've already coded it once for your addon.

@TheLimeGlass
Copy link
Collaborator

TheLimeGlass commented Feb 27, 2017

@TheBentoBox Scoreboard tags are only for Spigot 1.11+ and I know Bensku try's to use features that work between 1.9-1.11. @bensku Your thoughts?

@bensku
Copy link
Member

bensku commented Mar 4, 2017

Scoreboard stuff... This is not likely to happen anytime soon. Of course a pull request with this would be awesome.

Note that anything that makes Skript as plugin not work on 1.9 will not be merged. However, 1.11 specific features are ok, as long as they are cleanly disabled on older versions.

@TheLimeGlass
Copy link
Collaborator

@bensku These are just scoreboard tags. It acts like metadata on entities. Another way to save data against entities.

@Syst3ms
Copy link
Contributor

Syst3ms commented Mar 5, 2017

Tags stay cross-restart, too, as they are saved in the level.dat file. If we used NMS (reflection or abstraction), we would have a system working from 1.9 to 1.11. But maybe it's better using spigot. Also, tags were added in 1.9.

@TheBentoBox
Copy link
Member

I'd say on this one it's best to use just the Spigot API without reflection, meaning they'd only be accessible on 1.11.2+. That's the price people pay for being on lower versions.

@Snow-Pyon Snow-Pyon added the priority: lowest "Nice to have" updates that are not required (tiny low impact bug fixes or QoL enhancements). label Jan 31, 2018
@jaylawl
Copy link
Contributor Author

jaylawl commented Jun 30, 2018

Any chance i can be of help (it does say help wanted) without being able to code java? Do some research or something? I whole heartedly believe that this is an underrated addition 💃

@TheLimeGlass
Copy link
Collaborator

@jaylawl You can use metadata which was recently added nearly 1-2 versions ago.

set metadata "tag id" of entity to "data"

if metadata "tag id" of event-entity" is "data":

@TheBentoBox
Copy link
Member

Metadata is not the same because it's not permanent. The point of a tagging system like this is it lets you store data on entities cross-restart. It's incredibly useful and opens up doors for a lot of stuff to be done in Skript more easily, such as an easy entity protection system. IMO it should be of decent priority as far as feature requests go simply given how much it adds.

@bensku bensku added priority: medium Issues that are detrimental to user experience (prohibitive bugs or lack of useful implementation). and removed priority: lowest "Nice to have" updates that are not required (tiny low impact bug fixes or QoL enhancements). labels Jul 5, 2018
@bensku
Copy link
Member

bensku commented Jul 5, 2018

Sure, makes sense.

@jaylawl
Copy link
Contributor Author

jaylawl commented Aug 10, 2018

Just in case anyone is looking for this before it gets added to Skript: https://forums.skunity.com/resources/jaylawls-scoreboard-tagapi.615/

Nicofisi pushed a commit that referenced this issue Aug 27, 2018
@Nicofisi Nicofisi added the completed The issue has been fully resolved and the change will be in the next Skript update. label Aug 28, 2018
@bensku bensku closed this as completed Sep 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
completed The issue has been fully resolved and the change will be in the next Skript update. enhancement Feature request, an issue about something that could be improved, or a PR improving something. priority: medium Issues that are detrimental to user experience (prohibitive bugs or lack of useful implementation).
Projects
None yet
Development

No branches or pull requests

7 participants