Be Excellent To Each Other
https://www.beexcellenttoeachother.com/forum/

MafiaScum Tools
https://www.beexcellenttoeachother.com/forum/viewtopic.php?f=9&t=1324
Page 1 of 1

Author:  Cras [ Tue Jul 15, 2008 13:11 ]
Post subject:  MafiaScum Tools

For anyone who wishes to use it, attached to this post is the mafiascum vote counter tool. The compiled exe is in there and should require only .NET 2.0 to run. You may also need a copy of mshtml.dll to run it, which you can grab off the web if you don't have it. The only known compatibility issue is currently with XP64. Or possibly just with Grim...

It's simple to run - just put the thread number in the relevant box and hit 'Scan'. It'll take a minute or so to load up all the pages and generate the vote count. All threads will need to contain the list of players in the following format:

[playerlist]
player1
player2
player3
...
[/playerlist]

All votes will need to be in the format [vote:player1] to be counted.

Thanks to RichardGaywood for adding in the nolynch functionality.

The source code is also included - if anyone wants to make any modifications all I ask is that they provide it back to me afterwards so we keep a converged version of the app in this post. It's in VS2005 format.

Author:  The Rev Owen [ Wed Jul 16, 2008 10:16 ]
Post subject:  Re: MafiaScum Tools

By thread number, do you just mean I or II or whatever? Or do you mean 1334, for day one of the current game?

I keep getting an error that I think is saying it can't find mshtml.dll, even though I've got it.

Author:  Dudley [ Wed Jul 16, 2008 11:00 ]
Post subject:  Re: MafiaScum Tools

Hmm, the exe exceptions on mine with an "Index outside the bounds of the Array" error.

I'd need to install visual basic (seriously, VB? Is it 1995?) to debug :)

Author:  Dudley [ Wed Jul 16, 2008 11:01 ]
Post subject:  Re: MafiaScum Tools

Aha, the error was me typoing the thread number.

Author:  Doctor Glyndwr [ Wed Jul 16, 2008 11:01 ]
Post subject:  Re: MafiaScum Tools

Dudley wrote:
Hmm, the exe exceptions on mine with an "Index outside the bounds of the Array" error.
That means it's running but not happy about the input. Is your thread number valid? Try 1334.

Author:  Dudley [ Wed Jul 16, 2008 11:04 ]
Post subject:  Re: MafiaScum Tools

Hah, yeah I'd read it as 1344 :)

That could do with an error trap but I can't really sit here with VS closed whilst I add VB, I'll install later and have a poke at the code :)

Author:  Doctor Glyndwr [ Wed Jul 16, 2008 11:17 ]
Post subject:  Re: MafiaScum Tools

Dudley wrote:
I'll install later and have a poke at the code :)
Good, go hack some support in for an AsylumList of players who cannot vote can be voted for. I'd do it but Craster's string manipulation makes my head hurt.

Aside: someone buy Craster a copy of Regular Expression for Beginners :D

Author:  Dudley [ Wed Jul 16, 2008 11:24 ]
Post subject:  Re: MafiaScum Tools

Oh god, I can't do regexs at all, I may not be your guy.

Maybe I can convince JamesOff to do it.

Author:  Doctor Glyndwr [ Wed Jul 16, 2008 11:26 ]
Post subject:  Re: MafiaScum Tools

Dudley wrote:
Oh god, I can't do regexs at all, I may not be your guy.
No no. It doesn't use regexps, is what I'm saying, just a lot of substring and indexof. I'd prefer it if it did use regexps :DD

Author:  Dudley [ Wed Jul 16, 2008 11:28 ]
Post subject:  Re: MafiaScum Tools

Ah good, then this might be up my street :D

Author:  Mr Dave [ Wed Jul 16, 2008 11:28 ]
Post subject:  Re: MafiaScum Tools

I agree with the Gaywood. The sheer bulk of code here makes my head hurt, and not just because it's vb.

Author:  Doctor Glyndwr [ Wed Jul 16, 2008 11:35 ]
Post subject:  Re: MafiaScum Tools

Mr Dave wrote:
I agree with the Gaywood. The sheer bulk of code here makes my head hurt, and not just because it's vb.
You do badass assembler things! Surely this low level stuff is bread and butter to you? I just assumed it made my head hurt because I am a high level weenie.

Author:  Dudley [ Wed Jul 16, 2008 11:41 ]
Post subject:  Re: MafiaScum Tools

VB described as low level.

That's a new one on me.

Author:  Grim... [ Wed Jul 16, 2008 11:43 ]
Post subject:  Re: MafiaScum Tools

Yeah, me too.

Author:  Doctor Glyndwr [ Wed Jul 16, 2008 11:45 ]
Post subject:  Re: MafiaScum Tools

Dudley wrote:
VB described as low level.
Hah. Well, quite, good point. Nevertheless I maintain that string parsing a HTML page with indexof and other similar <string.h> concepts is low level compared to regexps and other 20th century inventions.

Author:  Dudley [ Wed Jul 16, 2008 11:48 ]
Post subject:  Re: MafiaScum Tools

