Executing Skript from String

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

Zeminor

New Member
May 4, 2024
6
0
1
24
Basicly i want to run skript code from Java String

Im getting Skript from AI that i want to use in runtime

"command /drag:
trigger:
spawn a entity of type dragon at location of player
... other lines of skript
"
 
For one thing, using AI for skript is a terrible choice.


For two, why would you need skript in java? Skript is written in java, so afaik anything that Skript can do, java can do aswell.
 
For one thing, using AI for skript is a terrible choice.


For two, why would you need skript in java? Skript is written in java, so afaik anything that Skript can do, java can do aswell.
My idea is to allow friends making their own Super Items and Use it in a fight
I have GeminiAiRequestHandler and i can send requests with system instruction for example

Prompt:
I want a rideable dragon that attacks everyone except me by spawning fireballs
Result:
code_language.skript:
on rightclick on entity:
    if event-entity is a dragon:
        if player is riding event-entity:
            cancel event
            set {cd} to 0
on timer:
    loop all entities:
        if loop-entity is a dragon:
            if {cd} is 0:
                loop all players:
                    if loop-player is not riding loop-entity:
                        shoot fireball at loop-player from loop-entity
                set {cd} to 20
            else:
                remove 1 from {cd}
                
command /ride [<entity>]:
    trigger:
        if arg-1 is set:
            make player ride arg-1
        else:
            make player ride dragon
I dont know if that skript working but you can change prompts and make it more clean for ai to represent
 
For one thing, using AI for skript is a terrible choice.


For two, why would you need skript in java? Skript is written in java, so afaik anything that Skript can do, java can do aswell.
The problem with generating java code is to add Bukkit and other dependencies to the compiler because Java is compiled language and not Runtime so you can't just execute code with Bukkit Player you need firstly compile this code with Bukkit and other stuff
 
My idea is to allow friends making their own Super Items and Use it in a fight
You can just use an existing plugin like ExecutableItems, which makes making custom op items easy.


Or just like...use Skript on your server?
The ai code you sent is awful lol
 
You can just use an existing plugin like ExecutableItems, which makes making custom op items easy.


Or just like...use Skript on your server?
The ai code you sent is awful lol
Is there any way to run skript from text?
or i need to create file with that script in other plugin folder and run it using like skript load command
or is there a wiki for skript api maybe

Using Executable Items is horrible in my situation
1. you need to buy for full version
2. limited options because never used it before
3. its take hours to make good item + you need to know some minecraft command and other stuff
 
It doesn't take hours and the full version isn't too worth it anyway.

Using java file tools it might be possible to use java to make a skript file, write in it, and reload it.
Here's the link to the API documentation https://en.njol.ch/projects/skript/API, but again, at this point, just use skript. You can use PAPI and skript-placeholders to link some stuff from the skripts into your plugin if necessary but I really don't see why you would need to use this. If they're just making super items, using skript alone is fine.

Why are you against just installing the plugin if you're trying to use the API and syntax anyway?
 
It doesn't take hours and the full version isn't too worth it anyway.

Using java file tools it might be possible to use java to make a skript file, write in it, and reload it.
Here's the link to the API documentation https://en.njol.ch/projects/skript/API, but again, at this point, just use skript. You can use PAPI and skript-placeholders to link some stuff from the skripts into your plugin if necessary but I really don't see why you would need to use this. If they're just making super items, using skript alone is fine.

Why are you against just installing the plugin if you're trying to use the API and syntax anyway?
How do you think someone who opened menus only to select a game can create good item in ei and i just want expirience and funny mini game

Didn't find anything in that link so i have to make That System

I have skript installed but i thought creating file in other plugin just bad because you're using another plugin folder when theres api for it
 
Why would it be bad if you're using skript syntax anyway-


I really don't get the point of this thread.
I wanted to see something like

SkriptExecutor.createSkript(String)

or how to read and execute skript