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

Proposal: Condition 'script [%text%] is loaded' #797

Closed
TheBentoBox opened this issue Aug 17, 2017 · 6 comments
Closed

Proposal: Condition 'script [%text%] is loaded' #797

TheBentoBox opened this issue Aug 17, 2017 · 6 comments
Labels
enhancement Feature request, an issue about something that could be improved, or a PR improving something.

Comments

@TheBentoBox
Copy link
Member

TheBentoBox commented Aug 17, 2017

The syntax would be something like script [%text%] is loaded. The text can be provided optionally to give the name of a specific script to check its load state, but it will otherwise default to the script the condition is in. This allows for scripts to easily do stuff conditionally based on if another script is currently active, or to do loaded-based loops, e.g.

on script load:
    while script is loaded:
        <code>

Currently, a while loop like this would continue uncontrollably even after unloading unless you use a variable of some variety to track the script's load status (which, granted, is not at all hard, but this looks nicer).

@TheBentoBox TheBentoBox added the enhancement Feature request, an issue about something that could be improved, or a PR improving something. label Aug 17, 2017
@TheBentoBox TheBentoBox changed the title Proposol: Condition 'script [%text%] is loaded' Proposal: Condition 'script [%text%] is loaded' Aug 17, 2017
@ghost
Copy link

ghost commented Aug 17, 2017

I know it's not how it's done in an actual programming language, but for Skript couldn't you just have the script dependencies in the same file? So if you need to depend on a function for the main script to function, you have it in the same file so that it's always available.

@Snow-Pyon
Copy link

Snow-Pyon commented Aug 17, 2017

Of course you can have all your scripts in one big file, but shall I wait 16 minutes for that script to load?

It's known that splitting scripts into different files makes the script loading faster.

@ghost
Copy link

ghost commented Aug 17, 2017

Okay, well I figured it was a better solution if you just needed to depend on a couple functions, but if you need to depend on an entire script file then yes this would be very nice to have. I never suggested you put everything into 1 file.

@bensku
Copy link
Member

bensku commented Aug 19, 2017

I just fixed the bug that caused function calls before function definitions not to work.

Anyways, good idea.

@Pikachu920
Copy link
Member

Pikachu920 commented Aug 20, 2017

Wouldn't it be easier to have the syntax

[script] %text% is loaded

as that still allows you to do

script is loaded

@28andrew
Copy link
Contributor

PR is done, it uses these syntaxes:
script[s] [%-strings%] (is|are) loaded, script[s] [%-strings%] (isn't|is not|aren't|are not) loaded

@bensku bensku closed this as completed Sep 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request, an issue about something that could be improved, or a PR improving something.
Projects
None yet
Development

No branches or pull requests

5 participants