1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT??:

    You can always check our our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Skript-mirror

Discussion in 'Skript' started by Scholler, Sep 24, 2018.

Thread Status:
Not open for further replies.
  1. S

    Scholler Well-Known Member

    Joined:
    Aug 6, 2018
    Messages:
    103
    Likes Received:
    5
    Hello, I have a problem with skript-mirror v 0.19.1

    Import (and soo much other stuff) not working.

    For example:
    Code (Skript):
    1. on script load:
    2.     import "java.lang.System"
    3.     import "java.lang.Runtime"
    Error:
    Can't understand this condition/effect: import "java.lang.System"
    Can't understand this condition/effect: import "java.lang.Runtime"

    I just wanted to try this addon but it's not working:c
     
  2. Efnilite

    Supporter

    Joined:
    May 12, 2018
    Messages:
    218
    Likes Received:
    14
    Medals:
    With newer versions this is not how you import stuff
    Code (Skript):
    1. import:
    2.     ... classes
    3.  
    Code (Skript):
    1. import:
    2.     org.bukkit.entity.Player
    is an example
     
    • Agree Agree x 1
  3. S

    Scholler Well-Known Member

    Joined:
    Aug 6, 2018
    Messages:
    103
    Likes Received:
    5
    Thank you :emoji_slight_smile:
    Can you tell me what's wrong with this? I wanted to try this, its a script to shut down a computer (It's not mine, just saw this somewhere)
    Code (Skript):
    1. set {_os} to {System}.getProperty("os.name")
    2.         if {_os} contains "windows":
    3.             set {_command} to "shutdown -s"
    4.         else:
    5.             set {_command} to "shutdown"
    6.         {Runtime}.getRuntime().exec({_command});
    this is the error:
    Can't understand this condition/effect: {Runtime}.getRuntime().exec({_command});

    I want to learn because... As you can see, I'm a noob at this java programming..

    And sorry for my bad english
     
  4. Efnilite

    Supporter

    Joined:
    May 12, 2018
    Messages:
    218
    Likes Received:
    14
    Medals:
    Uh. you didn't set {Runtime}..?
    Use `as` to import stuff: eg.
    Code (Skript):
    1. import:
    2.     java.lang.System as TheSystem
    so you can use
    Code (Skript):
    1. TheSystem.getStuff().doStuff()
     
  5. S

    Scholler Well-Known Member

    Joined:
    Aug 6, 2018
    Messages:
    103
    Likes Received:
    5
    Code (Skript):
    1. import:
    2.     java.lang.System as System
    3.     java.lang.Runtime as Runtime
    Code (Skript):
    1.  
    2.         set {_os} to {System}.getProperty("os.name")
    3.         if {_os} contains "windows":
    4.             set {_command} to "shutdown -s"
    5.         else:
    6.             set {_command} to "shutdown"
    7.         Runtime.getRuntime().exec({_command});
    ugh not working.. Never mind, I don't really need this:emoji_grinning:
     
  6. Efnilite

    Supporter

    Joined:
    May 12, 2018
    Messages:
    218
    Likes Received:
    14
    Medals:
    You're still using {System} not System. You didnt set {System} var...
     
    • Agree Agree x 1
  7. S

    Scholler Well-Known Member

    Joined:
    Aug 6, 2018
    Messages:
    103
    Likes Received:
    5
    Thank you.
     
    #7 Scholler, Sep 24, 2018
    Last edited: Sep 30, 2018
Thread Status:
Not open for further replies.
Loading...