Armgetron ScoreBias Setter (score-bias.py)

Everything todo with programming goes HERE.
Post Reply
User avatar
sinewav
Graphic Artist
Posts: 6413
Joined: Wed Jan 23, 2008 3:37 am
Contact:

Armgetron ScoreBias Setter (score-bias.py)

Post by sinewav »

I'm tired of Armagetron resetting the score biases I take the effort to adjust. Yes, someone actually uses that feature. Amazing, right? I now have a Python script that sets them back the way I want. I just keep it in my var folder along with frommaster.srv and run it when the biases zero out again. A better script would take args like IP, PORT, BIAS. An even better script would read a list of many servers, ports, and biases and update them accordingly. A completely amazing script would do that every time it noticed frommaster.svr changed.

I am not amazing. But here is the script if you want to use it...

Code: Select all

#!/usr/bin/env python
'''
Armagetron Scorebias Setter (ASS) v0.1

Replaces the scorebias you wasted time adjusting with the
slow, slow +/- keys. Wasted because Armagetron is absent-minded
and inevitably forgets. Wouldn't it be nice if your bias was
persistent and the score column was actually useful?

Ah, one can only dream...

This version only handles one server. Future versions will
allow you to keep a list of servers, ports, and individual
biases for each.

Just kidding, there is no future version.

Author: Get lost.
License: For what? There are more comments than code.
Date: 2013-12-05
'''

# The server you want
svr_address = "000.000.000.000"

# Open the file into a list
fn = open("frommaster.srv", "r")
x = fn.readlines()

# Find the server you want, then change the scorebias/score
for index, item in enumerate(x):
    if item == "connection\t" + svr_address +"\n":
        y = index + 8
        z = index + 9
        x[y] = "scorebias	1000\n"
        x[z] = "score	0\n"

# Overwrite the file with changes
fn = open("frommaster.srv", "w")
for item in x:
    fn.write(item)
fn.close()
User avatar
sinewav
Graphic Artist
Posts: 6413
Joined: Wed Jan 23, 2008 3:37 am
Contact:

Re: Armgetron ScoreBias Setter (score-bias.py)

Post by sinewav »

Just kidding, there is no future version.
I lied. It was slow at work today so now this script reads a CVS file and sets a bias for a list of servers. The cvs rows follow a format:
  • server name,ip or domain name,port,score bias
The first column is a user generated label and is not passed to the script. Here is an example of some Sumo score biases with a picture of the output attached below:

Code: Select all

.dBd|Sumo Dive,wdc.dbdclan.co,4540,9000
Wild West Team Sumo,96.126.122.135,4538,8000
RoadRunnerZ Sumobar,166.78.252.100,4535,7000
included in .zip file below:
score-bias-v0.2.py
score-bias.csv
Attachments
score-bias-setter.zip
(1.18 KiB) Downloaded 187 times
score-bias-example.png
Post Reply