Olyno / skent

Manage your files and folder with Skript
GNU General Public License v3.0
11 stars 2 forks source link

Help with getting the server's port #43

Closed VisoXC closed 10 months ago

VisoXC commented 10 months ago

Describe your problem

I am trying to make a script that gives me the port of the server, but all I'm getting is a error I can't make much of. Since the script is pretty simple it would be cool if you could provide me with a working version of the script. With kind regards, VisoXD

Versions

Skript: Skript v2.7.3 Server: 1.20.4 (git-Paper-370) Skent: Skent 3.2.2

Code

on load:
    set {_port} to line 51 of "server.properties"
    send {_port}

Error

https://pastebin.com/yYS7CKYf

Olyno commented 10 months ago

Hi,

As the error points out, you need a path type to be able to do this. You've given it a string type ("server.properties") is a string not a path).

You can obtain a path using the following expression: https://skripthub.net/docs/?id=8075

Your code must be:

on load:
    set {_port} to line 51 of file path "server.properties"
    send {_port}
VisoXC commented 10 months ago

Thanks for helping me out,

I really couldn't figure out what the problem was XD But I guess everyone starts somewhere.... I got the script to work now, thanks to your help and understand a lot more of your fantastic plugin now too!

I opened a new issue it would be nice, if you could check that out too.

Anyways thanks you very much!