ScriptCraft
ScriptCraft lets you create your own mods using Javascript. ScriptCraft uses the CommonJS module system (the same module loading system used by Node.js) so managing your code will be easier. You can also run Javascript code on the in-game command prompt or extend the game by writing plugins that use the Bukkit API in javascript.
Examples:
At the command prompt type:
/js 1 + 1
> 2
... Any javascript code can be evaluated at the in-game command prompt.
/js alert( 'Hello ' + self.name )
> Hello walterh
... Special bukkit variables are available via javascript , for example the server object is the instance of org.bukkit.Server . Writing event handlers in ScriptCraft is relatively easy...
events.blockBreak( function( event ) {
echo(event.player, 'You broke a block!' );
});
events.playerJoin( function( event ) {
echo( event.player, 'Welcome to the server!' );
});
... Any bukkit event can be handled. The above code prints the name of any player who breaks a block in the game. ScriptCraft comes with some built-in functions to make building easier...
/js box( blocks.wool.black, 4, 9 , 1)
... creates a 2001 Monolith 4 blocks wide by 9 blocks high by 1 block long.
The full bukkit API can be used via javascript to write new mods. Yes - you can write bukkit plugins in javascript! See ScriptCraft on GitHub for more information. Full documentation is available on the github docs page.
A Youtube Video demonstrating Exploding Arrows in ScriptCraft A Youtube video demonstrating a mini-game (SnowBall Fight)
-
View User Profile
-
Send Message
Posted Aug 15, 2013Nevermind I got it to work somehow, I edited something and it worked :)
One last thing though. How do I remove a block from a world?
-
View User Profile
-
Send Message
Posted Aug 15, 2013@walterhiggins
Is there a way to make that script work in the .js files because it is still showing the same error. I still don't understand :P
-
View User Profile
-
Send Message
Posted Aug 14, 2013@kevcraft
Hi @kevcraft,
There's a google group for ScriptCraft here ... https://groups.google.com/forum/?fromgroups#!forum/scriptcraft---scripting-minecraft
At the in-game console (not the server console), try this...
/js var block = self.world.getBlockAt( x, y, z)
-
View User Profile
-
Send Message
Posted Aug 14, 2013Does ScriptCraft have a forum, if it doesn't it will be awesome to have one and have people share their scripts and get help :)
Scriptcraft is awesome and I'm new to javascript. I made a couple of function for my own server, but It takes me a long time for me to figure out how to get certain things. I follow this http:jd.bukkit.org/rb/doxygen/index.html and it helps me find good stuff. Right now I'm having trouble getting org.bukkit.world.getBlockAt(int x,int y,int z) to work it says in my console :
: this is probably a rookie error, but I want to know how to get those stuff. :D
P.S. Thanks really for the quick response on that other stuff I didn't think that you were still active :o
-
View User Profile
-
Send Message
Posted Aug 7, 2013@kevcraft
Hi, The logging messages have been removed in the latest upload.
Walter
-
View User Profile
-
Send Message
Posted Aug 6, 2013@kevcraft
Hi, Sorry about that logging message. I'll post an update later today.
Walter
-
View User Profile
-
Send Message
Posted Aug 6, 2013How can I disable the automatic loading of the mods that are already there. I want to delete them because they are showing errors, a lot and the one that give you the coordinates of the block you broke is kind of annoying lol
-
View User Profile
-
Send Message
Posted Jun 15, 2013Hi,
I just moved from mineos+ craftbukkit-1.5.1-R0.1 to freebsd running craftbukkit-1.5.2-R0.1 On the old server everything was working fine but now the plugin stopped working generating the following error right after creating the js-plugins folder with succes:
Freebsd does have a different file structure than mineos+ but the js-plugins folder is created in the right place and when restarting the server the plugin is not trying to create the js-plugins folder again.
Regards Werner
-
View User Profile
-
Send Message
Posted Mar 31, 2013<<reply 1358689="">>
Hi Cherbert, I've added a http.request() function to ScriptCraft. See https://github.com/walterhiggins/ScriptCraft/blob/master/docs/api.md#httprequest-function
-
View User Profile
-
Send Message
Posted Mar 29, 2013Perfect. Just the thing i'm looking for. Actually most plugin on bukkit could've been written in the javascript which way more flexible in writing and deploying. But debugging an embedded js is always a pain in the b.
-
View User Profile
-
Send Message
Posted Mar 24, 2013Thanks for the fast replies but no offence, if I understood Java I wouldn't be using ScriptCraft. Can you possibly post a quick usage example in ScriptCraft/Javascript?
-
View User Profile
-
Send Message
Posted Mar 24, 2013<<reply 1358608="">>
@cherbert, sure - use the java.net classes to post and request over HTTP. see http://docs.oracle.com/javase/tutorial/networking/urls/readingWriting.html
-
View User Profile
-
Send Message
Posted Mar 24, 2013Since XMLHttpRequest isn't available is there any way you can make available functions to post and get data from a remote PHP server?
Unless there is another way that can be made to store and retrieve data from MySQL if we so desired? This would really open up huge possibilities for me.
Also there seems to be a problem using color codes using sendMessage(). The color change happens ok but I get a wierd Á character against every color change in the text output.
-
View User Profile
-
Send Message
Posted Mar 24, 2013<<reply 1357555="">>
Hi ,
To add money to your own account...
/js self.performCommand("money -g {your-name} 100");
You can use the Player.performCommand() method to perform any command available to players. e.g. Assuming there's a player called 'JohnDoe' connected...
var johnDoe = server.getPlayer("JohnDoe");
johnDoe.performCommand("money -g {name-of-player-to-give-money-to} 50");
-
View User Profile
-
Send Message
Posted Mar 24, 2013<<reply 1357555="">>
Good Question! I'll do some digging and see if iConomy has an API.
-
View User Profile
-
Send Message
Posted Mar 24, 2013Is there any example anywhere of adding/deducting money from a players iConomy account? Is this even possible using ScriptCraft?
I have only just discovered this wonderful plugin!
-
View User Profile
-
Send Message
Posted Mar 12, 2013@cadika_orade
Hi @cadika_oracle,
I'm not sure that dev.bukkit.org supports forum-type pages. There is a google group for this plugin ...
https://groups.google.com/forum/?fromgroups#!forum/scriptcraft---scripting-minecraft
If there's a way for plugin-authors to set up forums for their plugins here, I haven't found it. Any pointers?
Walter
-
View User Profile
-
Send Message
Posted Mar 11, 2013Love this plugin. Could the Author add a forum page here so that users can exchange scripts and discuss the possibilities for new scripts?
Also, if it possible to make a terrain generator with this?
-
View User Profile
-
Send Message
Posted Mar 11, 2013@victor2748
No, but you can probably use any in-game sound you need.
-
View User Profile
-
Send Message
Posted Feb 22, 2013WoW *_*