So, I had a idea that surprisingly wasn't taken before: why not code a piece of code that can start Zandronum? One that can load WAD files? In a language that is as practical and useful as Python (the one I am most used to)?
And as most good ideas I have, this one evolved to the point it can accept nearly any inputtable switch and command, and include any WAD file.
So I executed the idea. The result is the ZLP: Zandronum Launcher in Python!
Since I just done it and wish to share it, I can't test it right now.
But currently the user must input the functions manually from the Python shell but still the module must ease general execution of Zandronum which is normally done via command-line
I am planning to do the GUI/TUI part, using wxPython, but I never understood that "event system" used by wxPython GUIs.
Currently it's just the back-bones code used by users that have Python and know how to coordinate functions that add switches and such.
Code: Select all
################################################################
################################################################
## ##
## Zandronum MultiPlayer Hoster -- by Gustavo Ramos Rehermann ##
## ------------------ 17/12/15 ------------------- ##
## ##
## The Python solution to hosting Zandronum servers using ##
## command-line ##
## ##
##============================================================##
##============================================================##
## ##
## ##
## ##
## This Text-Based User Interface was designed specifically ##
## to be flexible and dedicated to multiplayer server joining ##
## and hosting with Zandronum (*YOU STILL NEED FORWARDED ##
## PORTS!!*), and a classical user interface for classical ##
## and oldschool users (after all, they play DOOM, which is a ##
## game from 1993!). ##
## ##
################################################################
################################################################
##########
# Import #
##########
# MODULES #
import math as m
# FUNCTIONS #
from subprocess import call
################################################################
#Classes
#________
class WadFile:
loctn = ""
filnm = ""
extsn = ""
fullpath = ""
#Variables
#________
commandlineswitches = []
wadfilestoload = []
#Functions
#________
def ParseLocation(fullpath, wadf):
"Parses a full path into location, filename and extension."
structure = fullpath.split('\\')
filepart = structure.pop(len(structure) - 1)
fpst = filepart.split('.')
wadf.filnm = fpst[0]
wadf.extsn = fpst[1]
wadf.loctn = '\\'.join(structure)
print 'New WAD filename: ' + wadf.filnm
print 'New WAD extension: ' + wadf.extsn
print 'New WAD location: ' + wadf.loctn
return wadf
def GetLocation(wadf):
"Gets the full path of the file."
if wadf.loctn != '':
return wadf.loctn + '\\' + wadf.filnm + '.' + wadf.extsn
else:
return wadf.filnm + '.' + wadf.extsn
def ParseFilesIntoSwitch():
wadfilelocstoload = []
for x in wadfilestoload:
wadfilelocstoload.append(GetLocation(x))
commandlineswitches.append('-file ' + ' '.join(wadfilelocstoload))
def AddSwitch(switchname, switchvalue):
"Adds an switch to 'commandlineswitches'"
commandlineswitches.append('-' + switchname + ' ' + switchvalue)
def AddCommand(commandname, commandvalue):
"Like AddSwitch, but applies for commands (+) in command line execution."
commandlineswitches.append('+' + commandname + ' ' + commandvalue)
def RemSwitch(switchname, switchvalue):
"Removes switch from 'commandlineswitches'"
commandlineswitches.remove('-' + switchname + ' ' + switchvalue)
def RemCommand(commandname, commandvalue):
"Like RemSwitch, but applies for commands (+) in command line execution."
commandlineswitches.remove('+' + switchname + ' ' + switchvalue)
def ExecuteZandronum(zandronumpath):
"Runs Zandronum and applies the switches in the list 'commandlineswitches'"
execline = zandronumpath + '\\Zandronum.exe ' + ' '.join(commandlineswitches)PS: I am just another sucker... :(