CSV->Trade Thread Script
Long before I had my trade thread up-and-running, I kept a database of my "trade-worthy" pokemon in a Google Docs spreadsheet. When I decided to make myself a trade thread, rather than dig through sprite databases and lay everything out, one by one by hand, I decided I'd write a Python script instead.
If it's of interest to you, feel free to pilfer it, use it and modify it to your heart's content.
Your CSV file should be in the following format:
Species, Shiny? (Y or blank), Nickname, Nature, Gender (N/A if none), IVs, Egg Moves, Level, EVs, Avail. UT? (Y or blank), Avail. Egg? (Y or blank), Notes (put quotes around this entry)
e.g.
Steelix,,HADERACH,Sassy,Male,31/28/28/3/31/1,,50,85/249/0/0/176/0,Y,,"Rock Head; Not RNG'd, no AR codes used"
The script
Code:
import csv
pokelist = csv.reader(open('pklist.csv', 'rb'), delimiter=',')
lsnum = []
lsname = []
lsbHP = []
lsbAtk = []
lsbDef = []
lsbSpA = []
lsbSpD = []
lsbSpe = []
for line in pokelist:
lsnum.append(line[0])
lsname.append(line[1])
lsbHP.append(line[2])
lsbAtk.append(line[3])
lsbDef.append(line[4])
lsbSpA.append(line[5])
lsbSpD.append(line[6])
lsbSpe.append(line[7])
tradeables = csv.reader(open('Tradeables.csv', 'rb'), delimiter=',')
species = []
shiny = []
nick = []
nature = []
gender = []
IVs = []
moves = []
level = []
EVs = []
UT = []
egg = []
notes = []
for line in tradeables:
species.append(line[0])
shiny.append(line[1])
nick.append(line[2])
nature.append(line[3])
gender.append(line[4])
IVs.append(line[5])
moves.append(line[6])
level.append(line[7])
EVs.append(line[8])
UT.append(line[9])
egg.append(line[10])
notes.append(line[11])
num=0
for entry in range(1,len(species)):
for i in range(0,len(lsnum)):
if species[entry] == lsname[i]:
num=lsnum[i]
break
out = "[IMG]http://www.pokecheck.org/i/anim"
if shiny[entry] == "Y":
out = out+"s"
out = out + "/"
if len(num) < 3:
out = out + "0"
if len(num) < 2:
out = out + "0"
out = out + num + ".gif[/IMG]\n"
out = out + species[entry]
if shiny[entry] == "Y":
out = out + " (shiny)"
out = out + " / Nick: \"" + nick[entry] + "\" / "
if gender[entry] != "N/A":
out = out + gender[entry] + " / "
out = out + nature[entry] + "\n"
out = out + "Available "
comma = False
if egg[entry] != "":
out = out + "egg"
comma = True
if UT[entry] != "":
if comma:
out = out + ", "
out = out + "UT"
comma = True
if level[entry] != "":
if comma:
out = out + ", "
out = out + "Lv. " + level[entry]
out = out + "\n"
out = out + "IVs: " + IVs[entry] + "\n"
if moves[entry] != "":
out = out + "Egg moves: " + moves[entry] + "\n"
out = out + "EVs: " + EVs[entry] + "\n"
out = out + notes[entry] + "\n"
print out
Or you can
download it.
In Linux, I run this from the command-line as:
Code:
$python threadmaker.py Tradeables.csv > thread.txt
Tradeables.csv is my database file. thread.txt is a plaintext file containing the VBB code that can then be copy/pasted into your thread.
Without the "> thread.txt" part, it will just output everything to the screen. I'm not sure what the Windows equivalent is. I've never used Python in Windows.
Anyway, if you have problems or find a bug, let me know!