Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: Bay12 Vote Counter & Post Analytics (Almost Useful: Grabs Votes, per-turn!)  (Read 1629 times)

Sensei

  • Bay Watcher
  • Haven't tried coffee crisps.
    • View Profile

Hey guys! I thought I'd make a vote/action counter for myself and others who feel like using it. I just knocked what I have together before bed, and it's a totally non-functional program that demonstrates how I can get some information from a Bay 12 thread. It basically just grabs the thread title when you enter a URL.

Code: [Select]
package MainPackage;
//I may have fucked up package assignment. I normally use default package.
//purpose of this is to grab votes from Bay12 forums
//TODO: Almost everything. Count posts per page. Compile in action or list form. Start and end posts. GUI.
//Note to self: Program is NOT logged in, uses default 15 posts per page.
import java.net.*;
import java.io.*;
import java.util.Scanner;

public class voteGrabber {

public static void main(String[] args) throws Exception{
Scanner console = new Scanner(System.in);
System.out.println("Enter thread URL:");
String input = new String(console.nextLine());
//get full thread URL from different input types, later
//separately get thread number and page to go through pages
//determine total post count to not access invalid pages?
URL threadURL = new URL(input);
BufferedReader threadReader = new BufferedReader(new InputStreamReader(threadURL.openStream()));
String nextLine;
String threadTitle = null;
int lineCount = 0;
int postCount = 0;
while ((nextLine = threadReader.readLine())!=null){
if (nextLine.contains("<meta name=\"description\"")){
System.out.println(nextLine);
threadTitle = nextLine.substring(35, nextLine.length()-4);
}
if (nextLine.contains("<div class=\"inner\"")){
postCount++;
}
lineCount++;//todo: post count
}


System.out.println("Reading: "+threadTitle);
System.out.println(postCount+" Posts");

}

}

I thought I'd start a thread for this totally incomplete program because I'm curious if anyone would want a vote counter for forum games or if there is already a tool like this. I was thinking the final version would have two modes:
-Count up the number of people voting for certain options, for suggestion games
-Tally together actions from individuals for games where people take their own actions

It would probably spit the results into a TXT. I imagine it would look in people's posts for a "marker" and grab, say, all the bold text around it. So if someone's post looks like:
Quote from: Steve
The wizard is probably the biggest threat to us right now. Also I like cookies.
[X] Attack the Wizard
...then the program would just return a line like "Steve: Attack the Wizard". It would ignore everything else and votes or actions only count if they're bolded with the [X], so the program knows what to get.

The other question is how it would know which votes are the latest. It could just return the latest vote for each user who voted, but a better solution would probably be for it to look for some marker the OP would use to indicate to the program which posts are new turns, and then have it return only votes/actions from the latest turn until the end of the thread.

