Browser Extension Vote-Counter (early demo)

This forum is for discussion related to the game.
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13224
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀
Contact:

Browser Extension Vote-Counter (early demo)

Post Post #0 (ISO) » Sat Sep 02, 2023 5:50 am

Post by JacksonVirgo »

Hey there,

I've recently been working on a new vote-counter / mod-tool / player-tool project. I found that most tools either needed you to have some technical skills OR relied on a persistent server. Both of which are either unreliable or created a pretty hefty barrier to entry. I created a browser extension tool that bakes the functionality into the MafiaScum site itself to make using the tool as easy as accessing the site normally.

DISCLAIMER:
The tool is in early development and while it should all be functional, it is by no means confirmed to be super reliable.

Spoiler: Demo Video


Spoiler: Game Definition File

The .yaml file in the demo video is formatted as below. Make sure to replace all the required information and remove whatever you don't need. The only required section is the player list

Code: Select all

players:
    - Username
    - Username2

dead:
    Username: 123 # Post number of which they died.

startFrom: 123 # Post number of which to start from (usually a day start, if not added defaults to post 0)
endAt: 909 # If added, ends the counting at a particular post.

aliases:
    Username:
        - Alias1
        - Alias2
    Username2:
        - OtherAlias

Spoiler: Example Output
Link to game
Current Votes
JacksonVirgo (5/5)
-> Greeting (), wavemode (), Enchant (), JacksonVirgo (), Cat Scratch Fever ()
Cat Scratch Fever (1/5)
-> Toogeloo ()

Not Voting (3)
-> StrangeMatter, Malakittens, Dwlee99

Spoiler: Installation Process

This is for desktops only, don't try and install on a mobile (I got no idea if there's even mobile browser extensions)

I will eventually have this project on an unlisted extension store (for all major browsers except Safari) but for now you'll need to load the extension yourself. Download the latest versions zip file here (don't download the source code) into a folder you will not be deleting (the extension will be run from here). Extract the folder so you can access the "manifest.json" file.

If you're downloading a version that has multiple sub-versions (v2/v3). If you're using a chrome-based browser, use v3 otherwise use v2.

