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/
Hello. I have a question, if this is possible. For the moment my user can only vote on PlanetMinecraft.. They will get 5 diamonds when they vote.. Is it possible to config this settning so if they vote on pmc they got 1 diamond and get a message .. Thanks for voting On PMC. Then if they vote on another site they get.. Thanks for voting on ??
@ItsKohle
Hmm.. You said that you had tried without color codes, so it would probably not be them.
Are you sure that you are editing the right file?
Have you tried just a simle message, like: broadcast("Testificate") or command("say Testificate")
Maybe you have to update/degrade your bukkit build?
Also try dissabling one plugin after eachother incase it would be plugin compactibility issue.
Troubleshooting could help you find the problem :)
@xpopy
I decided to just keep it safe and just issue a command for /say... however, I'm getting the same error that there is an invalid character on line 1: http://pastebin.com/TV8KG18x
Does it not support using color codes with ยง? I can't see why not...
@ItsKohle
Actually it isnt.. I didnt test if before I replied, but
Is working for me. But some plugins, like CommandBook have broadcast as a command. This might(?) be the issue..?
@xpopy
Thank you, the examples aren't correct then...
This plugin needs more functions, specially: getPerm("%target%", "permission node") which will result in a true/fase whether %target% have that permission node.. would love it if you added this :D
@ItsKohle
Broadcast is a command, and should be executed with a command line, like: command("broadcast %target% has voted! Vote for us for 250 Krux! http://bit.ly/XfsLDU")
I'm getting an error that there is an illegal character on line one, I don't see where... http://pastie.org/6031215
At first I tried removing my color codes int he message, but it still gives the same error.
is their a way to make it so it does more then one command per vote?
How can I make it so it randomly give a player 1 of 3 items?
@woodey79
Ask on the Votifier page... You're having issues with it.
Will this work on a 1.4.7 server?
if so, does it matter what version of votifier you use?
P.S.: i am also having a problem setting it up. I have the flatfile vote listener in the vote listeners folder than got votifier scripts plugin. Then and made at cool msg when people vote, but for some reason when you actually vote on the websites it doesnt work. I have set it up on the websites for votifier and it tested succesfully but it still donsnt work for some reson. The command /vstest works fine but it just wont work when ppl actually vote.
Any ideas on how to get it to work?
Error on startup:
http://dev.bukkit.org/paste/6971/
Creating ticket with more detail.
@WiredCraft
It's a plugin... Put it where other plugins go.
Where do I add the Votifier Scripts???????
PLEASE HELP!!!!!!!!!
http://prntscr.com/odyzd
@OgdenCraft
It is still compatible.
When will this plugin be updated to 1.4.6 or will the latest version be compatible?
So I setup the script and it works with vstest, it broadcasts the player voted and gives them their red matter, but only when i do vstest, how do i set this up so when they vote it automatically does this? I have votifer and the site im using with votifer is tekktiserverlist.com, and it says connected succesfully to votifier and what not, but when they vote it doesnt give them items, how do i set it up so it will?
@Shurkan2
If you have Essentials: /exp give USER AMOUNT