In its current form it doesn't go through multiple thread pages. Probably the first thing I'll do to toy around with this later is have it manipulate the URL you give it to go through all the pages of the thread (the forums remember your login by cookies I think, so the program isn't logged in to your account and views all threads with the default page count of 15 posts per page). Just to test it, it seems like it should be pretty easy to have it, say, create a list of everybody who posted in a thread, and how many posts they made. I don't know what use these kind of analytics would have, but they're kind of interesting.

Anyway, let me know if you're interested in seeing this program come to fruition in an easy-to-run form at some point, and how you think I should go about making it work if you have an opinion. I should warn that for now, my ambitions end at making this an ugly command-line program. I'm not really thinking about a GUI and as such, it should probably accept only a small number of arguments from the user to keep it from getting unwieldy.
« Last Edit: July 05, 2017, 02:16:14 am by Sensei »
Logged
Let's Play: Automation! Bay 12 Motor Company Buy the 1950 Urist Wagon for just $4500! Safety features optional.
The Bay 12 & Mates Discord Join now! Voice/text chat and play games with other Bay12'ers!
Add me on Steam: [DFC] Sensei

Sensei

  • Bay Watcher
  • Haven't tried coffee crisps.
    • View Profile
Re: Bay12 Vote Counter & Post Analytics (Current Status: Useless)
« Reply #1 on: May 17, 2017, 07:33:09 pm »

Version 2:

Code: [Select]
package MainPackage;
//I may have fucked up package assignment. I normally use default package.
//purpose of this is to grab votes from Bay12 forums
//TODO: Almost everything. Compile in action or list form. Start and end posts.
//Note to self: Program is NOT logged in, uses default 15 posts per page.
import java.net.*;
import java.io.*;
import java.util.ArrayList;
import java.util.Scanner;

public class voteGrabber {

public static void main(String[] args) throws Exception{
Scanner console = new Scanner(System.in);
System.out.println("Enter thread URL:");
String input = new String(console.nextLine());
//get full thread URL from different input types, later
input = input.substring(0, input.lastIndexOf("."));
System.out.println("Thread URL: "+input);
URL threadURL = new URL(input);
int pageCount = getPages(threadURL);
int currentPage = 1;
String nextLine = null;
String threadTitle = null;
String currentUserName = null;
User currentUser = null;
ArrayList<User> userList = new ArrayList<User>();//create a list of User objects
int postCount = 0;
while (currentPage<pageCount+1){
BufferedReader threadReader = new BufferedReader(new InputStreamReader(threadURL.openStream()));
while ((nextLine = threadReader.readLine())!=null){//note to self replace if statements with switch?
if (nextLine.contains("<meta name=\"description\"") && threadTitle == null){//this sets thread title
threadTitle = nextLine.substring(35, nextLine.length()-4);
}
else if (nextLine.contains("View the profile of") && !nextLine.contains("<div class=\"inner\"")){
//Add user to userlist if they are not present, and set current user. The increment user's post count.
currentUserName = nextLine.substring(nextLine.lastIndexOf(">", nextLine.length()-9)+1, nextLine.length()-9);
//System.out.println("User: "+ currentUserName);
boolean userExists = false;//check whether user is already listed
if (!userList.isEmpty()){
for (User u: userList){
if (u.getName().equals(currentUserName)){
currentUser = u;
userExists=true;
}
}
}
if (!userExists){//if they're not listed, add them
System.out.println("Adding new user: "+currentUserName);
currentUser = new User(currentUserName);
userList.add(currentUser);
}
currentUser.post();
}
else if (nextLine.contains("<div class=\"inner\"")){
postCount++;
//TODO handle post for current user
}
}
threadReader.close();
System.out.println("Page: "+currentPage);
currentPage++;
threadURL = new URL(input+"."+(15*(currentPage-1)));
}
//begin report
System.out.println("Reading: "+threadTitle);
System.out.println(pageCount+" Pages");
System.out.println(postCount+" Posts");//post count is 1 higher than the displayed number of replies to the thread which does not include OP
System.out.println("Begin user report:");
for (User u: userList){
System.out.println(u.getName()+ ", Post Count: "+u.getPosts());
}

}

public static int getPages(URL myURL) throws IOException{
BufferedReader reader = new BufferedReader(new InputStreamReader(myURL.openStream()));
String line = null;
String pageNumber = null;
while ((line = reader.readLine())!=null && pageNumber == null){//change this, it does its thing twice
if (line.contains("navPages")){//find the line containing page numbers
int endIndex = line.lastIndexOf("</a>");
int startIndex = line.lastIndexOf(">", endIndex);
pageNumber = line.substring(startIndex+1,endIndex);
}
}
reader.close();
return Integer.parseInt(pageNumber);//temp
}

}

public class User {

String name = "default";
int postCount;
boolean isOP;
//todo: Add vote/post content

public User(String inputName, boolean OP){
name = inputName;
postCount = 0;
isOP = OP;
}

public User(String inputName){
name = inputName;
postCount = 0;
isOP = false;
}

public int getPosts(){
return postCount;
}

public String getName(){
return name;
}

public void post(){
postCount++;
}

public boolean getOP(){
return isOP;
}
}


Now it iterates through every page of the thread, and reports the number pages (at default count of 15 posts per page), number of posts (including OP, so 1 more than the number of replies) and collects a list of every user who has posted in the thread, with their number of posts. It gives an output like this:

Code: [Select]
Reading: Intercontinental Arms Race: Spring 1939 (Design Phase)
135 Pages
2020 Posts
Begin user report:
Sensei, Post Count: 72
andrea, Post Count: 148
NUKE9.13, Post Count: 141
evictedSaint, Post Count: 249
Happerry, Post Count: 12
Taricus, Post Count: 173
Zanzetkuken The Great, Post Count: 103
Powder Miner, Post Count: 110
stabbymcstabstab, Post Count: 39
Khan Boyzitbig, Post Count: 45
Kot, Post Count: 57
Hibou, Post Count: 22
S34N1C, Post Count: 10
mastahcheese, Post Count: 2
Light forger, Post Count: 49
VoidSlayer, Post Count: 35
Azzuro, Post Count: 83
GUNINANRUNIN, Post Count: 70
Baffler, Post Count: 51
3_14159, Post Count: 19
Mardent23, Post Count: 8
aDwarfNamedUrist, Post Count: 1
Kashyyk, Post Count: 29
Mulisa, Post Count: 67
MidnightJaguar, Post Count: 3
helmacon, Post Count: 36
Madman198237, Post Count: 95
Devastator, Post Count: 7
Funk, Post Count: 9
Wolfhunter107, Post Count: 11
Strongpoint, Post Count: 92
RAM, Post Count: 60
Chiefwaffles, Post Count: 23
piratejoe, Post Count: 51
Tyrant Leviathan, Post Count: 1
Radio Controlled, Post Count: 7
NAV, Post Count: 27
Olith McHuman, Post Count: 2
10ebbor10, Post Count: 1

It actually does something! This is accomplished with a "User" object, currently it just stores a name and number of posts. The next step will be to get user votes/actions, and assign them to users. For the time being my plan is to replace user actions every time a new action is found for a new user, in effect only tallying their latest action. At the end of the program I should have it spit out either a list of actions and all the users who voted for that action, or a list of users and which action each user wanted to take. I'll probably have the program ask the user this, or read from a configuration file. The last thing which will be necessary to make this a useable vote program is for it to recognize turns, and only collate votes from after the lastest turn in the thread (I will have it forget every user's action when it hits a new turn marker).
Logged
Let's Play: Automation! Bay 12 Motor Company Buy the 1950 Urist Wagon for just $4500! Safety features optional.
The Bay 12 & Mates Discord Join now! Voice/text chat and play games with other Bay12'ers!
Add me on Steam: [DFC] Sensei

