VarScript
[VarScript]
Scripting on Groovy
Version: 1.0.0
Features
- execute scripts on Groovy
- create and run script files
- autorun files
- Tab-completion (not full-featured)
- script can register events and timers. Full access to Bukkit API and other plugins
Get Started
- Download VarScript.jar and put it to
plugins/
directory - Start server
- Wait until VarScript download dependings
- use command
/>
for example:
/> println "Hello ${worlds*.name}"
Basic commands
/> script...
- run script
- Example:
/> test.groovy
/> filename arg1, arg2, ...
- run script file with parameters
/ws list
- show all workspaces
/ws set name
- set new workspace
/ws stop ?name
- stop all triggers in workspace (selected or current)
/ws remove ?name
- remove workspace (selected or current)
/ws create name
- create new workspace
/ws reload ?name
- reload workspace (selected or current)
Script files
You can create script file in directory plugins/VarScript/scripts/
and run it by command
< todo: tutorial >
Static variables
variable | description | type |
---|---|---|
me | current command sender | Player, Block, Entity, Console |
server | bukkit server | org.bukkit.Server |
this | current script | ? extends ru.dpohvar.varscript.workspace.CallerScript |
workspace | current workspace | ru.dpohvar.varscript.workspace.Workspace |
global | workspace service | ru.dpohvar.varscript.workspace.WorkspaceService |
%player name% | get player by name | org.bukkit.entity.Player |
%plugin name% | get plugin by name | org.bukkit.plugin.Plugin |
%world name% | get world by name | org.bukkit.World |
%script name% | run script file and get result | ? |
Wiki
https://github.com/DPOH-VAR/VarScript/wiki
Changelog
VarScript 1.1.2:
- fixed classloader.
- fixed auto-import in config
- fixed Grape config
VarScript 1.0.0:
- 1.X release
older versions | Github | Maven |
@DPOHVAR
Hello, I have a question, when I download the plugin, no ScriptEngine comes and I put the Nashorn, but for the groovy, which I have to download?.
In reply to Itz_Nigh:
@DPOHVAR Hi! You know, that I think your plugin is the greatest tool for bukkit. But why you don't demonstrating your fantastic scripts for VarScript here? Like this one: http://fromgate.me/2015/07/22/pandoras-box-or-chewing-chests/
I think you must create a script library - it will made VarScript more famous and popular.
@DPOHVAR
Perfect ! Thanks a lot !
@monowii
http://dev.bukkit.org/bukkit-plugins/varscript/pages/workspace/events/
I'm unable to register an custom event in JavaScript. Do you have any example ?
@TheKitsch
Try this command:
/g> workspace.runScript(me, "http://pastebin.com/download.php?i=xEQL21dF".toURL().text, "groovy")
URL: http://pastebin.com/xEQL21dF
@DPOHVAR
The chat color import worked. I guess I was importing wrong was the problem. I tried | import org.bukkit.ChatColor | which is how I was doing it. Guess it was wrong. Though I am quite unfamiliar with how java script works. You should talk about importing other classes in the Bukkit API tutorial. Would be usefull
Would love the tutorial on pastebin.
That sucks that the space before the line is a bukkit problem.
Thanks for answering all my questions! Im extremely thankful. Is a great way to get an intro to designing plugins, and I've been wanting a plugin like this for about a year now, and didn't find yours until recently.
Keep up the good work, and keep making these insanely amazing plugins!
@TheKitsch
ChatColor
You need to import class org.bukkit.ChatColor or use full name.
what engine are you using? Rhino or Nashorn?
rhino:
importPackage(org.bukkit)
nashorn:
ChatColor = org.bukkit.ChatColor
Also is it possible to make the plugin get scripts from PasteBin?
Yes, it is possible. Perhaps I'll write about it in one of the tutorials
space at the front of the link
It is a bukkit feature
UPD:
/js> print("\u00A7aTEST")
should work/js> me.sendMessage("\u00A74REDTEXT")
I've been trying to use the bukkit api in this, and I can't seem to get the ColorCode class to really work.
Im doing | /js> print(ChatColor.YELLOW + "test") | and it doesn't work. ChatColor.YELLOW should represent "\u00A7e" but all it gives is an error. It does work with using \u00A7e though. http://puu.sh/8ahIy.png is the error message that comes up.
Is the ChatColor Class just not working with your plugin, or am i just doing something wrong?
Also is it possible to make the plugin get scripts from PasteBin? Would be a really nice feature.
EDIT:
I also found a bug. When you do a break like '/n' it puts a space at the front of the link, so "test \nspace" would result is a space being in the front of a the second line. http://puu.sh/8aBqz.png
Been using your PowerNBT mod for a while now, and finally discovered your other mods. They're just so amazing.
Like bobberto7 said, I would love some tutorials on this though.
@DPOHVAR
Thank you, and I love your server mods <3.
@bobberto7
I'll make tutorials soon ;)
@DPOHVAR
Can you make a tutorial please?
@mistermsk
groovy only simplifies the getters and setters
all the documentation here: http://jd.bukkit.org/rb/apidocs/
available variables:
me - command sender
server - bukkit server
%Plugin name% - get plugin by name
%Player name% - get player by name
UPD:
you can also record events, but this feature does not work well yet in 0.6.x
as soon as I finished, I will write a guide
Great job on plugin. I was just wondering if there is a list of variables for Groovy and JavaScript in a easy to get to page on a website?
I saw javascript: server.shutdown() server.getPlayer("Player").setHealth(0)
Groovy: me.health = 0
VarScript 0.6.1 tested with:
OK.
OK (default javascript engine for Java 7)
Can not set variables
Can not read and set variables
OK.
for scripts and libs only.
for scripts only. Can not read and set local variables.
Can not set local variables (default javascript engine for Java 8 )
Can not read and set local variables
@DPOHVAR
Is 0.6 ready for testing? If you don't mind I'd love to give it a try.
@DPOHVAR
Okay, thanks. Sounds awesome!
@TBotV63
VarScript 0.5.7 can work with Bukkit 1.7
groovy and javascript works fine, but some VS commands do not work.
I make VarScript 0.6 without varscript syntax
It will only work with the script engines
And now plugin version will not depend on the bukkit version
Of course, if you want, you can stay on version 0.5.7