Well that's going to suit my brain a lot more than the keyboard diarrhoea that is regexps.

Author:  Doctor Glyndwr [ Wed Jul 16, 2008 11:51 ]
Post subject:  Re: MafiaScum Tools

Quote:
If votes.ContainsKey(tags(count).Substring(tags(count).ToLower.IndexOf("[vote", 0) + 6, iNameEnd - tags(count).ToLower.IndexOf("[vote", 0) - 6).ToLower.Trim) Or tags(count).Substring(tags(count).ToLower.IndexOf("[vote", 0) + 6, iNameEnd -
tags(count).ToLower.IndexOf("[vote", 0) - 6).ToLower.Trim = "unvote" Then


I have been "office regexp guy" in two workplaces running now. Probably because I'm a former professional Perl programmer who keeps taking jobs in Microsoft shops.

Author:  Dudley [ Wed Jul 16, 2008 11:53 ]
Post subject:  Re: MafiaScum Tools

Nothing confusing about that snippet.

Author:  Mr Dave [ Wed Jul 16, 2008 12:14 ]
Post subject:  Re: MafiaScum Tools

richardgaywood wrote:
Mr Dave wrote:
I agree with the Gaywood. The sheer bulk of code here makes my head hurt, and not just because it's vb.
You do badass assembler things! Surely this low level stuff is bread and butter to you? I just assumed it made my head hurt because I am a high level weenie.


Depends on what I'm doing. A website scraper such as that I'd have done in c# with a certain amount of regex.

Main code for games, I'd use c++ (With assembly if the optimisation in the compiler coughs). The thing about c++ is that the code then is all very information dense and neatly divided, and therefore easy to read. vb code is not dense, nor neatly divided, and so I find it really hard to read. Combine that with anything remotely complicated, and I can't find the willpower to read it. The same stuff in regular expressions would have been easy.

The upshot of this is that if I wanted to do anything to this (and there are a couple of things I would think of doing - a history function would be most handy, for example ), I'd pretty much have to rewrite the entire thing. (in c#)

Author:  Mr Dave [ Wed Jul 16, 2008 12:40 ]
Post subject:  Re: MafiaScum Tools

Alternatively, I could hack bits out of the code and chuck them together and make me a lovely history page.

Author:  The Rev Owen [ Wed Jul 16, 2008 12:41 ]
Post subject:  Re: MafiaScum Tools

Quote:
Could not load file or assembly 'Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system could not find the file specified.


But I have an mshtml.dll file, version 7.0.6000.16674. I've installed Service Pack 3, run Windows Update and everything and I'm still getting exactly the same error.

Author:  Dudley [ Wed Jul 16, 2008 12:44 ]
Post subject:  Re: MafiaScum Tools

A very quick and dirty hack for arkham players would be simply to add a little edit box for "# of confined players".

Author:  Doctor Glyndwr [ Wed Jul 16, 2008 12:48 ]
Post subject:  Re: MafiaScum Tools

I think I can get it working with an [asylumlist].

Author:  Dudley [ Wed Jul 16, 2008 12:48 ]
Post subject:  Re: MafiaScum Tools

Also good.

Author:  The Rev Owen [ Wed Jul 16, 2008 13:35 ]
Post subject:  Re: MafiaScum Tools

Right, I've uninstalled all the million different .Net framework installs listed on my PC. One wouldn't install, coming up with errors suspiciously similar to the one I was running the vote counter, but it disappeared from the list when I removed one of the other ones.

Um.

So now I'm getting a different error message when trying to run the vote counter (an exciting access violation) and I'm redownloading the .Net framework to see if I clean (or is it?) install will help.

Fun.

Author:  The Rev Owen [ Wed Jul 16, 2008 14:03 ]
Post subject:  Re: MafiaScum Tools

And with the .Net framework completely reinstalled from scratch, I get the same old error again.

I think I may just have to rely on the kindness of players to do the vote counts during this game.

Sorry, but I can't think of anything else to try. A reformat and reinstall is out, as this is a work machine.

Author:  ElephantBanjoGnome [ Wed Jul 16, 2008 15:35 ]
Post subject:  Re: MafiaScum Tools

The Rev Owen wrote:
By thread number, do you just mean I or II or whatever? Or do you mean 1334, for day one of the current game?

I keep getting an error that I think is saying it can't find mshtml.dll, even though I've got it.

Put the file in the same directory as the executable.

Also ensure you're logged into the forum via IE and select 'Remember Me' when logging in. I had similar issues.

Author:  The Rev Owen [ Wed Jul 16, 2008 15:38 ]
Post subject:  Re: MafiaScum Tools

I've tried both of those things, I'm afraid.

I'm now downloading the whole .Net SDK, because that seems to have solved the problem for some people.

Author:  Dudley [ Wed Jul 16, 2008 15:43 ]
Post subject:  Re: MafiaScum Tools

Weird, I'm quite happy to keep up with it though.

Author:  The Rev Owen [ Wed Jul 16, 2008 15:49 ]
Post subject:  Re: MafiaScum Tools

