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/
i like to use this plugin to give players exp, but not only xp bottles, i want them to earn the exp direktly. Can someone help me please ?
Anyone tested this plugin with topg.org? I'm new and I registered there and I'm looking for some listener to give diamonds for my players.
http://prntscr.com/molwb
CB: 1.4.5 R0.2 VotifierScripts: 1.1 b28
I can't delte this plugin from my plugins because I can't see the .jar in my plugins folder. Can someone help me please.
I'm getting an internal server error when I do /vstest [name] http://pastebin.com/vt7hRZdd, and nothing happens when someone votes.
Does /vstest have a permission?
@dumptruckman:
Thank you, that worked. It was due an email adress somebody entered.
@Schlumpfpirat
I believe this is related to a bug fixed in b28. The only thing is that it requires you to delete your scripts.bin file when you upgrade, if you were having that error. Keep in mind this means that any scripts scheduled to run will be forgotten. You can work around this if instead of deleting scripts.bin you edit it with a text editor and remove the invalid entries.
Still getting that error with latest CB: http://pastie.org/5402734 (VotifierScript b28)
Had a look through the functions/variables and couldn't find one for changing a user's group? If not already a feature, I would really like it.
@DanielYRH
Next time you have an error use http://www.pastebin.com. What you posted is hardly readable but what I can see is that it doesn't show any errors whatsoever. Also, after testing, everything is working fine on the latest CB version.
This no longer works on the new CB version :(
Me sa be gettin an era sa:
Is there anyway to hook this plugin to be able to use mcmyadmin commands? Right now any attempts to use them are unresponsive (nothing in console either). Other commands seem to work fine in script
@Dazedndconfused
Hmm, try http://topg.org/test_votifier Did you tried to disable changename option from essentials config? Maybe that will help.
When I test my VotifierScripts using /vstest dazedndconfused it works properly.. but when i vote it doesnt register a name that voted. Any clue as to what is going wrong? all it says in console is "Player not found"
I cant seem to get this to work properly. Here is the error I get on the console when I test a vote:
2012-11-21 12:59:01 [INFO] Disconnecting /174.36.33.242:49807: Protocol error 2012-11-21 12:59:01 [INFO] /174.36.33.242:49807 lost connection
Hello. http://pastie.org/5402734 Bukkit: #2483
Hey im haveing this error on 1.4.2 and 1.4.4
http://pastebin.com/vSuCNxyk
i have no idea why its there
what does this mean? I get this if I do /vstest Player
14.11 11:11:40 [Server] WARNING [VotifierScripts] Error running script: missing ] after element list (plugins/VotifierScripts/vote-script.txt#4)
this is my vote script:
Add rewards here, item id then amount var dailyRewards = ["264 1", "388 5", "276 1", "264 5", "384 10", "354 1", "261 1"] Add a name for each reward, which must match the order of the above array var rewardNames = [1 Diamond", "5 Emeralds", "1 Diamond sword", "5 Diamonds", "10 xp bottles", "1 Cake", "1 Bow"]
function getDailyReward() { return dailyRewards[java.util.Calendar.getInstance().get(java.util.Calendar.DAY_OF_YEAR) % dailyRewards.length]; }
function getDailyRewardName() { return rewardNames[java.util.Calendar.getInstance().get(java.util.Calendar.DAY_OF_YEAR) % rewardNames.length]; }
broadcast(org.bukkit.ChatColor.GRAY + "%target% Heeft vandaag gestemt en heeft " + org.bukkit.ChatColor.AQUA + getDailyRewardName() + org.bukkit.ChatColor.GRAY + "! gekregen, ga naar vote.jellycraft.nl en krijg het ook!");command("give %target% " + getDailyReward());
@termin8er678
You can use a listener and enter the minecraft username on this tester:
Test votfier with username
You can see live if it pops-out the announce on your server :)