VotifierScripts
VotifierScripts is a plugin that listens for Votifier votes and allows you to run javascript code when a vote is received (allowing for endless possibilities!) This javascript is enhanced with the power of buscript which gives access to many global functions in order to make an easy to use scripting experience. No programming experience is required, but in that case you may find this plugin harder to use than most.
This plugin requires Votifier but already comes prepackaged with buscript.
The latest development builds can always be found at http://ci.onarandombox.com/job/VotifierScripts/
Commands
Currently there's just one command
/vstest <player> [service [address [timestamp]]]
- This command tests the script that is run when a vote is received.
- Permission: votifierscripts.test
- <player> is used to indicate a target for your script. In general, this should probably be someone that is online if you are going to use it.
- The test command will always reload the vote-script.txt file so there is no need to do anything special should you modify the script.
- The other 3 arguments are optional but each one requires using the one before it, so to use timestamp you have to do all 4. These will help you more fully test a vote script.
Scripts
Scripts are text files that contain Javascript code. This may sound scary to people unfamiliar with coding but luckily VotifierScripts provides several easy to use methods for creating basic scripts.
The primary script that is called when Votifier receives a vote is located at plugins/VotifierScripts/vote-script.txt. You will notice this script initially comes with a simple built in sample. Feel free to modify this!
Any script that the primary script runs must be located in plugin/VotifierScripts/scripts and may have any name/file extension you like.
Script Features
- Easy to use global functions including command running, message broadcasting, permission management and more.
- Any string used in these global functions has access to "%target%" which represents the current target of the script. Example: broadcast("Hello, %target%")
- The ability to run another script at a later time with 100% reliability, even if the server crashes!
- Defines the global variable target so more advanced things can be done with the script's target.
- The global variable server is also available which gives direct access to the Bukkit server variable just as if you were working from within a plugin!
Detailed Script Features
Global Functions and Variables
Additional Global Functions and Variables specific to VotifierScripts
Example Scripts
- Simple broadcast/command sample
- vote-script.txt
broadcast("Hey everyone, %target% is a cool guy!") command("op %target%")
- This is a simple script that tells everyone on the server what a cool guy the target (dumptruckman in this case) is and then ops them.
- Timed permission sample
- vote-script.txt
message("%target%", "You have just been given flight in the creative world for 30 minutes!") addPerm("creative", "%target%", "flight.permission") runLater("remove-perm.txt", "30m", "%target%")
- scripts/remove-perm.txt:
message("%target%", "Your flight power has been removed, hope you weren't up there!") removePerm("creative", "%target%", "flight.permission")
- Please note these two scripts require Vault and a Vault compatible permission manager which allows them to work even when the player is not online.
- It is possible to instead use the command() function to run your own permission commands without using Vault.
- Also note "flight.permission" is not a real permission. Your actual flight enabling permission may vary (or not even exist!)
Click Here for more sample scripts
Click Here for script requests
For Developers
Source code: https://github.com/dumptruckman/VotifierScripts
Maven repository: http://repo.onarandombox.com/content/groups/public/
Maven pom information:
<groupId>com.dumptruckman.minecraft</groupId> <artifactId>votifierscripts</artifactId> <version>1.0-SNAPSHOT</version>
You can add your own functionality to the scripts if you so choose. Here's how to hook into VotifierScripts:
Plugin plugin = Bukkit.getPluginManager().getPlugin("VotifierScripts"); if (plugin != null) { Buscript buscript = ((VotifierScripts) plugin).getScriptAPI(); // Do stuff with buscript object, see documentation below }
For more information about the buscript library, visit: http://dev.bukkit.org/server-mods/buscript/
could you add buscripts /run command to this?
@termin8er678
http://dev.bukkit.org/server-mods/votifierscripts/pages/global-functions-and-variables/ You should learn to read.
Sorry for the wait time, but here's the picture cropped out with the "errors": http://i.imgur.com/UnfLs.png
What is the varyable for the acuall voting site aka plannet minecraft. I want it to broadcast that the player voted on pmc or minestatus or ect
@dumptruckman
I tried this, it gives same error. I'll attach a picture in a second so you can see the error. (in an edit)
@dumptruckman
oh, that is weird. Why do i have that old version? haha, thanks for the quick reply ;)
EDIT:
This is what came up this time:
2012-11-03 01:43:51 [SEVERE] Error occurred while enabling VotifierScripts v1.1-SNAPSHOT-b28 (Is it up to date?) java.lang.NullPointerException at com.dumptruckman.minecraft.votifierscripts.buscript.Buscript.initData(Buscript.java:135) at com.dumptruckman.minecraft.votifierscripts.buscript.Buscript.<init>(Buscript.java:119) at com.dumptruckman.minecraft.votifierscripts.VotifierScripts.onEnable(VotifierScripts.java:151) at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217) at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:374) at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:381) at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:272) at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:254) at net.minecraft.server.MinecraftServer.j(MinecraftServer.java:311) at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:290) at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:249) at net.minecraft.server.DedicatedServer.init(DedicatedServer.java:141) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:391) at net.minecraft.server.ThreadServerApplication.run(SourceFile:818
The same thing? Deleted the database to fix it...
EDIT2: Fixed. The issue happens when somebody adds a . or other special characters to his name. Should be simple to fix and ignore those players?
@H8llfire
This is fixed in the latest version! http://dev.bukkit.org/server-mods/votifierscripts/files/9-1-1-snapshot-b28/
Hi there, I occasionaly get this error after a while using VotifierScripts, which forces me to delete the script.bin database, which sucks, cause I use the Votereminder. Otherwise nothing loads up.
2012-11-01 08:18:39 [SEVERE] Error occurred while enabling VotifierScripts v1.0-b21 (Is it up to date?) java.lang.NullPointerException at com.dumptruckman.minecraft.votifierscripts.buscript.Buscript.initData(Buscript.java:126) at com.dumptruckman.minecraft.votifierscripts.buscript.Buscript.<init>(Buscript.java:110) at com.dumptruckman.minecraft.votifierscripts.VotifierScripts.onEnable(VotifierScripts.java:115) at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217) at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:374) at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:381) at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:270) at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:252) at net.minecraft.server.MinecraftServer.j(MinecraftServer.java:311) at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:290) at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:249) at net.minecraft.server.DedicatedServer.init(DedicatedServer.java:141) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:391) at net.minecraft.server.ThreadServerApplication.run(SourceFile:818)
Thanks.
@Diabloste
I believe to get the section symbol to work you need to find the out the key sequence you can enter to produce it. On Windows you hold Alt and type 0167. From what I am reading, on Ubuntu, you can hold Ctrl + Shift and type UA7(Enter). Anyway, I got this from wikipedia: http://en.wikipedia.org/wiki/Section_sign
@TheStriker095
I'm sorry for being impatient, but is anything being done? :)
@Diabloste
Sorry I was a little busy with... life lastnight, I will try to write the script tonight...
@TheStriker095
I am on a windows machine, the server is probably not though. I'm guessing it's linux. You can pm me whenever you're done with the tutorial :)
@Diabloste
The ยง only works if your on a windows machine, however you could create another script. When I am home later I will provide a tutorial.
Can you please please PLEASE do a video tutorial? If not, skype me, teach me, then I'll do one for you.
@Computerichy
Tried that, sadly doesn't work. Instead it makes small square boxes with question marks inside. I can take a screenshot if you haven't seen them before.
@TheStriker095
Seems to work finw when used without the quotes.
clearScripts(target)
It seems that the function:
clearScripts("%target%")
is not working as it is meant to. When this is executed all scripts remain for the user is scripts.bin
For everyone who cannot get colours working in the vote reminder script, or anything else, use this symbol ยง instead of & before a colour ID! I had the same problem and @dumptruckman told me this. Enjoy :D
Hello dumptruckman :)
I'm using your vote reminder script, and I wrote on the thread about it not having colors, yet I haven't received an answer yet. Would it be possible for you to either answer me there or answer me here, on why the script doesn't have any color? I have tried everything, yet it doesn't give any colors, just pure white. (Where the &s are visible, for example:
"&2Remember to vote for the server!"
outputs as exactly that rather than
green color: "Remember to vote for the server!")
Thank you very much!
@LordKainzo
Could not say. Do share if you find out! (It shouldn't be terrible.)
@DeadDino @TheFluffey @EmperorXing3
Are any of you getting errors on startup or at any point in console? These kind of things help to know about.