Sensei

  • Bay Watcher
  • Haven't tried coffee crisps.
    • View Profile

[X] Test Action A

Note: Little x in brackets makes a list, may need to find another demarcation.
« Last Edit: May 17, 2017, 11:47:31 pm by Sensei »
Logged
Let's Play: Automation! Bay 12 Motor Company Buy the 1950 Urist Wagon for just $4500! Safety features optional.
The Bay 12 & Mates Discord Join now! Voice/text chat and play games with other Bay12'ers!
Add me on Steam: [DFC] Sensei

Sensei

  • Bay Watcher
  • Haven't tried coffee crisps.
    • View Profile

[X] Test Action B
[X] Test Action C


Quote
[X] Test Action Z


Note: It should ignore the "[X] Test Action Z" because it's in a quote. However right now it ignores its entire post when it finds an invalid [X] of any kind. That's enough for one night!
« Last Edit: May 17, 2017, 11:54:38 pm by Sensei »
Logged
Let's Play: Automation! Bay 12 Motor Company Buy the 1950 Urist Wagon for just $4500! Safety features optional.
The Bay 12 & Mates Discord Join now! Voice/text chat and play games with other Bay12'ers!
Add me on Steam: [DFC] Sensei

Powder Miner

  • Bay Watcher
  • this avatar is years irrelevant again oh god oh f-
    • View Profile

