View Full Version : Script Registry -- for script authors; track your script usage
zarqon
04-01-2008, 02:10 AM
Script Registry 1.7
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 (http://zachbardon.com/mafiatools/)
Details
The "notify" command (http://wiki.kolmafia.us/index.php?title=Notify) 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).
Paragon
05-04-2008, 05:21 PM
Nice script. Now I just wish I had remembered to put notifiy on my earlier scripts!
This won't count multiple notifies from the same user right?
zarqon
05-05-2008, 05:49 AM
In the event of multiple notifies from the same user, it simply reports that that user has already been registered. This still counts as a successful parse, so it will delete that notification kmail.
Paragon
05-09-2008, 05:13 AM
I don't know if this would be a pain in the butt or not, but do you think it would be possible to make it so that we could do either of the following things:
1) Send a kmail to ourselves with some sort of tag (like the ones already implemented) that would let us add text at the top, under our name. Such as, I collect balls, and I know that a few other script writers around here collect particular items, I would like to be able to add a line or two about how if anyone felt like donating things to us here is a list of items we collect or what-have-you. And 2nd maybe be able to send a bit of text to attach it's self to the script it's self... such as current ver. number, updates, documentation etc. It wouldn't really have to be anything too intricate, just one set of plain text the scripter could use to write whatever information they felt was important.
And BTW, i really like the site and idea.
zarqon
05-09-2008, 06:03 AM
Interesting ideas, Para...
1) That's possible to include a short bit of author information, like a tagline or what have you to personalize things a bit. I'll take a look at adding that soon.
2) If you want to include version information or documentation, do it a) in your script, or b) here! That's why you have the option of providing a link, so anyone interested can check here to make sure they have the latest version, or to figure out how to use it. Registry does not attempt (or want) to be a replacement site to this one.
(For anything other than really simple scripts, I recommend that all scripts include version info in the script. You could also include version checking by using visit_url() in the script to check your script's thread for version info, then alerting your users if there is an update. See the original idea (http://kolmafia.us/index.php/topic,1462.0.html), or see any of my scripts for a simplified adaptation of that idea.)
Thanks for the feedback!
zarqon
04-22-2009, 02:39 PM
1.1 Updates!
A handfulk of script authors seem to be finding this useful, so I'm posting about this update since the version checking (broken since the forum change) wouldn't tell you.
Perhaps a week or two back, the notify command was altered so as not to include path info in the sent kmails. This resulted in a lot of notifications not being parsed correctly. This annoyance has gone on long enough. I finally fixed it today, so those of you who enjoy this functionality can have it back once more.
While I was at it, I fixed the version checking so further update posts such as this one should be unneccessary.
This is kinda cool... I think I might try out the notify command again now that I've noticed it (since notify now works properly).
I was wrong about it being kinda cool. Actually it's extremely cool. It's fun seeing my list of registered users increase when someone's mafia sends me mail.
Mafia will only send a message the first time someone runs the script and I used notify on my script once before so those people aren't sending me new messages, but fortunately I'd saved those mails in a text file in case I was ever curious about them. It wasn't too hard to modify your script to read in the old messages using file_to_map so I was able to get those old registrations into your database. ;)
Fun and informative. Turns the annoyance of notify messages into a pleasure.
bumcheekcity
06-28-2009, 09:52 PM
Yo zarqon. I'm trying to use this, but the script just keeps printing:
<html><body>This script is only accessible from <a href="http://kolmafia.sourceforge.net/">KoLmafia</a>.</body></html>
But I AM using it from KolMafia...?
Maybe you ought to explain how you are trying to use it. Give details 'cause I can't wait to hear!
bumcheekcity
06-28-2009, 11:38 PM
Well, i'm just running it like any other script. I've sent myself the Kmails like instructed.
Please define "like any other script". Give us juicy details!
Though if you cannot figure out how to use it, I can only wonder at why you'd need to use it.
zarqon
06-29-2009, 06:00 AM
@bumcheekcity: which version of mafia are you using? Did you edit the script at all?
Off the top of my head, I seem to recall that you will only get that error if you visit the registry URL without providing the necessary variables. (Which would happen if you just visit that URL in a browser, or if you hacked the script -- incorrectly.)
bumcheekcity
06-29-2009, 10:47 AM
13.3.1, and I'm fairly sure I didn't edit the script. I might have looked at it an inadvertently modified it, I suppose, but I'm sure I wouldn't have saved it. I'll re-download today and test when I'm back from work.
bumcheekcity
06-29-2009, 04:25 PM
2 messages queued.
Message 1: Registering bumcheekcity for 'hccheck.ash'...
<html><body>This script is only accessible from <a href="http://kolmafia.sourceforge.net/">KoLmafia</a>.</body></html>
[register hccheck.ash]
Message 2: Registering 'hccheck.ash'...
<html><body>This script is only accessible from <a href="http://kolmafia.sourceforge.net/">KoLmafia</a>.</body></html>
0 messages processed successfully.
Printing report...
That's what I get. I've just downloaded it and clicked "Scripts -> Register.ash"
mredge73
07-01-2009, 07:48 PM
hey
I registered a few scripts the other day
For some reason the link to them on the website does not work.
I just get:
There ain't no script named 'MrEdge73\\\'s HC Daily Inventory Control! (Beta) .ash' registered to mredge73.
I wonder if the apostrophe screwed it up?
zarqon
07-02-2009, 06:17 AM
@bumcheek: Looked at the PHP... it's still checking to see that the agent is identified as mafia. I bet you've set mafia's "use last browser's userAgent" preference (on the "General" tab). Unchecking that preference and restarting mafia would probably allow you to run this script just fine, with little to no effect on your relay browser play.
I think that check is probably unnecessary (perhaps I was a little overzealous about security) and I'll look for a way to rewrite that. For now, I would recommend unchecking that setting.
@mredge: Yep, looks like the apostrophe was escaped when being saved. It was then escaped again when passed to details.php for a closer look at your script. The data file has your script as:
MrEdge73\'s HC Daily Inventory Control! (Beta) .ash
(Yes, including the space at the end... you have two scripts like that... is that intentional?)
Apparantly all the mafia/PHP interactions are still functional with the backslash included, however -- you have registered users. Interesting.
I recommend against using punctuation in filenames, as a general principle. I would also advise not to include version info ("Beta") in the filename, as you will need to reregister once you have a final release.
I tried just removing the slashes from your scripts in the data file but that led to errors which I wasn't up to debugging at the moment. I also added stripslashes() to most of the Registry's incoming page variables, so your script links are at least working now. Also, future scripts registered should avoid this problem... I think. Let me know if anything else still doesn't work.
mredge73
07-02-2009, 12:16 PM
note to self, rename my script files better to work with registry.
thanks for your help.
note to self, rename my script files better to work with registry.
hanks for your help.
as an aside, I often rename scripts that have (to me) annoyingly long names.
mredge73
07-02-2009, 03:19 PM
I understand that I make annoying long names, I am not very creative.
I have probably changed my script names over a dozen times and I still don't like how they look or sound and when I make them short they disappear in my huge script folder.
note to self, short and sweet script file names
oh and they need to be catchy, creative, and provide information
sad thing here is that it will take me longer to rename them than it took to write them.
Subfolders work wonders to organize scripts.
bumcheekcity
07-02-2009, 08:57 PM
@bumcheek: Looked at the PHP... it's still checking to see that the agent is identified as mafia. I bet you've set mafia's "use last browser's userAgent" preference (on the "General" tab). Unchecking that preference and restarting mafia would probably allow you to run this script just fine, with little to no effect on your relay browser play.
I think that check is probably unnecessary (perhaps I was a little overzealous about security) and I'll look for a way to rewrite that. For now, I would recommend unchecking that setting.
That worked perfectly. Perhaps you should say that on the error, but not to sound ungrateful. Thanks, the script's great!
bumcheekcity
07-30-2009, 03:52 PM
Zarqon, what do you do about people who re-name your scripts before they use them? It's pretty obvious they're users of the script, but they named it hccheck-cc.ash or whatever, so it won't work with the script.
I can tell you what I do when that happens. I add a line to register_user() that looks like this:
if(scriptname == "chamoix.ash") scriptname = "chamois.ash";
You should be able to figure out exactly where in the function to insert it. ;) Then I just change the specifics based on the kmail.
zarqon
07-31-2009, 05:17 AM
I originally planned a kind of "aliasing" idea, where you could register aliases of scripts by typing [register secondaryscriptname alias of primaryscriptname]. This is supported in the ASH script, but is still not supported server-side.
For now, Bale's solution ought to do you nicely. Personally, I usually just delete those notifications. But it is becoming common knowledge that I am not as OCD as he is.
LoL! Yeah, I like certain things to be done precisely. If someone sends me a notification for one of my scripts I want it sorted properly even if they change the name.
Anyway, I'd say that anyone who has a valid need for this script should be able to figure out such a minor detail as how to use that information I provided in the previous post so it isn't important for you to update the script for such eventualities. This is a script for script writers after all.
mredge73
09-22-2009, 02:48 PM
hello Zarqon
I have a low priority request:
[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]
Can this be updated so an author can remove scripts no longer supported?
Personally, I have changed the name of 3 of my scripts that I have registered and would like to be able to remove them since I no longer support them by that name.
Again, this is low-priority. They are not hurting anything by being up there, just making a mess.
What might be better and more useful is: [changename oldscriptname newscriptname]
which would merge the user lists of the two scripts into newscriptname while removing the entry for oldscriptname. I think that is really what you want. It would tidy up your list of scripts without losing any relevant information.
zarqon
09-23-2009, 03:10 AM
If you want to change the name of a script, just kmail/PM me, and I'll edit the data file directly. Then all your previously registered users will persist. In your case, if you've already added the renamed scripts to the registry, that presents more of a difficulty. Let me know what you'd like to do.
PS -- yay for the recent "script" directive, eh? I should probably include this in the Wiki page I made for notify.
I just wanted to thank you again for this script. Whenever I have a heavy notify day...
14 messages processed successfully.
Deleting processed mail...
14 messages deleted.
That makes me so glad that I didn't have to check them all manually. It's nice when they disappear and I can find a few personal messages from their midst.
Thanks zarqon.
zarqon
12-04-2009, 06:55 PM
Certainly!
But don't thank me too much -- I made it first for myself. :) If I'm away from my computer for a few days, or if mafia makes some change that appears to clear a lot of people's "used scripts" preference, I'm very glad for this script. I've had upwards of 50 notify messages get processed in one batch.
Oh well, I know I don't have anywhere's near as much need for this script as you do, but I had already decided that notify was more trouble than it was worth until I tried this. This script is the difference between notify being a blessing or bane.
bumcheekcity
12-24-2009, 07:21 AM
Btw zarqon, I'm getting lots of "Unexpected error, debug log printed." messages when there are messages to be processed. I think it's due to trying to store things that aren't integers in the integer type:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
KoLmafia r7917, Windows XP, Java 1.6.0_17
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Please note: do not post these logs in the KoLmafia thread. If
you would like us to look at the log, please instead email logs
to veracity@hambo.com using the subject "KoLmafia Debug Log"
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Timestamp: Thu Dec 24 08:19:04 GMT 2009
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Unexpected error, debug log printed.
class java.lang.NumberFormatException: sel94694817
java.lang.NumberFormatException: sel94694817
at net.sourceforge.kolmafia.utilities.StringUtilities .parseInt(StringUtilities.java:701)
at net.sourceforge.kolmafia.textui.DataTypes.parseInt Value(DataTypes.java:218)
at net.sourceforge.kolmafia.textui.RuntimeLibrary.to_ int(RuntimeLibrary.java:1508)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.sourceforge.kolmafia.textui.parsetree.LibraryF unction.execute(LibraryFunction.java:119)
at net.sourceforge.kolmafia.textui.parsetree.Function Call.execute(FunctionCall.java:156)
at net.sourceforge.kolmafia.textui.parsetree.Assignme nt.execute(Assignment.java:89)
at net.sourceforge.kolmafia.textui.parsetree.BasicSco pe.execute(BasicScope.java:451)
at net.sourceforge.kolmafia.textui.parsetree.Conditio nal.execute(Conditional.java:88)
at net.sourceforge.kolmafia.textui.parsetree.If.execu te(If.java:67)
at net.sourceforge.kolmafia.textui.parsetree.BasicSco pe.execute(BasicScope.java:451)
at net.sourceforge.kolmafia.textui.parsetree.Loop.exe cute(Loop.java:57)
at net.sourceforge.kolmafia.textui.parsetree.ForLoop. execute(ForLoop.java:183)
at net.sourceforge.kolmafia.textui.parsetree.BasicSco pe.execute(BasicScope.java:451)
at net.sourceforge.kolmafia.textui.parsetree.UserDefi nedFunction.execute(UserDefinedFunction.java:127)
at net.sourceforge.kolmafia.textui.parsetree.Function Call.execute(FunctionCall.java:156)
at net.sourceforge.kolmafia.textui.parsetree.Assignme nt.execute(Assignment.java:89)
at net.sourceforge.kolmafia.textui.parsetree.BasicSco pe.execute(BasicScope.java:451)
at net.sourceforge.kolmafia.textui.parsetree.Conditio nal.execute(Conditional.java:88)
at net.sourceforge.kolmafia.textui.parsetree.If.execu te(If.java:67)
at net.sourceforge.kolmafia.textui.parsetree.BasicSco pe.execute(BasicScope.java:451)
at net.sourceforge.kolmafia.textui.parsetree.Switch.e xecute(Switch.java:138)
at net.sourceforge.kolmafia.textui.parsetree.BasicSco pe.execute(BasicScope.java:451)
at net.sourceforge.kolmafia.textui.Interpreter.execut eScope(Interpreter.java:234)
at net.sourceforge.kolmafia.textui.Interpreter.execut e(Interpreter.java:191)
at net.sourceforge.kolmafia.textui.Interpreter.execut e(Interpreter.java:184)
at net.sourceforge.kolmafia.textui.command.CallScript Command.call(CallScriptCommand.java:193)
at net.sourceforge.kolmafia.KoLmafiaCLI.executeComman d(KoLmafiaCLI.java:482)
at net.sourceforge.kolmafia.KoLmafiaCLI.executeLine(K oLmafiaCLI.java:366)
at net.sourceforge.kolmafia.KoLmafia.login(KoLmafia.j ava:678)
at net.sourceforge.kolmafia.request.LoginRequest.proc essLoginRequest(LoginRequest.java:429)
at net.sourceforge.kolmafia.request.GenericRequest.ha ndleServerRedirect(GenericRequest.java:1403)
at net.sourceforge.kolmafia.request.GenericRequest.re trieveServerReply(GenericRequest.java:1333)
at net.sourceforge.kolmafia.request.GenericRequest.ex ecute(GenericRequest.java:1064)
at net.sourceforge.kolmafia.request.GenericRequest.ru n(GenericRequest.java:955)
at net.sourceforge.kolmafia.request.LoginRequest.run( LoginRequest.java:280)
at net.sourceforge.kolmafia.RequestThread.postRequest (RequestThread.java:73)
at net.sourceforge.kolmafia.swingui.LoginFrame$LoginP anel.doLogin(LoginFrame.java:353)
at net.sourceforge.kolmafia.swingui.LoginFrame$LoginP anel.actionConfirmed(LoginFrame.java:300)
at net.java.dev.spellcast.utilities.ActionPanel$Confi rmedListener.run(ActionPanel.java:164)
at java.lang.Thread.run(Unknown Source)
Veracity
12-24-2009, 04:04 PM
Btw zarqon, I'm getting lots of "Unexpected error, debug log printed." messages when there are messages to be processed. I think it's due to trying to store things that aren't integers in the integer type:
That does look what it's doing. Unfortunately, the stack trace won't help him find out which line in his script is buggy. I'll look into trapping such errors in to_int() and giving a more helpful message, including file and line of code.
Edit: we used to do exactly that, but the new code in StringUtilities.parseInt pre-empted it and forced a stack trace to be printed. to_int() now calls a version which intentionally throws an exception if it can't parse, traps the errors, and gives a usual ASH runtime error.
mredge73
12-25-2009, 04:57 PM
Change line 106 from:
parsedmail[p].id = to_int(substring(km[i],0,index_of(km[i],"\"")));
to:
parsedmail[p].id = to_int(substring(km[i],3,index_of(km[i],"\"")));
This will fix the problem. Something must have changed for to_int().
Veracity
12-25-2009, 05:15 PM
Something must have changed for to_int().
Yes. This has been heavily discussed all over these forums. You can no longer pass in non-integers and get KoLmafia to, miraculously, give you an integer.
Used to be, as in this script, if you gave it "sel1234", it would return 1234. I suppose that might make a little bit of sense. But, you could also give it "1 for me and 2 for you" and get back 12.
Bottom line: if you give a non-integer to to_int(), it is now considered to be an error.
zarqon
12-29-2009, 07:52 PM
Fixed this and the other problem: print(integer + "string") now evaluates the whole thing as an integer for some reason. Changing it to print(to_string(integer) + "string") fixes that, which I had in quite a few of my scripts.
I'm still a bit sad about the apparent regression in to_int()'s functionality, but I've had some time over the holidays so I was able to go through most of my scripts that stopped working and "fix" them. Sigh, I miss the old functionality though.
Veracity
12-29-2009, 08:57 PM
Fixed this and the other problem: print(integer + "string") now evaluates the whole thing as an integer for some reason.
It was a bug. Fixed in revision 7941.
zarqon
12-29-2009, 09:30 PM
Oh. Nice! Thanks. One. Syl. La. Ble.
Neat! Good script. Make many short mail to one handy web post. Like much. Sad broke. Happy now; it works.
Ble to you too!
> call Registry.ash
Checking mail...
1 messages queued.
Message 1: Registering 'relay_Feed.ash'...
<html><body>This script is only accessible from <a href="http://kolmafia.sourceforge.net/">KoLmafia</a>.</body></html>
Message 1: Registering URL for 'relay_Feed.ash'...
<html><body>This script is only accessible from <a href="http://kolmafia.sourceforge.net/">KoLmafia</a>.</body></html>
0 messages processed successfully.
Printing report...
Did revision 8351 (http://kolmafia.us/showthread.php?3877) break Registry.ash?
EDIT: I misinterpreted that error - apparently it was zachbardon.com responding that the script at http://kolmafia.sourceforge.net/ should be used.
zarqon
04-11-2010, 06:00 PM
Wrong on both counts; mall price data and its associated scripts have nothing to do with the Registry. You probably have the preference set to use your last browser as the agent. Try again with that preference unchecked.
Unchecking (Debug) Use last browser's userAgent worked, thanks!
Something didn't work. Website problem?
edit: error message deleted
zarqon
06-23-2010, 12:11 AM
Permissions issue. Should be fixed!
Edit: thanks.
icon315
06-23-2010, 02:53 AM
I Really Like this Script thanks, but i would like to be able to ignore a certain script. Also ignore messages From Myself
heeheehee
06-23-2010, 05:41 PM
Snippets, with modifications:
for j from 0 upto count(mail)-1 {
if(mail[j].sender==my_name() || mail[j].text.contains_text("scriptnamehere"))
[... rest of script ...]
[/code]
coaster3000
11-05-2010, 02:19 AM
I dont get how this thing works at all. I am new to this scripting made a few scripts simple ones. to gather outfits and such. But. My question is how do i use this? To me i don't get it. can you tell me how it works thanks.
Its hard to understand directions sometimes for me. Even if they are simple. sometimes i understand very complex instructions but today its just not my day. Thanks ;)
EDIT:
ok its just me being stupid i know how to work it now thanks anyway :D
This server has been down a lot in the last week. May I ask if there is a problem?
zarqon
11-30-2010, 02:26 AM
Really? I haven't noticed anything. I'll ask the sysadmin if he's made any changes lately.
Really? I haven't noticed anything. I'll ask the sysadmin if he's made any changes lately.
I haven't been able to access your server for this (or the map manager) for almost 2 days now. Am I the only one?
Theraze
11-30-2010, 08:37 PM
I got one website access error this morning. First one I've gotten though, and only the one time. Didn't note which site it was, either... which helps tremendously. :)
I got one website access error this morning. First one I've gotten though, and only the one time. Didn't note which site it was, either... which helps tremendously. :)
Are you capable of reaching http://zachbardon.com/ right now?
Theraze
11-30-2010, 09:07 PM
Zach Bardon's Metapage loads, no problems...
Winterbay
11-30-2010, 09:17 PM
No problem here either.
What the heck? Really? Here's my attempt to check that.
C:\>ping zachbardon.com
Pinging zachbardon.com [98.175.61.16] with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for 98.175.61.16:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
C:\>tracert zachbardon.com
Tracing route to zachbardon.com [98.175.61.16]
over a maximum of 30 hops:
1 11 ms 8 ms 8 ms 10.240.184.17
2 8 ms 6 ms 7 ms dstswr1-vlan2.rh.rslyny.cv.net [167.206.34.33
3 * * * Request timed out.
4 35 ms 38 ms 35 ms 64.15.1.5
5 * * * Request timed out.
6 49 ms 47 ms 52 ms mtc1dsrj02-ae2.0.rd.om.cox.net [68.1.0.127]
7 59 ms 59 ms 59 ms 68.13.9.193
8 59 ms 48 ms 50 ms 68.13.8.238
9 50 ms 92 ms 48 ms 68.13.8.214
10 * * * Request timed out.
11 * * * Request timed out.
12 * * * Request timed out.
13 * * * Request timed out.
14 * * * Request timed out.
15 * * * Request timed out.
16 * * * Request timed out.
17 * * * Request timed out.
18 * * * Request timed out.
19 * * * Request timed out.
20 * * * Request timed out.
21 * * * Request timed out.
22 * * * Request timed out.
23 * * * Request timed out.
24 * * * Request timed out.
25 * * * Request timed out.
26 * * * Request timed out.
27 * * * Request timed out.
28 * * * Request timed out.
29 * * * Request timed out.
30 * * * Request timed out.
Trace complete.
Is that a problem on my end? Any way for me to get more information? Is there any way for me to troubleshoot this? I'm not aware of having trouble reaching any other websites.
Winterbay
11-30-2010, 09:36 PM
This is what I get:
C:\...>tracert zachbardon.com
Tracing route to zachbardon.com [98.175.61.16]
over a maximum of 30 hops:
1 3 ms <1 ms <1 ms gw-n1-g-ho-a11.ias.bredband.telia.com [217.208.222.193]
2 78 ms 7 ms 7 ms kbn-bb1-link.telia.net [80.91.246.46]
3 88 ms 87 ms 87 ms nyk-bb1-link.telia.net [213.248.64.22]
4 92 ms 92 ms 92 ms ash-bb1-link.telia.net [80.91.248.184]
5 114 ms 111 ms 112 ms coxcable-ic-128352-ash-bb1.c.telia.net [213.248.102.138]
6 138 ms 138 ms 138 ms mtc1dsrj01-ae2.0.rd.om.cox.net [68.1.0.125]
7 138 ms 138 ms 138 ms 68.13.8.238
8 139 ms 139 ms 139 ms 68.13.8.214
9 141 ms 177 ms 140 ms wsip-98-175-61-16.om.om.cox.net [98.175.61.16]
Trace complete.
Average ping 146ms.
Edit: There appears to be something odd in your routing between 68.13.8.214 and the target...
Edit: There appears to be something odd in your routing between 68.13.8.214 and the target...
Does anyone know how to fix that?
Theraze
11-30-2010, 10:01 PM
My guess is that it isn't HIS routing, since it's outside his computer, but the routing of the host... Any chance you may have done something to get on their naughty list? Tested a new notify flag or ran someone's badly timed script that hits their server several hundred times?
Unlikely I did such a thing. Of course it is possible that someone on my ISP was naughty.
Do you think I can route around the problem somehow?
Theraze
11-30-2010, 10:05 PM
Try a proxy? It's Socks5 that mafia supports, right?
http://aliveproxy.com/socks5-list/
I don't actually know anything about using proxies. :( Help?
Theraze
11-30-2010, 10:19 PM
Okay, try using 211.138.124.233 as the host, 80 as the port, and check the box to use a proxy. Then see if it works for you... Those options go on the 'connection' tab prelogin. Just to make clear. :)
Appears to use HTTP proxy, not socks. All the socks proxies I tried failed miserably. Second HTTP (first non-transparent) worked fine.
Thanks Theraze. I still can't access his site in my browser (of course), but at least the script works now. Bad news is that it's a little laggy this way. At least I've finally got the registrations out of my inbox. :)
Theraze
11-30-2010, 10:32 PM
May want to try to check with the host and see if you can figure out why they're blacklisting you? That's probably an email process though, and one not likely to get you fixed for at least a day or two. But better than longterm laggy KoLing. :)
Which host would I email? 68.13.8.214 or wsip-98-175-61-16.om.om.cox.net? And how would I find the email of their web administrator? (I am incapable of checking the website after all.)
Theraze
11-30-2010, 10:49 PM
Well, according to a whois, it's registered through Godaddy. Not sure if they're hosting it or just providing the name lookup though... In their case, I'd suggest doing the contact through Godaddy.com and just checking there.
If it's Cox (more likely) that's blocking you, http://whois.domaintools.com/98.175.61.16 suggests that Jason Weil may be the right person to email. His contact info is there. OrgTechEmail, not OrgAbuseEmail. FYI, Jason Weil is the contact for the 68.13.8.214 IP as well.
Once again, thank you for your help. I'm sending an email to Jason Weil full of hope.
zarqon
12-01-2010, 02:41 AM
If you PM me any relevant info about your IP/ISP, I'll check it with my host, who I know personally. I had some problems once because a block of Korean IP's were blocked.
EDIT: We worked it out; Bale was blocked. For future reference, don't name your scripts things that contain "CD " -- after urlencoding that, it appeared like an insertion attempt and thus his IP was blocked. Exceptions were made for those specific URLs.
StDoodle
02-02-2011, 05:29 AM
I'd love to start using this, but I'm curious as to whether I should still [register] using the script name if I'm using the "script" command, or if I should use that. I assume the latter, but I'm not sure. Also, I didn't see anything about the apostrophe issue being fixed, and a few of my scripts go by "StDoodle's ..."
I wouldn't use notify if I didn't use this script. It's just super awesome! Put it in your login script to simply read a summary of whom is using your script and which of them are new!
I'd love to start using this, but I'm curious as to whether I should still [register] using the script name if I'm using the "script" command, or if I should use that. I assume the latter, but I'm not sure.
Use the name of the script that is kmailed to you by the notification command.
I don't know anything about an apostrophe issue, but judging by the apostrophe in the name of this script (http://zachbardon.com/mafiatools/details.php?a=mredge73&s=MrEdge73's%20Clan%20Looter!.ash) I'd say it is probably fixed.
StDoodle
02-02-2011, 06:07 AM
Thanks for the help Bale, and Zarqon for the script; success!
Alhifar
02-02-2011, 06:02 PM
I've edited my local copy of parse_mail() to check all pages, instead of just the first one. I've gone long enough between logins a few times that I have multiple pages of notify commands. My local copy is as follows (beware the regex, zarqon!)
message[int] parse_mail() {
message[int] parsedmail;
// get a map of kmail in html
vprint("Checking mail...",2);
string temp = visit_url("messages.php");
if (contains_text(temp,"There are no messages in this mailbox.")) return parsedmail;
temp = substring( temp , 0 , index_of( temp , "Mailbox:" ) );
matcher m_pages = create_matcher( "<a href='messages\\.php\\?box=Inbox&begin=(\\d+)'>\\[\\d+\\]</a> " , temp );
int pages = 1;
while( m_pages.find() ){
pages = m_pages.group(1).to_int();
}
for page from 1 upto pages{
temp = visit_url( "messages.php?box=Inbox&begin="+page );
temp = substring(temp,index_of(temp,"checkbox name=\"")+15);
string[int] km = split_string(temp,"checkbox name=\"");
int p = 0;
for i from 0 upto count(km)-1 {
if (contains_text(km[i],"I have opted to let you know that I have chosen to run ") ||
contains_text(km[i],"[register ") ||
contains_text(km[i],"[url for ") ||
contains_text(km[i],"[unregister ")) {
// parse html into record structure
parsedmail[p].id = to_int(substring(km[i],3,index_of(km[i],"\"")));
parsedmail[p].text = excise(km[i],"<blockquote>","</blockquote>");
temp = substring(km[i],index_of(km[i],"showplayer.php"));
parsedmail[p].sender = url_encode(substring(temp,index_of(temp,">")+1,index_of(temp,"</a>")));
temp = substring(km[i],index_of(km[i],"<b>Date:</b> ")+13);
parsedmail[p].date = url_encode(substring(temp,0,index_of(temp,"<")));
p = count(parsedmail);
}
}
}
vprint(to_string(count(parsedmail))+" messages queued.","blue",2);
return parsedmail;
}
zarqon
02-03-2011, 01:54 AM
Ooooh, shiny! I login often enough that even if there are leftovers on another page, they get dealt with the following day -- but this is a nifty addition nonetheless.
@Doodle: Try it, and if there are any apostrophe issues we can work them out.
zarqon
05-01-2011, 07:56 AM
Today's Update
Registry.ash now uses ZLib's shiny new load_kmail(). This means less code and less load -- win/win!
Less code: simply calls load_kmail() and everything's there in a map, ready for foreaching.
Less load: it visits KoL's api.php which is just a PHP array_to_string() rather than a human-readable HTML page. And, it returns up to 100 kmails rather than your default messages-per-page limit, meaning you'll only need multiple server hits if you have more than 100 incoming kmails. Possible, but quite uncommon.
Awesome. Now I've got to pull it apart and add in my personal modifications. Mine is pretty heavily modded to do some other things with my mail at the same time.
I seem to be having a problem when I try to register a URL for a script:
> call registry.ash
Message 1: Registering URL for 'Nemesis Quest Script'...
You know those people that say 'No URL is good URL'? We are not them.
0 messages processed successfully.
Printing report...
Here is the content of the kmail I send to myself:
[url for Nemesis Quest Script is http://kolmafia.us/showthread.php?4761]
zarqon
05-02-2011, 06:45 PM
Aha -- api.php doesn't add the clicky [link] bit before a URL; that must only be done in messages.php when your kmail is fetched.
I think that's great, we can go back to simply parsing the URL out of the kmail using the simpler syntax. Updated but not tested, should be fixed.
Oh, I added a print(url) to check if it was parsing correctly, but i didn't notice the excise() in the return value!
The update works, thanks.
I have discovered one crappy thing about the api. It doesn't tell you if a message is new. I'm going to have to keep track of the most recently received message ID so that the script can tell if there are new (non-registration) messages since it was last run.
Veracity
05-02-2011, 10:24 PM
Send CDM a message, tell him what you're doing, and suggest a new field. Not to say he'll do it - or even respond any time soon - but it can't hurt to suggest it.
Okay. I'll tell him. Thanks for suggesting it.
LoL!
Message 13: Registering charred for 'Rainbow Gravitation.ash'...
Success! charred is now registered as a user of your 'Rainbow Gravitation.ash' script.
Message 14: Registering OrochiDP for 'CounterChecker.ash'...
Query strings aren't toys, you know.
Message 15: Registering Gneurotic for 'Universal_recovery.ash'...
Gneurotic was already successfully registered for this script.
Never saw that error message before.
zarqon
06-15-2011, 05:05 PM
At this point in time I don't even recall what that error message means... perhaps a required field was missing or corrupted? I'll be able to check once I fix my laptop -- I'm 0 for 1 on fixing attempts so far.
I often like to reward hackers with funny error messages in my web apps, but the app itself isn't supposed to trigger them.
Update!
Use ZLib's process_kmail() for ridiculously fantastic justice. Also, allow unlimited commands in any order per kmail.
Use ZLib's process_kmail() for ridiculously fantastic justice. Also, allow unlimited commands in any order per kmail.
Argh! No! That means I'll have to update my local copy again. I've worked your registry script into an on-logon Kmail processor that also deletes old kBay mails and prints a report about non-registry new kMails so that I know if I should check my kMail box. Perhaps I'll wait a bit before I integrate your update. ;)
string new_mess(kmessage m) {
string oneItem() {
foreach it in m.items return " ("+it+")";
return "";
}
int gothodge() {
foreach it in m.items
if(it == $item[stuffed Hodgman]) return m.items[$item[stuffed Hodgman]];
return 0;
}
boolean brick() {
foreach it in m.items
if(it == $item[brick]) return true;
return false;
}
string kBaySummary() {
if(m.message.contains_text("cashout")) return " saying you need to cashout to receive items/meat when "+(in_hardcore()? "hardcore": "ronin")+" is over.";
if(m.message.contains_text("The winner of the auction is")) return " sending you "+m.meat+" meat.";
foreach s in $strings[You have successfully listed a new auction, Here is everything that I owe you,
I will return your items to you]
if(m.message.contains_text(s)) return " saying, \""+s+"\"";
return "";
}
if(m.fromname == "Your Pen Pal" || m.fromname == "Subject 37")
return m.fromname + oneItem();
if(m.fromname == "kBay") return m.fromname + kBaySummary();
if(count(m.items) > 0) {
int hodgies = gothodge();
if(hodgies > 0)
return m.fromname + " -- Sending you " + (hodgies == 1? "a stuffed Hodgman.":(hodgies+" stuffed Hodgmen."));
if(brick())
return m.fromname + " hitting you with a brick.";
return m.fromname + " -- sending you a gift.";
}
return m.fromname;
}
Banana Lord
06-17-2011, 07:37 AM
Running v1.7, I get "URL for 'relay_Harvest.ash' successfully modified.", and then the script shows "no" in the "URL?" column for relay_Harvest.ash.
stannius
07-14-2011, 06:42 PM
What is the "best practice" for naming and versioning scripts? Right now I have separate files for each version. At the top of my script I also have
// note to self: make sure to update the version number in all relevant places
script "stannius_spaaace_0.6.ash";
notify stannius;
import "zlib.ash";
check_version("stannius_spaaace", "stannius_spaaace", "0.6", 6969);
So, different versions are in some ways different scripts.
It is generally considered a good idea to leave off the version number if you're using this script. Otherwise it will become annoying later to have separate entries for each version. I'd personally just use script "spaaace"; since that is all the author needs to know. Seriously, you don't need to be reminded what your own name is and nobody else is going to get the kMail containing your script's name.
If you're interested in check_version(), that's a different thread and a completely different problem.
stannius
07-14-2011, 08:07 PM
It is generally considered a good idea to leave off the version number if you're using this script. Otherwise it will become annoying later to have separate entries for each version. I'd personally just use script "spaaace"; since that is all the author needs to know. Seriously, you don't need to be reminded what your own name is and nobody else is going to get the kMail containing your script's name.
If you're interested in check_version(), that's a different thread and a completely different problem.
I was posting the whole chunk for completeness and/or comparison. AFAIK the check_version part works fine. I do kinda like knowing when people are running an old version, but unless and until notify supports version numbers, not much I can do about it. OK, I'll remove the version # in the next version. I personally like reading my own name so it doesn't hurt to leave that part in right? :D
Doesn't hurt anyone at all since nobody will see it unless they look you up here (http://zachbardon.com/mafiatools/list.php?w=authors).
stannius
07-14-2011, 09:07 PM
Doesn't hurt anyone at all since nobody will see it unless they look you up here (http://zachbardon.com/mafiatools/list.php?w=authors).
Well, they can see it if they look in their kmail outbox.
Does anyone ever look there except when they just lent someone an ancient ItoM and wonder, "Wait! Did I type his name correctly...."
roippi
07-15-2011, 04:08 AM
I stress out so hard when sending expensive stuff. I triple check the spelling before sending AND check the outbox.
lostcalpolydude
07-15-2011, 07:14 AM
You can always put the items in a trade request to be extra safe, if the recipient is online.
zarqon
07-19-2011, 12:28 AM
I sent the wrong person a VIP invite once due to a mistype (never got it back, either). I've been just as careful ever since.
Banana Lord
11-07-2011, 08:25 AM
Is there any way I can change the capitalization of my name in registry? It comes up as "banana lord" and I'd prefer "Banana Lord". Oh yeah, I get WAY more OCD than that ;). Just idle curiosity really, if it'd require something on your end, Zarqon, don't bother :).
Theraze
01-17-2012, 05:04 AM
There's apparently a script name-checking bug. I'm not sure if it's possible to come up if you don't screw up the script name like I did, but...
> registry
Registering URL for 'TheSea.ash'...
URL for 'TheSea.ash' successfully modified.
Deleting processed mail...
1 message deleted.
Printing report...
Script Registry report for Theraze: 2 scripts, 9 users.
Script Registered URL? Users
The Sea 1/14/12 yes 9
TheSea.ash 1/17/12 no 0 Everything happens to the incorrectly named "The Sea" script, not the correctly named "TheSea.ash" script. I can't set url, registrer users, anything... at this point, do I just accept that the name will be wrong? I can register and unregister on the right name, I just can't set the URL or have people actually registered to it.
lostcalpolydude
01-17-2012, 11:34 AM
Mafia will only send a message the first time someone runs the script and I used notify on my script once before so those people aren't sending me new messages, but fortunately I'd saved those mails in a text file in case I was ever curious about them. It wasn't too hard to modify your script to read in the old messages using file_to_map so I was able to get those old registrations into your database. ;)
I just decided to use this script and ran into the same issue. I ended up using visit_url after figuring out how the script works to get the registry up to date. All of the messages were in my Saved folder, but api.php has no way of reading those.
So? Modify the script to read from messages.php?box=Saved if you want to get them. It'll be a bit harder to modify this version of the script for that than the original pre- api.php version, but it's still doable. The question is how much you want to rescue those registrations from obscurity.
lostcalpolydude
01-22-2012, 12:04 AM
So? Modify the script to read from messages.php?box=Saved if you want to get them. It'll be a bit harder to modify this version of the script for that than the original pre- api.php version, but it's still doable. The question is how much you want to rescue those registrations from obscurity.
That would take me about a week to figure out how to parse the page. I found my own solution to include the old information, so my motivation to write anything that implements the niche feature has gone way down. Just pointing out that if someone ever gets really bored, it's something they could maybe look at.
fronobulax
03-23-2012, 02:36 PM
Everything working fine on the back end? I seem to recall a couple php errors going by. I've been trying to register a URL but it doesn't seem to show up in the report. Ditto with a couple users. Some output below.
Checking for updates (running Script Registry ver. 1.7)...
Running Script Registry version: 1.7 (current)
Registering Winterbay for 'ManageAlice.ash'...
Success! Winterbay is now registered as a user of your 'ManageAlice.ash' script.
Registering Asturia for 'ManageAlice.ash'...
Success! Asturia is now registered as a user of your 'ManageAlice.ash' script.
Deleting processed mail...
2 messages deleted.
Printing report...
Script Registry report for fronobulax: 7 scripts, 31 users.
Followed by this report that doesn't seem aware that ManageAlice just picked up two users.
Script Registered URL? Users
DCQuest.ash 3/13/10 yes 12
alice.ash 5/25/11 yes 12
DC2Wiki.ash 7/12/11 no 1
DCPrune.ash 7/18/11 no 4
AliceNoPull 11/21/11 no 1
Stuffies.ash 12/23/11 no 1
ManageAlice.ash 3/22/12 no 0
Thanks.
Theraze
03-24-2012, 05:29 AM
For fun, check if alice.ash is registered with your new URL and users. This could be the same bug I was seeing when trying to unregister The Sea and register TheSea.ash in post 97 here.
Powered by vBulletin® Version 4.1.12 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.