Oooh! It seems to be working!

Not sure if it was installing the SDK or changing my setup so IE was the default browser. I should have tried one before the other, really.

Anyway, it now works! Hooray!

Now I have to hope it runs a bit more easily on my PC at home...

Author:  Dudley [ Wed Jul 16, 2008 15:59 ]
Post subject:  Re: MafiaScum Tools

I don't have IE as default and it works fine fwiw.

Author:  Cras [ Wed Jul 16, 2008 17:30 ]
Post subject:  Re: MafiaScum Tools

Dudley wrote:
I don't have IE as default and it works fine fwiw.


Yeah, I fixed that bug. Basically it was because guests couldn't view the MS forum, so if you didn't have an IE cookie logging you in, the app couldn't access the thread.

Also, If anyone can find a way to strip multiple versions of possibly multiple-layer nested tags from a string that can possibly contain malformed tags using a regex, I will give them a cookie.

Author:  The Rev Owen [ Wed Jul 16, 2008 18:05 ]
Post subject:  Re: MafiaScum Tools

Getting the same error message that I got at work at home, so am downloading the full SDK again. Hope it works on this machine too.

Author:  Cras [ Wed Jul 16, 2008 18:44 ]
Post subject:  Re: MafiaScum Tools

If it's an MSHTML error, try the following:

Drop the dll into both system32 and the directory the counter executable is in, and try again.

Run regsvr32 <path to mshtml.dll>\mshtml.dll and try again.

Author:  The Rev Owen [ Wed Jul 16, 2008 19:29 ]
Post subject:  Re: MafiaScum Tools

Nope, only SDK install fixed it.

Author:  Cras [ Wed Jul 16, 2008 19:36 ]
Post subject:  Re: MafiaScum Tools

Bizarro.

Author:  Mr Dave [ Wed Jul 16, 2008 19:38 ]
Post subject:  Re: MafiaScum Tools

.net was supposed to stop theis kind of dll hell.

Bah, I says.

Author:  Grim... [ Mon Mar 09, 2009 12:20 ]
Post subject:  Re: MafiaScum Tools

Not very tested, but seems okay:
http://www.beexcellenttoeachother.com/counter/?t=3427
t is the topic id, obv.

Author:  Doctor Glyndwr [ Mon Mar 09, 2009 12:22 ]
Post subject:  Re: MafiaScum Tools

Grim... wrote:
Not very tested, but seems okay:
http://www.beexcellenttoeachother.com/counter/?t=3427
t is the topic id, obv.
Good work. Suggest Curio puts this link in his sig.

Author:  Grim... [ Mon Mar 09, 2009 12:24 ]
Post subject:  Re: MafiaScum Tools

I think we should wait for this day to end, in case it doesn't tally.
Seems okay with all the older days, though. And you can have a space in your vote :)

Author:  Doctor Glyndwr [ Mon Mar 09, 2009 12:24 ]
Post subject:  Re: MafiaScum Tools

Grim... wrote:
I think we should wait for this day to end, in case it doesn't tally.
Seems okay with all the older days, though. And you can have a space in your vote :)
I'm running Craster's one here, and it agrees with that as of right now. I will continue to check both.

Author:  Curiosity [ Mon Mar 09, 2009 12:30 ]
Post subject:  Re: MafiaScum Tools

Cheers for that, gents.

Author:  Cras [ Mon Mar 09, 2009 12:38 ]
Post subject:  Re: MafiaScum Tools

Grim... wrote:
Not very tested, but seems okay:
http://www.beexcellenttoeachother.com/counter/?t=3427
t is the topic id, obv.


Nice.

Author:  kalmar [ Mon Mar 09, 2009 12:39 ]
Post subject:  Re: MafiaScum Tools

It's failed to pick up your unvote there Grim...
Good work though, very handy.

Author:  Grim... [ Mon Mar 09, 2009 12:42 ]
Post subject:  Re: MafiaScum Tools

It did, sir. I stopped voting for Malc, but Malc is still voting for me.

Author:  Grim... [ Mon Mar 09, 2009 12:43 ]
Post subject:  Re: MafiaScum Tools

The game would get dull fast if you could unvote people from you ;)

Author:  Curiosity [ Mon Mar 09, 2009 12:43 ]
Post subject:  Re: MafiaScum Tools

We should probably lock all these non-game threads...

Author:  Doctor Glyndwr [ Mon Mar 09, 2009 12:45 ]
Post subject:  Re: MafiaScum Tools

Curiosity wrote:
We should probably lock all these non-game threads...
I've locked the signup thread. This one should probably stay though, if only so people can report bugs with the tools.

Author:  myp [ Mon Mar 09, 2009 12:47 ]
Post subject:  Re: MafiaScum Tools

I locked every thread apart from the game one when I was (Science - SkeptoEd). I am a tyrant, however.

Author:  Curiosity [ Wed Mar 11, 2009 8:58 ]
Post subject:  Re: MafiaScum Tools

For my convenience...

http://www.beexcellenttoeachother.com/counter

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/