[X] Don Tiger Armor, Hide In Closet
Logged

piratejoe

  • Bay Watcher
  • Obscure References and Danmaku everywhere.
    • View Profile

[X] Kill Steve, the cannalans greatest weapon.
Logged
Battleships Hurl insults from behind thick walls, Destroyers beat up small children, Carriers stay back in the kitchen, and Cruisers are a bunch of tryhards who pretend to be loners.

NUKE9.13

  • Bay Watcher
    • View Profile

Hello, this is an test post. How are you today?

[X] Test vote counter

Blah blah blah.
Logged
Long Live United Forenia!

Sensei

  • Bay Watcher
  • Haven't tried coffee crisps.
    • View Profile

Below is the output of the program, currently:
Quote
Reading: Bay12 Vote Counter &amp; Post Analytics (Current Status: Shows user post counts)
1 Pages
7 Posts
Begin user report:
Sensei, Post Count: 4
 Test Action C
Powder Miner, Post Count: 1
 Don Tiger Armor, Hide In Closet
piratejoe, Post Count: 1
 Kill Steve, the cannalans greatest weapon.
NUKE9.13, Post Count: 1
 Test vote counter
It's nearly useful! I just need to implement the features of clearing people's actions when it hits a new turn, and collecting votes with a list of names. It also should probably spit the output into a text file. Thanks!
Logged
Let's Play: Automation! Bay 12 Motor Company Buy the 1950 Urist Wagon for just $4500! Safety features optional.
The Bay 12 & Mates Discord Join now! Voice/text chat and play games with other Bay12'ers!
Add me on Steam: [DFC] Sensei

Solifuge

  • Bay Watcher
    • View Profile
Re: Bay12 Vote Counter & Post Analytics (Almost Useful: Grabs Votes!)
« Reply #8 on: May 21, 2017, 02:37:19 am »

This reminds me of vote counters I've seen baked in on other sites. Cool project! Thanks for working on it.

[X] Follow this thread.

EDIT: Oh dang, a little late. Whoops. I'll just leave that there!
« Last Edit: May 21, 2017, 04:41:14 pm by Solifuge »
Logged

OceanSoul

  • Bay Watcher
  • Cursed with Exponential Hiatuses
    • View Profile
Re: Bay12 Vote Counter & Post Analytics (Almost Useful: Grabs Votes!)
« Reply #9 on: May 21, 2017, 08:06:50 am »

[X] Ask about adding code for organizing subactions/keywords/phrases.
For a practical example, suppose there is a combination of actions that can be done in a single turn. Whether a lever should be pulled left or right (or not at all), what would be said in a conversation with a neutral NPC, and what weapon should currently be equipped. The program, in this case, would sift through the actions and be able to organize each individual response separately. Even if an option is not initially provided to the players for any of the actions (particularly the talking), it could compare them for notable, similar words and organize them based on that. Get what I'm trying to say?
Logged
Work on a potential forum game for my return to Bay12. Figure out parts that puzzled me before. Find more things to figure out that I can't. Work on another game instead of solving them. Get distracted and stop working. Remember it a week or two later. Remember I'm still on hiatus. Illogically, Be too ashamed to return yet. Repeat ad nauseam.

Finally have a game completely ready. Wait a week before posting it out of laziness.

Kashyyk

  • Bay Watcher
  • One letter short of a wookie
    • View Profile
Re: Bay12 Vote Counter & Post Analytics (Almost Useful: Grabs Votes!)
« Reply #10 on: May 21, 2017, 08:27:25 am »

This is a pretty cool idea actually. Would you want to have the bot periodically post the current tally? Assuming Toady is willing to sanction it of course.
Logged

OceanSoul

  • Bay Watcher
  • Cursed with Exponential Hiatuses
    • View Profile
Re: Bay12 Vote Counter & Post Analytics (Almost Useful: Grabs Votes!)
« Reply #11 on: May 21, 2017, 08:37:49 am »

This is a pretty cool idea actually. Would you want to have the bot periodically post the current tally? Assuming Toady is willing to sanction it of course.
It wouldn't have to be a new post, right? It could edit a specified post to be up-to-date. Also, I just realized: how would the program handle someone having multiple actions over multiple replies? To test, [X] check multi-action reaction.Also, what if an action was quoted in someone else's post?
Logged
Work on a potential forum game for my return to Bay12. Figure out parts that puzzled me before. Find more things to figure out that I can't. Work on another game instead of solving them. Get distracted and stop working. Remember it a week or two later. Remember I'm still on hiatus. Illogically, Be too ashamed to return yet. Repeat ad nauseam.

Finally have a game completely ready. Wait a week before posting it out of laziness.

Sensei

  • Bay Watcher
  • Haven't tried coffee crisps.
    • View Profile
Re: Bay12 Vote Counter & Post Analytics (Almost Useful: Grabs Votes!)
« Reply #12 on: May 21, 2017, 11:34:23 am »

This reminds me of vote counters I've seen baked in on other sites. Cool project! Thanks for working on it.

[X] Follow this thread.

EDIT: Oh dang, a little late. Whoops. I'll just leave that there!
Keep in mind that because your action isn't bolded, it wouldn't actually be counted by the program; that's how it distinguishes your action from other text in your post.

[X] Ask about adding code for organizing subactions/keywords/phrases.
For a practical example, suppose there is a combination of actions that can be done in a single turn. Whether a lever should be pulled left or right (or not at all), what would be said in a conversation with a neutral NPC, and what weapon should currently be equipped. The program, in this case, would sift through the actions and be able to organize each individual response separately. Even if an option is not initially provided to the players for any of the actions (particularly the talking), it could compare them for notable, similar words and organize them based on that. Get what I'm trying to say?
Right now, it takes only one response per turn, per player. If you wanted to do "multiple actions" it would have to be in a single block, like:
Quote
[X] I pull the levers, then shoot two arrows at the wizard, and one at the zombie.
I hope this works!
It will keep looking until the bold ends, so the entire bolded sentence would be the output of the program. I currently have it set up so that whenever it find's a user's action, it replaces their old action if they already have one. This is because in my games, usually someone submitting a new action means they are changing their mind, not adding another thing on to it. I could have the program provide an alternate mode set by the user to collect all of someone's actions instead of just one, but I would have to rewrite the bit of code which pulls an action from someone's post. Right now it looks for only the single last action in a post, so it won't find multiple actions in a single post.

I will provide an output option which organizes everything into votes, and then assigns a list of names to each vote, but the votes would have to be the same verbatim. While it's not impossible that a computer program could make guesses at which different actions fall into the same category, that's way outside my skill level and would probably take months even for people who know what they're doing. The best I might hope to do is have it ignore punctuation, capitalization and spaces when determining if votes are identical or not, and even that will take a little work.

This is a pretty cool idea actually. Would you want to have the bot periodically post the current tally? Assuming Toady is willing to sanction it of course.
I have no plans to make this program post on its own at this time. That would be a good bit harder than what I'm trying to do here, and possibly be disallowed by Toady anyway. Right now I picture this as something you just run on your computer, punch in the URL of the thread you want, maybe set a couple options, and it spits out everybody's vote/action into one convenient place. Right now this place is the console, but I want to have it put everything in a text file later.

Oh yeah, for anyone who's keeping up, here's the program in its current form:
Code: [Select]
package MainPackage;
//I may have fucked up package assignment. I normally use default package.
//purpose of this is to grab votes from Bay12 forums
//TODO: Compile actions in vote list form, give different output options. Clean up HTML garbage from &, ', " type symbols. Clear actions at turn marker. Output to TXT, maybe read TXT config.
//TODO: Move most of this program into message to allow for future GUI, or just rewrite the whole damn thing.
//Note to self: Program is NOT logged in, uses default 15 posts per page.
import java.net.*;
import java.io.*;
import java.util.ArrayList;
import java.util.Scanner;

import org.apache.commons.lang3.StringUtils;//added external .jar, might fiddle with this later

public class voteGrabber {

public static void main(String[] args) throws Exception{
Scanner console = new Scanner(System.in);
System.out.println("Enter thread URL:");
String input = new String(console.nextLine());
//get full thread URL from different input types, later
input = input.substring(0, input.lastIndexOf("."));
System.out.println("Thread URL: "+input);
URL threadURL = new URL(input);
int pageCount = getPages(threadURL);
int currentPage = 1;
String nextLine = null;
String threadTitle = null;
String currentUserName = null;
User currentUser = null;
ArrayList<User> userList = new ArrayList<User>();//create a list of User objects
int postCount = 0;
while (currentPage<pageCount+1){
BufferedReader threadReader = new BufferedReader(new InputStreamReader(threadURL.openStream()));
while ((nextLine = threadReader.readLine())!=null){//note to self replace if statements with switch?
if (nextLine.contains("<meta name=\"description\"") && threadTitle == null){//this sets thread title
threadTitle = nextLine.substring(35, nextLine.length()-4);
}
else if (nextLine.contains("View the profile of") && !nextLine.contains("<div class=\"inner\"")){
//Add user to userlist if they are not present, and set current user. The increment user's post count.
currentUserName = nextLine.substring(nextLine.lastIndexOf(">", nextLine.length()-9)+1, nextLine.length()-9);
//System.out.println("User: "+ currentUserName);
boolean userExists = false;//check whether user is already listed
if (!userList.isEmpty()){
for (User u: userList){
if (u.getName().equals(currentUserName)){
currentUser = u;
userExists=true;
}
}
}
if (!userExists){//if they're not listed, add them
System.out.println("Adding new user: "+currentUserName);
currentUser = new User(currentUserName);
userList.add(currentUser);
}
currentUser.post();
}
else if (nextLine.contains("<div class=\"inner\"")){
postCount++;
//handle post for current user
String action = getAction(nextLine);
if (action!=null){
System.out.println("Setting action");
currentUser.setAction(action);
}
}
}
threadReader.close();
System.out.println("Page: "+currentPage);
currentPage++;
threadURL = new URL(input+"."+(15*(currentPage-1)));
}
//begin report
//TODO: Make this a method, give choice of alternate methods for report types
System.out.println("Reading: "+threadTitle);
System.out.println(pageCount+" Pages");
System.out.println(postCount+" Posts");//post count is 1 higher than the displayed number of replies to the thread which does not include OP
System.out.println("Begin user report:");
for (User u: userList){
System.out.println(u.getName()+ ", Post Count: "+u.getPosts());
if (u.action != null){
System.out.println(u.action);
}
}

}

public static int getPages(URL myURL) throws IOException{
BufferedReader reader = new BufferedReader(new InputStreamReader(myURL.openStream()));
String line = null;
String pageNumber = null;
while ((line = reader.readLine())!=null && pageNumber == null){//change this, it does its thing twice
if (line.contains("navPages")){//find the line containing page numbers
int endIndex = line.lastIndexOf("</a>");
int startIndex = line.lastIndexOf(">", endIndex);
pageNumber = line.substring(startIndex+1,endIndex);
}
else if (line.contains("<div class=\"margintop middletext floatleft\">Pages: [<strong>1</strong>] </div>")){
return 1;//This handles cases where there is only one page
}
}
reader.close();
System.out.println("ADHASDHJSAD: "+pageNumber);
return Integer.parseInt(pageNumber);
}

public static String getAction(String s){//Extracts someone's action from the body of their post. Looks only for bold, non-quotes starting with [X]. Capital X!
if (s.contains("[X]")){
String tempString = null;
int endIndex = s.length()-1;
for (int i=0;i<StringUtils.countMatches(s,"[X]");i++){// for each [x] in the post
tempString = s.substring(s.lastIndexOf("[X]",endIndex));//tempstring is from [x] to end of string, or a failed [x]. Tries last [x] first.
if (StringUtils.countMatches(tempString,"topslice_quote")>=StringUtils.countMatches(tempString,"botslice_quote")){//should ensure it's not it a quote
if (tempString.contains("</strong>") && (tempString.indexOf("</strong>")<tempString.indexOf("<strong>") || !tempString.contains("<strong>"))){//should ensure it's bold. Looks for a CLOSING bold tag, and makes sure it's BEFORE the first OPEN bold tag, OR there are no open bold tags.
//At this point, text should be BOLD and NOT in a quote.
//System.out.println("Found a valid post!");
//System.out.println(tempString.substring(3, tempString.indexOf("</strong>")));
return tempString.substring(3, tempString.indexOf("</strong>"));
}
}
//If the [x] failed either the quote or bold test, we get here.
endIndex = s.lastIndexOf("[X]", endIndex)-3;
System.out.println("indexing: "+endIndex);
}
}
return null;
}

}
package MainPackage;

public class User {

String name = "default";
int postCount;
boolean isOP;
String action;
//todo: Add vote/post content

public User(String inputName, boolean OP){
name = inputName;
postCount = 0;
isOP = OP;
}

public User(String inputName){
name = inputName;
postCount = 0;
isOP = false;
}

public int getPosts(){
return postCount;
}

public String getName(){
return name;
}

public void post(){
postCount++;
}

public void setAction(String p){
action = p;
}

public boolean getOP(){
return isOP;
}
}

For convenience I've used an Apache commons method; I'll probably have to keep this in mind when packaging the program later. This is the first time I've implemented a library of any kind, they didn't teach us that in CS101 for some reason.
« Last Edit: May 21, 2017, 11:36:46 am by Sensei »
Logged
Let's Play: Automation! Bay 12 Motor Company Buy the 1950 Urist Wagon for just $4500! Safety features optional.
The Bay 12 & Mates Discord Join now! Voice/text chat and play games with other Bay12'ers!
Add me on Steam: [DFC] Sensei

Madman198237

  • Bay Watcher
    • View Profile
Re: Bay12 Vote Counter & Post Analytics (Almost Useful: Grabs Votes!)
« Reply #13 on: May 21, 2017, 12:33:25 pm »

I'd suggest this: Count different markers.
So one person's comment could have


[X] Main battery fire first salvo
[Y] Secondary batteries fire on aircraft
[Z] Torpedo tubes hold fire


And it would count and then parse 3 sets of instructions. Bonus points if you have a "Brainstorm" beforehand, so you have options A B C D and E and then you vote like this
[X] A [Y] C [Z] E
and the program says "Action 1: One vote A         Action 2: One vote C                Action 3: One vote E"
Logged
We shall make the highest quality of quality quantities of soldiers with quantities of quality.

Sensei

  • Bay Watcher
  • Haven't tried coffee crisps.
    • View Profile
Re: Bay12 Vote Counter & Post Analytics (Almost Useful: Grabs Votes!)
« Reply #14 on: May 21, 2017, 12:53:00 pm »

I'd suggest this: Count different markers.
So one person's comment could have


[X] Main battery fire first salvo
[Y] Secondary batteries fire on aircraft
[Z] Torpedo tubes hold fire


And it would count and then parse 3 sets of instructions. Bonus points if you have a "Brainstorm" beforehand, so you have options A B C D and E and then you vote like this
[X] A [Y] C [Z] E
and the program says "Action 1: One vote A         Action 2: One vote C                Action 3: One vote E"
I'll think about this. Right now [X] is the only marker and it's hard-coded. I could possibly have it parse separately votes for every string in a user-passed array, maybe give it in the arguments, but that will definitely be something to think about later since I still have some basic stuff left to do.
Logged
Let's Play: Automation! Bay 12 Motor Company Buy the 1950 Urist Wagon for just $4500! Safety features optional.
The Bay 12 & Mates Discord Join now! Voice/text chat and play games with other Bay12'ers!
Add me on Steam: [DFC] Sensei
Pages: [1] 2