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 have a request, if this is possible, if a player has not voted on a link within 24 hours, it sends them a message saying so, which obviously doesn't go away until they vote. And i can set the time delay with the messages.
@Schlumpfpirat
Okay, it appears that somehow a vote is being tallied for a blank username... I'm not sure how this is happening exactly but this build should fix it! http://ci.onarandombox.com/job/VotifierScripts/28/
The ? box symbol is some weird glitch i've seen before. Try holding alt and typing 0167 on your number pad to get the symbol naturally. Otherwise, you can concatenate org.bukkit.ChatColor into your string. For example:
Here's the colors for that thing: http://jd.bukkit.org/apidocs/org/bukkit/ChatColor.html
@dumptruckman: Oh yeah, sorry, that's something that does not happen to me usually. Enable Error Log: http://pastie.org/4558144 scripts/scripts.bin: http://pastie.org/4558146
I tried that §5 - but that did not work. It only showed a question mark in a square in front of the message.
@Schlumpfpirat
Sorry, but like I previously said, I'm going to need the entire error, the script you're using and the scripts.bin when it screws up.
As far as the colors, something weird is going on that I don't think I can fix. Fortunately you can work around this by changing all the & to §
@dumptruckman:
No. Not really actually getting this error all the time, when the script.bin or what ever it's called breaks http://pastie.org/4557806 (with current version) I am not trying to store anything weird in the metaData. I just modify the pre- and suffixes of my members sometimes using /world world /user <name> /user prefix &4WhatEver - so just the general bPermission commands. So please fix that, cz I really love that plugin.
Please could you also fix the script, on that I commented in the forums? It's actually NOT possible to add COLOR to the private message, that appears to somebody, who did not vote yet. Color only works on the broadcast, if somebody voted.
@ni_r3ng3r_ni
Hey, while this would have been possible in the dev versions, I have just added a simpler way for this to be possible. Check out the changes in b26.
As for the vote reminder, check out the script library in the forums, there's one in there for a vote reminder. I've also added a new page detailing some of the extra bits VotifierScripts make available for scripts.
@anonym110
That is already a feature of that function. Any scheduled scripts that would have been run when the server is down will run as soon as it starts up.
@addemod @rmsy
Make sure you're using Votifier 1.8 and make sure you've setup Votifier properly.
@mrchasez
Colors use the color codes someone else mentioned but with the section symbol §. So like §c for red. Alternately, you could append org.bukkit.ChatColor to whatever. Like broadcast(org.bukkit.ChatColor.RED + "This message is red!!!!!!!!!!!!!!!!!!!!")
@Schlumpfpirat
Hmm, the only thing I could think (considering what fixed it for you) is that you were trying to store some odd stuff in the metaData variable.
@JTPROG
Not entirely sure what's wrong.. That error typically means something is wrong with the javascript you have written. I'm not super knowledgeable about Javascript but if I had to guess, it doesn't like decimals mixed with non-decimals in that array.
@superfunnytogo
You did not install the plugin correctly into your plugins directory or there are errors on startup. In case of errors, please paste the entirety of them on http://www.pastebin.com
@Schlumpfpirat
I've never heard of issues with a yaml file being too big. Your issue sounds like some kind of odd data is trying to be stored in that file. Please http://www.pastebin.com the contents of the scripts.bin file when your error occurs and the entirety of the error.
@waawaamp
Please be more descriptive with your issue, perhaps provide the script you are trying to use or a pasted version of the error on http://www.pastebin.com
@Slipswhitley
What problem are you having, exactly??
it still works you should be able to use the jar thats there now my server is using the old jar and nothing has gone wrong.
Come on bro it can't take this long to update please I need this asap
i get 'player not found' even though i'm clearly online and know how to spell WaaWaamp.
Is this getting fixed? Once scripts.bin in ./plugins/VotifierScripts/scripts gets too big the plugin stops working.
Please help. I have installed the plugin and /vstest works but i cannot find the directory were i can edit things. THe votifierscripts folder is not in the plugins folder.
Please help
tks
Getting illegal character in .....\vote-script.txt#1 with this code which tries to give a random of 1-2 items from list of all items. Have no idea why. Any Ideas?
var itemIds = [1,2,3,4,5,5.1,5.2,5.3,6,6.1,6.2,6.3,7,8,10,12,13,14,15,16,17,17.1,17.2,17.3,18,18.1,18.2,18.3,19,20,21,22,23,24,24.1,24.2,25,26,27,28,29,30,31,31.1,31.2,32,33,34,35,35.1,35.2,35.3,35.4,35.5,35.6,35.7,35.8,35.9,35.10,35.11,35.12,35.13,35.14,35.15,36,37,38,39,40,41,42,43,43.1,43.2,43.4,43.3,43.5,43.6,44,44.1,44.2,44.3,44.4,44.5,44.6,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,82,81,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,97.1,97.2,98,98.1,98.2,98.3,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,123,124,125,125.1,125.2,125.3,126,126.1,126.2,126.3,127,128,129,130,131,132,133,134,135,136,256,257,258,259,260,261,262,2663,265,264,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,2801,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,345,344,346,347,348,349,350,351,351.1,351.2,351.3,351.4,351.5,351.6,351.7,351.8,351.9,351.10,351.11,351.12,351.13,351.14,351.15,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383.50,383.51,383.52,383.53,383.54,383.55,383.56,383.57,383.58,383.59,383.60,383.61,383.62,383.90,383.120,383.91,383.92,383.93,383.94,383.95,383.96,383.97,383.98,384,385,386,387,388,2256,2257,2258,2259,2260,2261,2262,2263,2264,2265,2266]
var minAmt = 1
var maxAmt = 2
var message = "&a%target% voted and has received %amount% random items!"
var amt = Math.floor((Math.random()*(maxAmt-minAmt+1))+minAmt)
var item = Math.floor(Math.random()*itemIds.length)
command("give %target% " + itemIds[item] + " " + amt)
message = message.replace("%amount%", amt)
broadcast(message)
The plugin just broke and stopped working for what ever reason. I did not change anything at all, but the broadcast message and then this error came up, after the restart. http://pastie.org/4460236
/edit: kind of fixed it, by removing the scripts.bin (or something like this) in the script folder.
Really good plugin! Runs really smooth + works well; was looking for such a plugin quite a while. :)
Thanks!
Just one thing I am missing, haha. This.
@mrchasez
Hey, use minecrafts color nodes click for colors
I get this crash when someone votes:
What am I doing wrong?
How can i add colour the broadcast?
@addemod
Try testing your votifier connection here: http:minestatus.net/votifier/test If that's not working, its an problem at votifier not at votifierscripts
My votifier doesn't accept the plugin :O :( Help? I tried to vote, but nothing happens
How do I give offline players items, or give them the items after they logged in? vote-script.txt:
Also: how do I configure it so that if the player logs in it says: "It seems like you haven't voted yet!" if they haven't voted on 1 server list yet, or is that not possible?
Last question: Can I make it broadcast on WHICH server they voted? Like %server%
Thanks for the help!