Skip to content
This repository was archived by the owner on May 6, 2018. It is now read-only.

Conditioned aliases/options #364

Open
Tsugaga opened this issue Dec 18, 2014 · 11 comments
Open

Conditioned aliases/options #364

Tsugaga opened this issue Dec 18, 2014 · 11 comments

Comments

@Tsugaga
Copy link

Tsugaga commented Dec 18, 2014

It would be awesome if aliases and options could be set based on certain conditions.

@MostFunGuy
Copy link

I've 0 idea what you mean, can you explain? If you want changable options, use variables

I've no idea what you want with changable aliases

@Tsugaga
Copy link
Author

Tsugaga commented Dec 21, 2014

Variables as options work, but they are less neat and less practical, and they aren't useful for aliases.

options:
..if condition:
....option1 = "stuff"
....option2 = "stuff"
..if else:
....option1 = "stuff2"
....option2 = "stuff2"

Same with aliases. I have many servers that all use the same scripts, and instead of every server having duplicated files, all script folders are linked to 1 central server instead, so they all load the same script folder. This is so I don't have to add/remove/edit scripts on 10 different servers every time I change something. This doesn't work with some of my scripts that use some aliases/options which vary between servers, so I'd like to be able to do:

aliases:
..if {serverID} = "server1":
....customBlock = 560
..else if {serverID} = "server2":
....customBlock = 790

This way I can still have just 1 central file but have the aliases/options conditioned for each server.

@MostFunGuy
Copy link

The options section is directly what variables are used for :P You can set them, or just use them :-) I use an "On script load" event to load up variables as the script gets reloaded. Something like:

on script load:
set {serverstuff::currentserver} to "KitPVP1"
set {var::thisotherthing} to "thatotherthing"
set {var::etc} to "etc"
set {var::etcetc} to "etcetc"

The centralized skripts thing is good, I tried and failed to do that before, how are you doing it? We had 5 machines and were running a cron job to mirror the folders across multiple machines, but kept running into security issues and it getting rejected on certain machines each time.

@Tsugaga
Copy link
Author

Tsugaga commented Dec 21, 2014

Yeah I know I can use variables for options and that's how I set them too, this is mainly for aliases though. Using a banned items script as an example, on different modpacks the "BannedItem" alias is different since each pack as different items with different IDs. Currently I have that script duplicated on each server with separate settings, which is a pain, I'd like to have it in my central script folder and just have it set the alias based on which server is loading it.

Not sure about multiple machines, but I just have one linux server, and I centralized the scripts by creating a symbolic link in every mc server script folder which links to the central scripts folder so they share all of the files in it.

@ismooch
Copy link

ismooch commented Dec 21, 2014

I have a centralized AND local script folder for each machine.. While i can
see what OP wants being useful, i think the implementation of options would
make it difficult to be efficient. Options are simply pasted in their
appropriate areas upon compiling.. Meaning that if a variable changed after
that script has been loaded, it would need to be reloaded for the
conditionals to run and replace respectively. Im not saying it wouldnt be
useful. Honestly, anyone with a multiserver setup and a centralized script
folder would probably find use in this.
On Dec 21, 2014 5:08 AM, "MostFunGuy" [email protected] wrote:

The options section is directly what variables are used for :P You can set
them, or just use them :-) I use an "On script load" event to load up
variables as the script gets reloaded. Something like:

on script load:
set {serverstuff::currentserver} to "KitPVP1"
set {var::thisotherthing} to "thatotherthing"
set {var::etc} to "etc"
set {var::etcetc} to "etcetc"

The centralized skripts thing is good, I tried and failed to do that
before, how are you doing it? We were running a cron job to mirror the
folders across multiple machines, but kept running into security issues and
it getting rejected.


Reply to this email directly or view it on GitHub
#364 (comment).

@MostFunGuy
Copy link

Hello Smooch long time no see <3

@MostFunGuy
Copy link

How are you guys mirriring the folders?

@Tsugaga
Copy link
Author

Tsugaga commented Dec 21, 2014

I'm not mirroring anything, I told you I'm using a symbolic link. A symbolic link points a directory to another directory, basically linking them. If you have server1/plugins/Skript/scripts/LinkedScripts and you create a symbolic link in server2/plugins/Skript/scripts named "LinkedScripts"(link name can be anything) to server1/plugins/Skript/scripts/LinkedScripts, then any scripts in the LinkedScripts folder on server1 will be loaded by server2 because it's linked to server1.

@MostFunGuy
Copy link

Like this?

http://help.hardhathosting.com/question.php/95

So the server will act like the symbolically linked folder is apart of it's own directory and load the skripts from the central location?

@Tsugaga
Copy link
Author

Tsugaga commented Dec 21, 2014

Yes and yes.

As far as file permissions go, the symlink permission doesn't matter, but the server will need permission to the files inside the linked folder.

@ismooch
Copy link

ismooch commented Dec 22, 2014

@MostFunGuy yeah.. I still lurk around :P. And symbolic links will work On single machine.. But to have the same folder shared across multiple physical machines, it requires publishing/sharing the folder and then mounting it on the other machine. A little tricky.. But works nice once you get it set up.

DISCLAIMER

I can only confirms that this work with linux servers.. If you are working on a windows server (why?) i cant gurantee anything.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants