#Scripting plugin

1 messages · Page 1 of 1 (latest)

sand pendant
#

.

#

It would look something like this

Coords coords = arg1
Bool cobblestone = arg2

//pos1 coords
coords.x = coords.x - 10
//pos2 coords

if cobblestone
  //set cobblestone
else
  //set stone
#

In a more complex form

hazy cradle
#

yeah for that you would need an environment, a lexer, parser and a syntax tree

#

just to make exactly that possible

sand pendant
#

Yep

#

But it would be a pretty simple language in general

hazy cradle
#

that doesnt matter

#

you would also have much fun with the memory management

#

what about security, what is the user allowed to do? what can he do what you didnt noticed

sand pendant
#

In other cases you could also just have things like

//replacenear 50 "dirt <air" grass_block
//replacenear 50 "dirt <grass" grass_block
//pos1 ~-10 ~ ~-10
//pos2 ~10 ~ ~10
//set stone
sand pendant
sand pendant
#

It wouldn't be a language at first, it would just be saved command bundles

hazy cradle
#

saved?

#

so nothing modular

sand pendant
#

Wdym by modular in this context?

hazy cradle
#

being able to use whatever you like, or what do you mean by saved

sand pendant
# hazy cradle being able to use whatever you like, or what do you mean by saved

You would do /script create my_script, which would bring up a book GUI. You write the commands in the book. When you close the book, the plugin saves the script to a file called my_script.someextension. Then, you call /script run my_script and it runs the script. You can also do /script edit my_script which will load it back into the book for editing.

#

Alternatively, you can make a script by directly adding a file with the desired name

#

As you can tell I am using the term "script" pretty loosely here - the functionality would start out simple and then be expanded upon over time

hazy cradle
#

so not a script but just a batch of commands

sand pendant
#

Yeah in that case yes

hazy cradle
#

you can just get the lines of the book and loop over them

#

and execute the command as the player via #chat

#

and only would need to do some post correction like "hey, this command is not possible"

sand pendant
#

I guess I should've said "batch file" rather than "script" but I'd like it to eventually evolve into a scripting language

hazy cradle
#

i would do it step by step

sand pendant
#

Should I call it BiblioScript or BatchBook lol

hazy cradle
#

first just a batch of commands, publish it, await feedback.
then add some syntax like

EXEC command
GO
EXEC command
WAIT 10s

#

batchbook sounds good

sand pendant
#

K

#

@hazy cradle any recommendations for file extension