All Chrome-based browsers should work like the following:
1. Enter your Extensions menu (the jigsaw piece lookin' icon). You can also write "chrome://extensions", "brave://extensions/" etc into the URL bar depending on the browser.
2. Enable Developer mode. Top-right area in both Brave and Chrome.
3. Hit the "Load Unpacked" button on the top-left area.
4. A file browser will appear, find the "manifest.json" file and load that file.
5. The extension should now be active and running.

To update to newer versions. Delete/remove the extension from the Extension page (I'm not sure what will happen if you just delete the folder, but maybe that works too). Then repeat this process for newer versions.

Soon, when the extension is on stores you should be able to update it without any issues just like any other extension



The .yaml settings file can contain a few sections, I will list them below with a description of how to write them. Like always, the player list is the only that is required.

Spoiler: Game Definition File Explained

The hash (#) means anything afterwards is a comment (does nothing), and thus can be ignored/deleted.

Unless you know what you are doing, keep the formatting as strict to what I've written as you can

Player List

List all the current players, remove any players that are replaced out and add in their new account. This will be done automatically on a later update, but for now it needs to be done.

Code: Select all

players:
	- player_name
	- second_player_name


Dead

List all the dead players, and the post they have died in.

Code: Select all

dead:
	player_name: 123 # Post number of which they died.


Replacements

For each individual replacement, show who was replaced by who.
Make sure to create a brand new list item for each new replacement, even if it was from a slot that had a replacement before.
Below is an example player_one was replaced by player_two who then went and replaced out again.

Code: Select all

replacements:
    player_one:
        - player_two
    player_two:
        - most_recent_player


Aliases / Nicknames

Sometimes the bot cannot know the difference between what people are referred to as (CSF) as compared to what they are listed as under this tool (Cat Scratch Fever). List out all you know they're being referred under in this section

Code: Select all

aliases:
    username:
        - Alias1
        - Alias2
    Cat Scratch Fever:
        - CSF



Spoiler: Example Game Definition File

Code: Select all

## List all the current players here.
## You will need to list replacements here and in a replacements section
## The duplication will be removed in a later version
players:
    - Username
    - Username2
    
## List all the players that have died, and the post they died in.
dead:
    Username: 123 # Post number of which they died.
    
## For each individual replacement, show who was replaced by who. Create a brand new list item for each new replacement, even if it was from a slot that had a replacement before.

replacements:
    OldPlayerUsername:
        - NewPlayerUsername
    player2:
        - player2's replacement

startFrom: 123 # Post number of which to start from (usually a day start, if not added defaults to post 0)
endAt: 909 # If added, ends the counting at a particular post.

aliases:
    Username:
        - Alias1
        - Alias2
    Username2:
        - OtherAlias
Last edited by JacksonVirgo on Sun Dec 17, 2023 2:18 am, edited 3 times in total.
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
Psyche
Psyche
he/they
Survivor
User avatar
User avatar
Psyche
he/they
Survivor
Survivor
Posts: 10721
Joined: April 28, 2011
Pronoun: he/they

Post Post #1 (ISO) » Sun Sep 03, 2023 9:56 am

Post by Psyche »

Cool. Do you think a page topper would be hard to add as an additional feature?
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13224
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀
Contact:

Post Post #2 (ISO) » Sun Sep 03, 2023 3:56 pm

Post by JacksonVirgo »

In post 1, Psyche wrote: Cool. Do you think a page topper would be hard to add as an additional feature?
A page topper as in a bot that snipes the top of each page?
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
Thestatusquo
Thestatusquo
He/Him
Shea

User avatar
User avatar
Thestatusquo
He/Him
Shea

Shea

Posts: 14371
Joined: July 27, 2006
Pronoun: He/Him
Location: Chicago!

Post Post #3 (ISO) » Thu Sep 07, 2023 6:54 am

Post by Thestatusquo »

this is sick.
tout comprendre c'est tout pardonner
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13224
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀
Contact:

Post Post #4 (ISO) » Mon Sep 11, 2023 12:57 pm

Post by JacksonVirgo »

If anybody wants specific forum functionality (within reason) that can be added with this too. I'm gonna flesh the rest of it out today
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13224
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀
Contact:

Post Post #5 (ISO) » Thu Sep 14, 2023 10:43 pm

Post by JacksonVirgo »

First update.

The vote-counter is working. Tested on Chrome and Brave. Firefox is temporarily not available but this is planned to be changed ASAP (within a week). The browser requires a .yaml or .yml file with data about the vote counter. If I find time, I will make sure to add different options such as
  • No-Data Vote Counts (shows you a generic list of all votes)
  • VC Settings in Post 0.
  • UI to input data to be stored and managed by the extension itself rather than as a file
But for now, the .yaml file is as follows. Make sure to replace all needed data and remove the values that are not needed.
The only required parts are the player list.

Spoiler: Yaml File

Code: Select all

players:
    - Username
    - Username2

dead:
    Username: 123 # Post number of which they died.

startFrom: 123 # Post number of which to start from (usually a day start, if not added defaults to post 0)
endAt: 909 # If added, ends the counting at a particular post.

aliases:
    Username:
        - Alias1
        - Alias2
    Username2:
        - OtherAlias

Spoiler: Example Output
Link to game
Current Votes
JacksonVirgo (5/5)
-> Greeting (), wavemode (), Enchant (), JacksonVirgo (), Cat Scratch Fever ()
Cat Scratch Fever (1/5)
-> Toogeloo ()

Not Voting (3)
-> StrangeMatter, Malakittens, Dwlee99


I will be slowly adding functionality such as:
  • Customisable formatting
  • Warnings for when a name spell-checking isn't entirely confident.
  • That's all I can think of but I wanted a third point
Installation Process

This is for desktops only, don't try and install on a mobile (I got no idea if there's even mobile browser extensions)

I will eventually have this project on an unlisted extension store (for all major browsers except Safari) but for now you'll need to load the extension yourself. Download the zip file here into a folder you will not be deleting (the extension will be run from here). Extract the folder so you can access the "manifest.json" file.

All Chrome-based browsers should work like the following:
1. Enter your Extensions menu (the jigsaw piece lookin' icon). You can also write "chrome://extensions", "brave://extensions/" etc into the URL bar depending on the browser.
2. Enable Developer mode. Top-right area in both Brave and Chrome.
3. Hit the "Load Unpacked" button on the top-left area.
4. A file browser will appear, find the "manifest.json" file and load that file.
5. The extension should now be active and running.

To update to newer versions. Delete/remove the extension from the Extension page (I'm not sure what will happen if you just delete the folder, but maybe that works too). Then repeat this process for newer versions.

Soon, when the extension is on stores you should be able to update it without any issues just like any other extension
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
Thestatusquo
Thestatusquo
He/Him
Shea

User avatar
User avatar
Thestatusquo
He/Him
Shea

Shea

Posts: 14371
Joined: July 27, 2006
Pronoun: He/Him
Location: Chicago!

Post Post #6 (ISO) » Fri Sep 15, 2023 7:09 am

Post by Thestatusquo »

Was doing some testing and it doesn't seem like its accurately getting votes, seems to be having some trouble with users with spaces in their usernames.

I think the most desirable feature for non-technical users will be the ability to generate a yaml file and not have to make one themselves.
tout comprendre c'est tout pardonner
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13224
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀
Contact:

Post Post #7 (ISO) » Fri Sep 15, 2023 7:12 am

Post by JacksonVirgo »

In post 6, Thestatusquo wrote: Was doing some testing and it doesn't seem like its accurately getting votes, seems to be having some trouble with users with spaces in their usernames.

I think the most desirable feature for non-technical users will be the ability to generate a yaml file and not have to make one themselves.
Oh yeah? What game are you referring to, I can fiddle around to see what the problem is. Not sure if it’s spaces as the example game has CSF in it, who has spaces in her name.

The plan is to have different options for game definition stuff, I just started with yaml as that’s what osukas tool used.
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
Thestatusquo
Thestatusquo
He/Him
Shea

User avatar
User avatar
Thestatusquo
He/Him
Shea

Shea

Posts: 14371
Joined: July 27, 2006
Pronoun: He/Him
Location: Chicago!

Post Post #8 (ISO) » Fri Sep 15, 2023 7:18 am

Post by Thestatusquo »

Its possible this is just user error on my part, I'll keep fiddling around. It was having trouble picking up random nurse for me.

I'm trying to think of the best way to input data for non technical people. I think the first post approach is probably best for the non technical user.

But maybe an option to generate the game file with text input fields would be useful.
tout comprendre c'est tout pardonner
User avatar
Thestatusquo
Thestatusquo
He/Him
Shea

User avatar
User avatar
Thestatusquo
He/Him
Shea

Shea

Posts: 14371
Joined: July 27, 2006
Pronoun: He/Him
Location: Chicago!

Post Post #9 (ISO) » Fri Sep 15, 2023 7:26 am

Post by Thestatusquo »

No promises but I'm talking to bork about how we could maybe give mods the ability to just enter the players and the aliases directly in the first post natively which should maybe ultimately give you the ability to just give the tool a first post and a start and start point and nothing else.

I think there's a lot of ways we could make this easier on the admin side and I'll see what we can do. As always its a matter of prioritization.
tout comprendre c'est tout pardonner
User avatar
borkjerfkin
borkjerfkin
He/Him
Xenophile
User avatar
User avatar
borkjerfkin
He/Him
Xenophile
Xenophile
Posts: 10337
Joined: April 3, 2012
Pronoun: He/Him
Location: Madison, WI

Post Post #10 (ISO) » Fri Sep 15, 2023 7:30 am

Post by borkjerfkin »

yeah, posting here just to acknowledge that i'm following this effort and those like it. I'm committed to getting an environment available to people who want to do first party development on the site as my next major endeavor such that a tool like this could eventually be baked in if we decided that was useful, although the approach here tbh might just be good enough as it is. Nice work!
beefycheese
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13224
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀
Contact:

Post Post #11 (ISO) » Fri Sep 15, 2023 7:34 am

Post by JacksonVirgo »

In post 8, Thestatusquo wrote: Its possible this is just user error on my part, I'll keep fiddling around. It was having trouble picking up random nurse for me.

I'm trying to think of the best way to input data for non technical people. I think the first post approach is probably best for the non technical user.

But maybe an option to generate the game file with text input fields would be useful.
Yeah so the form currently has two inputs for start/end. I was going to make a proper form for it, that you can use a yaml file to autofill that. Maybe storing the data to disk as well to make it super quick to reuse it in a particular thread

I have to cut the reply short so sending this but will eventually respond to the other two :)
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13224
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀
Contact:

Post Post #12 (ISO) » Fri Sep 15, 2023 7:55 am

Post by JacksonVirgo »

In post 10, borkjerfkin wrote: yeah, posting here just to acknowledge that i'm following this effort and those like it. I'm committed to getting an environment available to people who want to do first party development on the site as my next major endeavor such that a tool like this could eventually be baked in if we decided that was useful, although the approach here tbh might just be good enough as it is. Nice work!
Oo that’d be so exciting.



On a more technical(?) side though if you’re considering baking in this into the site itself, instead of doing stuff in the first post etc, might be easier and more intuitive to use the activity overview page as that has a list of all users (that has posted) anyway so it shouldn’t be too difficult to extend that I would think. Unsure, just spitballing at work lol
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
Thestatusquo
Thestatusquo
He/Him
Shea

User avatar
User avatar
Thestatusquo
He/Him
Shea

Shea

Posts: 14371
Joined: July 27, 2006
Pronoun: He/Him
Location: Chicago!

Post Post #13 (ISO) » Fri Sep 15, 2023 8:08 am

Post by Thestatusquo »

The idea we were tossing around is, similar to how PTs currently work where there is a list of players who have permissions to post.

We've sort of discussed doing something like this in the past because it would also do some other cool things like prevent alt slips.
tout comprendre c'est tout pardonner
User avatar
borkjerfkin
borkjerfkin
He/Him
Xenophile
User avatar
User avatar
borkjerfkin
He/Him
Xenophile
Xenophile
Posts: 10337
Joined: April 3, 2012
Pronoun: He/Him
Location: Madison, WI

Post Post #14 (ISO) » Fri Sep 15, 2023 8:37 am

Post by borkjerfkin »

In post 12, JacksonVirgo wrote:
In post 10, borkjerfkin wrote: yeah, posting here just to acknowledge that i'm following this effort and those like it. I'm committed to getting an environment available to people who want to do first party development on the site as my next major endeavor such that a tool like this could eventually be baked in if we decided that was useful, although the approach here tbh might just be good enough as it is. Nice work!
Oo that’d be so exciting.



On a more technical(?) side though if you’re considering baking in this into the site itself, instead of doing stuff in the first post etc, might be easier and more intuitive to use the activity overview page as that has a list of all users (that has posted) anyway so it shouldn’t be too difficult to extend that I would think. Unsure, just spitballing at work lol
Maybe, although all the other mod control panel stuff is baked into posting.php right now so you get lots of validation stuff for free putting it there. But yeah certainly a lot more to figure out before (or if) we break ground on this kinda thing.
beefycheese
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13224
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀
Contact:

Post Post #15 (ISO) » Fri Sep 15, 2023 11:09 pm

Post by JacksonVirgo »

In post 13, Thestatusquo wrote: The idea we were tossing around is, similar to how PTs currently work where there is a list of players who have permissions to post.

We've sort of discussed doing something like this in the past because it would also do some other cool things like prevent alt slips.
Oh that'd actually be a really good idea, would also stop dead ppl from posting etc.
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13224
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀
Contact:

Post Post #16 (ISO) » Sat Sep 16, 2023 1:11 pm

Post by JacksonVirgo »

Update v0.0.3 Changelog:
Download Link
  • The wagon formatting will now have the larger wagons at the top.
  • No-Elimination now is implemented with unique majority mech. 50% of living players is needed rather than a flat majority.
  • I've implemented new game definition settings, allowing to disable specific functionality. Currently only can disable no-elim but can easily be extended or copied into a way to add special/unique functionality that isn't usually used.
  • Now has manifest v2 support (so now you can run it in Firefox, although the styling in firefox is kinda wacky cuz I haven't focused on designing for it yet)
Spoiler: Technical Changelog
Putting this in a spoiler as chances are, not everybody cares about this side of it.
  • Added README to the repository so anyone and their mother can know how to compile this for themselves (unless I worded it like I usually do, which is probably the case :D)
  • Changed the folder structure to make it clear what files are background scripts vs main scripts.
  • Added ESLint so I can avoid shooting myself in the foot later
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13224
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀
Contact:

Post Post #17 (ISO) » Sat Sep 16, 2023 1:23 pm

Post by JacksonVirgo »

Should probably have clarified. Chrome browsers should use the v3 and everything else should use v2.
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
T-Bone
T-Bone
He/Him
A Cut Above
User avatar
User avatar
T-Bone
He/Him
A Cut Above
A Cut Above
Posts: 9052
Joined: February 18, 2011
Pronoun: He/Him
Location: Shrug City
Contact:

Post Post #18 (ISO) » Sat Sep 16, 2023 3:25 pm

Post by T-Bone »

Ego will try at next opportunity
My Top 40 Alt Songs of the Year!

"Playing in a Newbie game doesn't count" ~ PenguinPower, Feb 2019
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13224
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀
Contact:

Post Post #19 (ISO) » Sun Sep 17, 2023 9:56 am

Post by JacksonVirgo »

Updated the OP.

It now contains a dodgy ass demo video, but it's a demo video nonetheless.
Better than a few random screenshots imo
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
Psyche
Psyche
he/they
Survivor
User avatar
User avatar
Psyche
he/they
Survivor
Survivor
Posts: 10721
Joined: April 28, 2011
Pronoun: he/they

Post Post #20 (ISO) » Sun Sep 17, 2023 10:14 am

Post by Psyche »

How much dev or validation do you think the vote tabulator itself might need? Can you remind of the basic strategy it implements?
User avatar
yessiree
yessiree
he
Mafia Scum
User avatar
User avatar
yessiree
he
Mafia Scum
Mafia Scum
Posts: 4389
Joined: June 6, 2013
Pronoun: he

Post Post #21 (ISO) » Sun Sep 17, 2023 3:23 pm

Post by yessiree »

ego
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13224
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀
Contact:

Post Post #22 (ISO) » Mon Sep 18, 2023 12:18 am

Post by JacksonVirgo »

In post 20, Psyche wrote: How much dev or validation do you think the vote tabulator itself might need? Can you remind of the basic strategy it implements?
I have absolutely no idea what you mean
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
yessiree
yessiree
he
Mafia Scum
User avatar
User avatar
yessiree
he
Mafia Scum
Mafia Scum
Posts: 4389
Joined: June 6, 2013
Pronoun: he

Post Post #23 (ISO) » Mon Sep 18, 2023 1:35 am

Post by yessiree »

In post 22, JacksonVirgo wrote:
In post 20, Psyche wrote: How much dev or validation do you think the vote tabulator itself might need? Can you remind of the basic strategy it implements?
I have absolutely no idea what you mean
i think psyche is asking how the votecounter matches vote strings to players
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13224
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀
Contact:

Post Post #24 (ISO) » Mon Sep 18, 2023 1:51 am

Post by JacksonVirgo »

In post 23, yessiree wrote:
In post 22, JacksonVirgo wrote:
In post 20, Psyche wrote: How much dev or validation do you think the vote tabulator itself might need? Can you remind of the basic strategy it implements?
I have absolutely no idea what you mean
i think psyche is asking how the votecounter matches vote strings to players
For now I'm using a library that uses a form of Dice's Coefficient. I was planning on swapping it out with custom logic later.
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
Post Reply

Return to “Mafia Discussion”