Skript: [Suggestion] Loaded add-on conditional syntax

Created on 7 Aug 2018  路  5Comments  路  Source: SkriptLang/Skript

Idea:

I was thinking it would be cool, if there was a condition, that could tell if a certain add-on was loaded, and if it wasn't, it would ignore all syntax written after that condition.

Reason behind this:

A few times, I have written Skripts to post publicly, but though, hey, what if the person downloading doesn't like this add-on, and doesn't want to use this portion of my Skript. (ex. My FlyCard Skript has a scoreboard... one user may not care about the scoreboard, and prefer to not use the Skellett add-on) Well rather than them having to manually delete this section of the Skript, it would just ignore it if the add-on wasn't loaded. As of right now if I have written code, and the add-on isn't there/loaded, then clearly it'll run a ton of errors in the console saying that expression does not exist.

Example:

If addon named "skellett.jar" is loaded:
    #do something
else:
    #do something else
    send "You need Skellett for this Skript to function properly" to console

or

if addon "skellett" is loaded:
    #do something

In the first example if the add-on isn't loaded, it would run something else.
In the second example, it would just ignore the code if Skellett wasn't loaded.

Other Info:

I know that certain add-ons have version numbers, etc in their file names, which could make this harder to make. Maybe rather than just looking for the exact name, maybe look for what's in the quotes (ex: "skellett") would be contained in the name, not just the full name itself.

ex:

if addon with name containing "skellett" is loaded:
    #do something

Just a few ideas of how it could be done.
Thank you for reading :)

enhancement lowest

Most helpful comment

I personally think removing from the other list makes more sense @Nicofisi, it's easier at a glance to see specific suggestions when they're separated instead of in some list within a specific issue, and it'll also generally have more detail on its own post 馃憤

All 5 comments

I think it's possible to get the addon's name without using it's file name (the name is coded in the plugin)

Ah right duh... that makes sense
EDIT: To add to that, i'm just throwing out some ideas here :)

Already mentioned in #1291

Not sure if I should close this or rather remove it from that list

I personally think removing from the other list makes more sense @Nicofisi, it's easier at a glance to see specific suggestions when they're separated instead of in some list within a specific issue, and it'll also generally have more detail on its own post 馃憤

Nico when you said its a duplicate, I guess it half is... See what Im proposing is not just a loaded addon condition, but.... that PLUS skript ignoring the code written after it, if it's not loaded.
Because right now for example, lets say I write

on break:
    #skellett code here

If skellett isnt loaded, it'll give me an error saying that expression isnt recognized.
So my proposal is that Skript would simply ignore the syntax if it the condition was checking for skellett being loaded, and if skellett wasnt loaded, it would ignore the code, and not run error in the console
something like:

on break:
    if addon "skellett" is loaded:
        #Skellett code here
Was this page helpful?
0 / 5 - 0 ratings