The Count-Counter 2000
- Norinel
-
Norinel Not Voting (3)
- Norinel
- Not Voting (3)
- Not Voting (3)
- Posts: 1684
- Joined: March 2, 2003
- Location: My computer
The Count-Counter 2000
A discussion on chat long ago about modhelpers inspired me to make something that'd do vote counts, since they seem to be quite confusing in chat games and can take a little while in large forum games. So I made this (Editted to correct link), showed it around a little, forgot about it, went away for a week, and got reminded again by the bumping of the role distributor thread.
I might change the name, but it'll always be cooler than "Mafia Scum Tools". Feel free to give names, designs, bugs, features, accolades, etc.Last edited by Norinel on Thu Mar 30, 2006 6:34 am, edited 1 time in total.-
-
Corsato
- Norinel
-
Norinel Not Voting (3)
- Norinel
- mathcam
-
mathcam Captain Observant
- mathcam
- Captain Observant
- Captain Observant
- Posts: 6116
- Joined: November 22, 2002
- mathcam
-
mathcam Captain Observant
- mathcam
- Captain Observant
- Captain Observant
- Posts: 6116
- Joined: November 22, 2002
- Norinel
-
Norinel Not Voting (3)
- Norinel
- Not Voting (3)
- Not Voting (3)
- Posts: 1684
- Joined: March 2, 2003
- Location: My computer
- Flying Dutchman
-
Flying Dutchman I never think
- Flying Dutchman
- I never think
- I never think
- Posts: 1941
- Joined: November 21, 2003
- Location: The land of clogs, tulips, mills, and cheese!
-
-
Corsato
- Wacky
-
Wacky Goon
- Wacky
- Goon
- Goon
- Posts: 866
- Joined: July 16, 2003
- Location: Sydney, Australia
I've been thinking about whether a script can be written so that you could insert a vote count by just pressing a button and it will count it for you (probably will have to be displayed all for htat to work)
The problem is, does a javascript thingy that goes through the page [looking for instances of <b>vote: </b> that aren't also in quotes ] have to be part of the code itself? I think it doesn't have to be but I'm not sure how that would work easily. Does anyone know what the javascript console in firefox does exactly? It seems to be able to run java code but when I tell it to do stuff to the document (document.writeln("hello world"); or something) it doesn't seem to work. Or maybe I just missed it, I dunno....whatever remains, however improbable, must be the truth.- Malaprop
-
Malaprop Goon
- Malaprop
- Goon
- Goon
- Posts: 231
- Joined: September 30, 2003
- Location: Chi-town
- Contact:
Yeah, you could have Javascript that counts votes. See Jesse Ruderman's Bookmarklets for an extreme example of some of the cool stuff you can do. Some of the web-development ones have saved me a significant amount of time at work, and it's probably the best format for this sort of thing. Either define a standard tag to start/end days, or write the js so that it goes through all the selected text for votes, and you select a day at a time when using it. Would not be too bad to write.[size=84]gim sumun.bi shà-thir-ma u ba-rì[/size]- Norinel
-
Norinel Not Voting (3)
- Norinel
- Not Voting (3)
- Not Voting (3)
- Posts: 1684
- Joined: March 2, 2003
- Location: My computer
- Norinel
-
Norinel Not Voting (3)
- Norinel
- Not Voting (3)
- Not Voting (3)
- Posts: 1684
- Joined: March 2, 2003
- Location: My computer
-
-
BlueSin
- Wacky
-
Wacky Goon
- Wacky
- Goon
- Goon
- Posts: 866
- Joined: July 16, 2003
- Location: Sydney, Australia
Okay, I've begun thinking about how exactly I would go about this, and I think I have all the pieces of the puzzle.
The major impediment so far has been that I don't know javascript, so I'm just using bits of code I have encountered so far. Plus I'm lazy. So I'll just post my algorithm and if there's an easier way of going about this (e.g. with this DOM thingy) someone could possibly let me know.
0. Program would have to be formatted as a bookmarklet (or it could be incorporated into the page itself, but that's really unlikely to happen) From what I can tell, all that needs is to put javascript:function( - code here with no spaces - ) [or something along those lines, just copy exact syntax and paste]
1. Do interface thingy -> somehow get **:
The text for the day "tag" (so it could be customised to either something like "It's Day" or a post number)
get list of alive players
---> more on this later
2. Take the thread's text, put it to lowercase
2a) take out all the stuff up to the day tag. If no day tag, don't take anything out, but add error message ##
3. Repeat the following:
Get next vote location:
i) find the location of the next substring containing "vote"
ii) AND bolded
iii) AND not between quote tags
I think there's specific html code fragments that would work, can't remember what they are exactly right now (it's late).
Get votee:
i) search it for substrings that match any on player list
ii) otherwise, skip any ":" or " " and just append it on the error messages
Get voter:
i) Go back until you hit the relevant html code fragments
ii) Search back (or forward, I forget) until you hit a player or the other end of that code.
Then get their player numbers and chuck it into Norinel's changeVote function
Then I think you need to feed some of the results back into Norinel's code some more
Then make it output onto this quick reply thing instead of voteform.
and append the error message at the end of it
## too many people are going to do stuff likeVote: IS. which won't match with Internet Stranger.
** I'm thinking either an interface like norinel's that you can save (and somehow keep the player names as well, just with an Alive checkbox or something), which would just generate an appropriate bookmarklet, or a series of prompts (typing in a bazillion names whenever someone dies is going to be annoying), or getting the player list off the page itself (which would be hard to do, I think).
P.S. Norinel - there's still a reference to "voteform" in the non-interface part of the code....whatever remains, however improbable, must be the truth.- Fletcher
-
Fletcher Eligible for a Title
- Fletcher
- Eligible for a Title
- Eligible for a Title
- Posts: 1069
- Joined: July 15, 2003
- Location: Missouri
- Contact:
- Norinel
-
Norinel Not Voting (3)
- Norinel
- Not Voting (3)
- Not Voting (3)
- Posts: 1684
- Joined: March 2, 2003
- Location: My computer
Okay.Wacky wrote:Okay, I've begun thinking about how exactly I would go about this, and I think I have all the pieces of the puzzle.
I'm just the second part, though my JS knowledge is far from perfect.The major impediment so far has been that I don't know javascript, so I'm just using bits of code I have encountered so far. Plus I'm lazy.
The one of these I have lying around doesn't have any spaces either, which I believe is a browser thing. Can you escape the spaces that have to be in strings?0. Program would have to be formatted as a bookmarklet (or it could be incorporated into the page itself, but that's really unlikely to happen) From what I can tell, all that needs is to put javascript:function( - code here with no spaces - ) [or something along those lines, just copy exact syntax and paste]
It might also work if you had a frameset with the code in the top frame and the thread in the bottom one.
The post number's not that bad; search for <span class="gen"> </span> Post subject: $NUM </span>. (At least on viewtopic.php; it might work better to do this from the Print This Page, which has less junk.)1. Do interface thingy -> somehow get **:
The text for the day "tag" (so it could be customised to either something like "It's Day" or a post number)
These may not be necessary.2. Take the thread's text, put it to lowercase
2a) take out all the stuff up to the day tag. If no day tag, don't take anything out, but add error message ##
Quotes are in a <td class="quote"> tag, bolding is in a <span style="font-weight: bold"> tag.3. Repeat the following:
Get next vote location:
i) find the location of the next substring containing "vote"
ii) AND bolded
iii) AND not between quote tags
I think there's specific html code fragments that would work, can't remember what they are exactly right now (it's late).
And check if it's an unvote, in which case the votee needs to be set to 0 and you need to start as close after the unvote for people who do "unvote: whomever, vote: IS".Get votee:
i) search it for substrings that match any on player list
ii) otherwise, skip any ":" or " " and just append it on the error messages
<span class="name"><a name="(some number)"></a><b>$NAME</a></b></span>.Get voter:
i) Go back until you hit the relevant html code fragments
ii) Search back (or forward, I forget) until you hit a player or the other end of that code.
For this, you'd probably want to modify changeVote so it doesn't call updateCount at the end. The checking to see if someone's lynched will only do it for the person who the vote is changing to, which will cause problems if there's post-twilight changes.Then get their player numbers and chuck it into Norinel's changeVote function
I think the only thing that'd need to be done is to call updateCount, if you took it out of changeVote.Then I think you need to feed some of the results back into Norinel's code some more
Both trivial.Then make it output onto this quick reply thing instead of voteform.
and append the error message at the end of it
It'd probably need to store abbreviations with the names, or be smart enough to come up with them on its own. All the capital letters in a nick, the first letter in all the words in a nick, or the nick without any numbers covers most of the common ones.## too many people are going to do stuff likeVote: IS. which won't match with Internet Stranger.
With the frame method, it'd be possible to have a text box to paste the playerlist into. Getting the playerlist off the front post would require knowing something about the mod's individual format or being smart.** I'm thinking either an interface like norinel's that you can save (and somehow keep the player names as well, just with an Alive checkbox or something), which would just generate an appropriate bookmarklet, or a series of prompts (typing in a bazillion names whenever someone dies is going to be annoying), or getting the player list off the page itself (which would be hard to do, I think).
That line's redundant; it'll be gone in the next update.P.S. Norinel - there's still a reference to "voteform" in the non-interface part of the code.- Seol
-
Seol Logical Rampage
- Seol
- Logical Rampage
- Logical Rampage
- Posts: 1563
- Joined: November 26, 2004
- Location: In the wrong
OK, so, like, major necro, I know.
None of the links are working for me and I'm highly intrigued by this tool.
Does anyone have a link to it that works, or a copy they could e-mail me?
TIA[i]The hungry maw of Twilight snaps, but shall not have its fill,
Until one man hangs by his neck, by half this curs'd town's will[/i]- Commodore Amazing
-
Commodore Amazing Out-booyahed
- Commodore Amazing
- Out-booyahed
- Out-booyahed
- Posts: 1912
- Joined: March 8, 2005
- Location: Chicago, IL
- Thok
-
Thok Disgrace to SKs everywhere
- Thok
- Disgrace to SKs everywhere
- Disgrace to SKs everywhere
- Posts: 7013
- Joined: March 28, 2005
- Phoebus
-
Phoebus Hall Monitor
- Phoebus
- Hall Monitor
- Hall Monitor
- Posts: 3743
- Joined: October 19, 2003
- Norinel
-
Norinel Not Voting (3)
- Norinel
- Not Voting (3)
- Not Voting (3)
- Posts: 1684
- Joined: March 2, 2003
- Location: My computer
- Mr. Flay
-
Mr. Flay Metatron
- Mr. Flay
- Metatron
- Metatron
- Posts: 24969
- Joined: March 12, 2004
- Location: Gormenghast
- Contact:
- LoudmouthLee
-
LoudmouthLee Mafia Scum
- LoudmouthLee
- Mafia Scum
- Mafia Scum
- Posts: 2653
- Joined: February 15, 2005
- Location: New York City
- Contact:
- LoudmouthLee
- Mr. Flay
- Norinel
- Phoebus
- Thok
- Commodore Amazing
- Seol
- Norinel
- Fletcher
- Wacky
- Norinel
- Norinel
- Malaprop
- Wacky
- Flying Dutchman
- Norinel
- mathcam
- mathcam
- Norinel