zarqon
Well-known member
[size=+1]Script Registry 1.9[/size]
For script authors
As a script author, I enjoy using the "notify" command at the top of my scripts. Then when someone uses my script, I get a kmail letting me know that someone liked my script enough to use it. The cockles of my heart are warmed. But, what to do with all these notification kmails? Surely they can serve some purpose besides just cockle-warming...
And so, Script Registry was born.
What does it do?
In a nutshell, Script Registry allows you to keep a record of the information provided by the "notify" command. This record is kept on a remote server and is accessible from within the script or on a public web page (see below).
Every time you use the script, it parses your kmail and registers any appropriate information. After successfully registering the information, it deletes the kmails that it successfully parsed, then generates a report showing your current script use information.
The Script Registry Site
The information that is gathered by the use of this script is viewable on a public web site. It is my desire that this information be useful to the scripting community. Authors can track the use of their script, check to see if a certain script already exists, and find scripts that are useful to other players. Script users can find scripts that are useful to other players, or experienced authors from whom to request scripting assistance. It is currently hosted here:
Script Registry Online
Details
The "notify" command has long been available in mafia. If you write "notify <playername>;" at the top of your script (before any other commands), you will receive automated kmails from other mafia users when they use your script for the first time. It will say "I have opted to let you know that I have chosen to run <scriptname.ash>. Thanks for writing this script!"
Registry will recognize those kmails and (if you have already registered a script by that name) record who used your script, and when. It then deletes the kmail.
I must emphasize that this script is only useful for script authors who use the "notify" command at the top of their scripts. Even then, your information will not be recorded unless you first register your script using a simple command.
Registry Commands
You can instruct Registry.ash to do certain things by sending yourself a kmail containing certain commands. Registry.ash will follow these commands when it parses your kmail.
You can have as many of these commands as you like in a single kmail, in any order, but each command does need its own set of square braces.
How to use it:
Changelog
3.31.08 - ver. 1.0 posted.
4.22.09 - 1.1 changes: fixed URL for version checking due to new forum software. Don't bork on filenames not including "scripts" now that the notify command does not include path info.
6.26.09 - 1.2 changes: integrated ZLib and made the available optimizations -- now uses improved version-checking and has cleaner string-parsing sections.
8.07.09 - 1.3 changes: fix a possible index-out-of-bounds error that could occur when notification kmails were forwarded.
12.30.09 - 1.4 changes: fixes dealing with mafia's changed handling of ints and strings. Use ZLib's new vprint().
5.01.11 - 1.5 changes: use ZLib's new load_kmail() for great justice. Only parse registry commands from yourself.
5.02.11 - 1.6 changes: using the api.php method of accessing kmail, links in message text are not clicky. Account for that when registering URLs.
6.15.11 - 1.7 changes: now uses ZLib's lovely process_kmail() for another drastic reduction in size! Further, using my regex tongs in a controlled environment I reworked the parsing to use matchers (*shudder*), so you can now include any number of commands in your kmail, and they will all be parsed in the correct order (unregisters, then registers, then urls).
10.24.12 - 1.8 changes: need 'www' in the url after nameserver change.
10.18.17 - 1.9 changes: 'http' -> 'https'
For script authors
As a script author, I enjoy using the "notify" command at the top of my scripts. Then when someone uses my script, I get a kmail letting me know that someone liked my script enough to use it. The cockles of my heart are warmed. But, what to do with all these notification kmails? Surely they can serve some purpose besides just cockle-warming...
And so, Script Registry was born.
What does it do?
In a nutshell, Script Registry allows you to keep a record of the information provided by the "notify" command. This record is kept on a remote server and is accessible from within the script or on a public web page (see below).
Every time you use the script, it parses your kmail and registers any appropriate information. After successfully registering the information, it deletes the kmails that it successfully parsed, then generates a report showing your current script use information.
The Script Registry Site
The information that is gathered by the use of this script is viewable on a public web site. It is my desire that this information be useful to the scripting community. Authors can track the use of their script, check to see if a certain script already exists, and find scripts that are useful to other players. Script users can find scripts that are useful to other players, or experienced authors from whom to request scripting assistance. It is currently hosted here:
Script Registry Online
Details
The "notify" command has long been available in mafia. If you write "notify <playername>;" at the top of your script (before any other commands), you will receive automated kmails from other mafia users when they use your script for the first time. It will say "I have opted to let you know that I have chosen to run <scriptname.ash>. Thanks for writing this script!"
Registry will recognize those kmails and (if you have already registered a script by that name) record who used your script, and when. It then deletes the kmail.
I must emphasize that this script is only useful for script authors who use the "notify" command at the top of their scripts. Even then, your information will not be recorded unless you first register your script using a simple command.
Registry Commands
You can instruct Registry.ash to do certain things by sending yourself a kmail containing certain commands. Registry.ash will follow these commands when it parses your kmail.
- [register scriptname] - This is the most important command. Registry will not record anything for scripts unless they have been registered. Example: [register myscript.ash]
- [unregister scriptname] - Use this command to delete a script you have registered from the registry. At present, scripts cannot be unregistered if they have more than one registered user. Example: [unregister myscript.ash]
- [url for scriptname is url] - You can use this command to register a URL for your script. Ideally, that would be the URL where the script can be downloaded (most likely here). Visitors to the Registry website will be able to follow that URL to download your script. Example: [url for myscript.ash is http://kolmafia.us/showthread.php?t=1234]
You can have as many of these commands as you like in a single kmail, in any order, but each command does need its own set of square braces.
How to use it:
- Make sure your published script(s) correctly use the "notify" command.
- Download Registry.ash.
- Make sure you also have ZLib.
- Register your script(s) using the [register scriptname] command (see above).
- Regularly run this script to record and delete your notification kmails. I recommend adding it to your login script.
Changelog
3.31.08 - ver. 1.0 posted.
4.22.09 - 1.1 changes: fixed URL for version checking due to new forum software. Don't bork on filenames not including "scripts" now that the notify command does not include path info.
6.26.09 - 1.2 changes: integrated ZLib and made the available optimizations -- now uses improved version-checking and has cleaner string-parsing sections.
8.07.09 - 1.3 changes: fix a possible index-out-of-bounds error that could occur when notification kmails were forwarded.
12.30.09 - 1.4 changes: fixes dealing with mafia's changed handling of ints and strings. Use ZLib's new vprint().
5.01.11 - 1.5 changes: use ZLib's new load_kmail() for great justice. Only parse registry commands from yourself.
5.02.11 - 1.6 changes: using the api.php method of accessing kmail, links in message text are not clicky. Account for that when registering URLs.
6.15.11 - 1.7 changes: now uses ZLib's lovely process_kmail() for another drastic reduction in size! Further, using my regex tongs in a controlled environment I reworked the parsing to use matchers (*shudder*), so you can now include any number of commands in your kmail, and they will all be parsed in the correct order (unregisters, then registers, then urls).
10.24.12 - 1.8 changes: need 'www' in the url after nameserver change.
10.18.17 - 1.9 changes: 'http' -> 'https'
Attachments
Last edited: