Announcement

Collapse
No announcement yet.

Running Multiple Engines Against 1 ID1 (or mod) Folder

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Educational Purposes

    here's all my current scripts for anyone that is interested

    gqe.hta
    Code:
    <!DOCTYPE html>
    <html>
    	<head>
    		<title>Gypsy's Quake Enginator</title>
    		
    		<HTA:APPLICATION ID="QE"
    			APPLICATIONNAME="Gypsy's Quake Enginator"
    			SINGLEINSTANCE="yes"
    			CAPTION="yes"
    			BORDER="thin"
    			INNERBORDER="no"
    			SCROLL="no"
    		/>
    		
    		<link href="GQE/shell/style.css" type="text/css" rel="stylesheet" />
    		<script src="GQE/shell/jquery.js" type="text/javascript"></script>
    		
    		<script src="GQE/shell/script.js" type="text/javascript"></script>
    		<script src="GQE/shell/script.vbs" type="text/vbscript"></script>
    	</head>
    	<body>
    		<form id="menu" name="menu" action="">
    			<table>
    				<tr>
    					<td>engine:</td>
    					<td>
    						<select name="engine" id="engine">
    							<option value="darkplaces">Darkplaces</option>
    							<option value="DirectQ">Direct Q</option>
    							<option value="fitzquake085">FitzQuake</option>
    							<option value="fteqw">FTEQW</option>
    							<option value="glpro493">ProQuake</option>
    							<option value="glQrack">Qrack</option>
    							<option value="qbismS8">Qbism Super 8</option>
    							<option value="quakespasm">Quakespasm</option>
    						</select>
    					</td>
    				</tr>
    				<tr>
    					<td>-game:</td>
    					<td><input type="text" id="gameName" value="id1" /></td>
    				</tr>
    				<tr>
    					<td>+map:</td>
    					<td><input type="text" id="mapName" value="start" /></td>
    				</tr>
    				<tr>
    					<td>use default switches?</td>
    					<td><input type="checkbox" id="default" disabled /></td>
    				</tr>
    				<tr>
    					<td colspan="2"><textarea id="default_cmln" rows="4" cols="50"></textarea></td>
    				</tr>
    				<tr>
    					<td>use engine specific switches?</td>
    					<td><input type="checkbox" id="optional" disabled /></td>
    				</tr>
    				<tr>
    					<td colspan="2"><textarea id="optional_cmln" rows="4" cols="50"></textarea></td>
    				</tr>
    			</table>
    			<input type="submit" value="run" />
    		</form> 
    	</body>
    </html>
    gqe.bat
    Code:
    :: turn off console printing for a moment
    @echo off
    
    ::config some options
    :CONFIG
    set usedef=0
    set useopt=0
    ::set path to the directory which this bat resides in
    set path=%~dp0
    set /p default=<%path%gqe\configs\cmln
    
    ::change CWD to current directory
    cd /d %path%
    cls
    
    ::check if this is being caslled from the hta menu
    :CHECK
    if not "%1"=="" goto FROM_HTA
    goto ENGINE
    
    
    ::if %1 was assigned these need to be assigned as well
    :FROM_HTA
    set engine=%1
    
    if "%2"=="" (goto GAM_ERR) else set gameName=%2
    if "%3"=="" (goto MAP_ERR) else set mapName=%~n3
    if not "%4"=="y" (set usedef=n) else set usedef=y
    if not "%5"=="y" (set useopt=n) else set useopt=y
    
    set /p optional=<%path%gqe\configs\%engine%\cmln
    goto RUN
    
    ::unspecified stuff
    :GAM_ERR
    ECHO -game was unspecified
    :MAP_ERR
    ECHO +map was unspecified
    goto END
    
    
    :ENGINE
    ECHO.
    ECHO 1. darkplaces
    ECHO 2. directq
    ECHO 3. fitzquake
    ECHO 4. fteqw
    ECHO 5. proquake
    ECHO 6. qrack
    ECHO 7. qbismS8
    ECHO 8. quakespasm
    
    set /p choice=Choose the number that corresponds to your desired engine and press enter: 
    if not "%choice%"=="" set choice=%choice:~0,2%
    if "%choice%"=="1" set engine=darkplaces
    if "%choice%"=="2" set engine=DirectQ
    if "%choice%"=="3" set engine=fitzquake085
    if "%choice%"=="4" set engine=fteqw
    if "%choice%"=="5" set engine=glpro493
    if "%choice%"=="6" set engine=glQrack
    if "%choice%"=="7" set engine=qbismS8
    if "%choice%"=="8" set engine=quakespasm
    if not "%engine%"=="0" goto FOLDER
    
    ECHO "%choice%" is not a valid choice. Try again
    
    ECHO.
    goto ENGINE
    
    :FOLDER
    set /p optional=<%path%gqe\configs\%engine%\cmln
    set /p gameName=Type the -game for your map and press enter. Press enter only for -game id1:
    if "%gameName%"=="" set gameName=id1
    
    
    :MAP
    set /p mapName=type the name of your map and press enter:
    if not "%mapName%"=="" goto GO_CHOICE
    
    ECHO You didn't supply a mapName. Try again.
    
    ECHO.
    goto MAP
    
    :GO_CHOICE
    if not "%default%"=="" goto DEF_CHOICE
    if not "%optional%"=="" goto OPT_CHOICE
    goto RUN
    
    :DEF_CHOICE
    set /p usedef=Use default commandline options (y/n):
    if not "%optional%"=="" goto OPT_CHOICE
    goto RUN
    
    :OPT_CHOICE
    set /p useopt=Use default commandline options (y/n):
    goto RUN
    
    :RUN
    set "base=-basedir %path% -game %gameName% +map %mapName%"
    
    if "%usedef%"=="y" set "base=%base% %default%"
    if "%useopt%"=="y" set "base=%base% %optional%"
    Echo cmd line: %engine%.exe %base%
    
    set enginePath=%path%engines\%engine%\
    cd /d %enginePath%
    
    %engine%.exe %base%
    goto END
    
    :END
    PAUSE
    
    EXIT
    gqe/shell/script.js
    Code:
    $(document).ready(function(){
    	$engine=$("#engine").val();
    	
    	$(".btn").click(function(event){
    		event.preventDefault();
    		$("#menu").submit();
    	});
    	
    	$("#menu").submit(function(event){
    		event.preventDefault();
    		var def = ($('#default').prop('checked'))?"y":"n";
    		var opt = ($('#optional').prop('checked'))?"y":"n";
    		var eng = $engine;
    		var gam = $("#gameName").val();
    		var map = "\""+$("#mapName").val()+"\"";
    		if($("#default").prop("checked"))IOFile(2, $("#default_cmln").text(), "GQE/configs/cmln");
    		if($("#optional").prop("checked"))IOFile(2, $("#optional_cmln").text(), "GQE/configs/"+$("#engine").val()+"/cmln");
    		cmdLine = eng+","+gam+","+map+","+def+","+opt;
    		initShell(cmdLine);
    	});
    	
    	$("#default_cmln").change(function() {
    		if($(this).text() == "")
    		{	$("#default").prop("disabled", true);
    			$("#default").prop("checked", false);
    		} else
    			$("#default").prop("disabled", false);
    	});
    	
    	$("#optional_cmln").change(function() {
    		if($(this).text() == "")
    		{	$("#optional").prop("disabled", true);
    			$("#optional").prop("checked", false);
    		} else
    			$("#optional").prop("disabled", false);
    	});
    	
    	
    	$("#engine").change(function() {
    		if($("#optional").prop("checked"))IOFile(2, $("#optional_cmln").text(), "GQE/configs/"+$engine+"/cmln");
    		$engine = $(this).val();
    		CheckOptional($engine);
    	});
    });
    
    function enable(target, data){
    	$("#"+target).prop("disabled", false);
    	$("#"+target).prop("checked", true);
    	$("#"+target+"_cmln").text(data);
    }
    
    function disable(target, data){
    	$("#"+target).prop("disabled", true);
    	$("#"+target).prop("checked", false);
    	$("#"+target+"_cmln").text(data);
    }
    
    function getEngine(){
    	return $("#engine").val();
    }
    gqe/shell/script.vbs
    Code:
    Dim intX : Dim intY
    Dim intWidth : Dim intHeight
    
    ' fires on load or refresh			
    Sub Window_onLoad
    	' get the file ready off screen
    	window.offscreenBuffering = True
    	eng = getEngine()
    	
    	call DoIni()
    	
    	CheckDefault()
    	CheckOptional eng
    End Sub
    
    ' fires before window closes
    Sub Window_onBeforeUnLoad
    	If CInt(intX) <> CInt(window.screenLeft) Or CInt(intY) <> CInt(window.screenTop) Then
    		intX = window.screenLeft
    		intY = window.screenTop
    	
    		data = intWidth & "," & intHeight & "," & intX & "," & intY
    		IOFile 2, data, "GQE/shell/shell.ini"
    	End If
    End Sub
    
    ' sets ini data (returnable)
    Function DoIni
    	DoIni = IOFile(1,"","GQE/shell/shell.ini")
    	arrINI = Split(DoIni, ",")
    	
    	For i = 0 To UBound(arrINI)
    		value = arrINI(i)
    		Select Case i
    			Case 0
    				intWidth = value
    			Case 1
    				intHeight = value
    			Case 2
    				intX = value
    			Case 3
    				intY = value
    		End Select
    	Next
    	
    	window.moveTo intX, intY
    	window.resizeTo intWidth, intHeight
    End Function
    
    ' sets ini data (returnable)
    Sub CheckDefault
    	def = IOFile(1,"","GQE/configs/cmln")
    	If def <> "" Then
    		enable "default", def
    	Else disable "default", ""
    	End If
    End Sub
    
    ' sets ini data (returnable)
    Sub CheckOptional(engine)
    	path = "GQE/configs/" & engine & "/cmln"
    	opt = IOFile(1,"",path)
    	If opt <> "" Then
    		enable "optional", opt
    	Else disable "optional", ""
    	End If
    End Sub
    
    ' run gqe.bat with commands
    Sub initShell(cmds)
    	commandline="gqe.bat " & Replace(cmds , "," , " ")
    	Set objWshShell = CreateObject("Wscript.Shell")
    	objWshShell.run commandline, 1
    End Sub
    			
    ' read/writes any text file
    Function IOFile(openType, data, path)
    	Const ForReading = 1
    	Const ForWriting = 2
    	Const ForAppending = 8
    	
    	If openType > 8 Or openType < 1 Then
    		ReportError "IOFile Error: unrecognized openType value: " & openType
    	Else
    		Set objFSO = CreateObject("Scripting.FileSystemObject")
    		blank = True
    		
    		If objFSO.FileExists(path) Then
    			If objFSO.GetFile(path).size <> 0 Then
    				Set objFile = objFSO.OpenTextFile(path, openType)
    				blank = False
    			End If
    		End If
    		
    		Select Case openType
    			Case ForReading
    				If blank Then
    					IOFile = ""
    				Else
    					IOFile = objFile.ReadAll
    				End If
    			Case ForWriting
    				If blank <> True Then
    					If data <> "" Then							
    						If data = "#" Then
    							objFile.Write ""
    						Else
    							objFile.Write data
    						End If
    					Else
    						ReportError "IOFile Error: There is no data to write"
    					End If	
    				End If
    			case ForAppending
    				If blank <> True Then
    					If data <> "" Then
    						objFile.Write data
    					Else
    						ReportError "IOFile Error: There is no data to append"
    					End If
    				End If
    		End Select
    	
    		if blank <> True Then objFile.Close
    	End If
    End Function
    of course there will be some polishing done before I officially release this but, this is where all the job scripts are at the moment.
    http://www.nextgenquake.com

    Comment


    • #17
      design crew

      I'm at work and it is slow. I feel like I could be getting this wrapped up but, I have no computer with me. This made me think harder abouthow to still make progress.

      So far, the visual design of this is totally open. I also haven't given it much thought. This is where you come in. I'm here for like 5 more hours, that's 5 hours that you could be suggesting to me design ideas.

      This can be any form of suggestion: colors, fonts, seamless textures, shapes, form arrangement, wording, anything you can see. Bonus points for any images that represent a suggestion or any other form of secific data (like hex values for color suggestions).

      You're the boss (sort of, kind of, barely) tell me how to design the menu.
      http://www.nextgenquake.com

      Comment


      • #18
        This project is officially dead. I decided that it would be better if... hah I'm JK. Actually the project is moving forward very nicely. I pretty much have everything working, it's just a matter of styling it up at this point.

        I spent last night tightening up my scripts and adding in the skill selector that Talisa suggested. You guys/girls are still welcome to give me some design suggestions. I'll be quite honest with you - no suggestions is going to equal a very boring interface. If I can't get a handful of people interested in giving me some feedback then I don't intend to give it that much effort. I'm thinking readable and white... change my mind. I'm not awesome at visual design. I'm barely even good (adequate) so, I don't intend to spin my wheels with no direction. Considering the complete lack of feedback, there is no competition for ideas. This means you (whomever you are) have a high chance of seeing your idea/suggestion being implemented. In other words, just make some friggin suggestions... it will probably make it into the app without question.

        ---- Other Stuff

        I thought about how hard it is to add an engine and I have a solution (that I haven't created yet). Instead of hard coding the engine options in, I need to "scrape" the engine folder and have all menus (bat/hta) derived on-the-fly. This will be complimented by the configs folder also being "scraped" and a comparison of existing config folders against existing engine folders being made. All engine folders that are not represented in the config will be created. This way adding an engine is very simple.

        1)create a new folder in Quake/engines
        2)dump the engine in it
        3)rename the folder to the same name as the executable for the engine
        4)start Enginator

        That's it. 1 through 3 gets the engine in the mix and 4 will "make it official". I don't know how to do any of this yet but, I have full confidence I will figure it out.

        Well, I have to go to work now.
        Last edited by MadGypsy; 03-28-2015, 07:43 AM.
        http://www.nextgenquake.com

        Comment


        • #19
          A week of designing a solution to the symptoms of a problem --- using tools that cannot handle things like the user changing gamedir in the engine, etc.

          Or a few lines of code in the engine, making it invulernable ...

          Code:
          	// If file is config.cfg for the Mark V stamp at the top
          	if (!strcasecmp (Cmd_Argv(1), "config.cfg"))
          	{
          		// Don't read another engine's configuration file ...
          		#define ENGINE_STAMP "// Mark V"
          		const char *found = strstr(s, ENGINE_STAMP);  // Engine stamp
          		if (!found)
          		{
          			// Load backup from user's cache folder if found
          			// We save the config twice
          			// the 2nd time buried away in caches folder
          			// $engine/appdata/roaming/$gamedir
          			byte *data = File_To_Memory_Alloc (CacheFolderForGameDir(gamedir, Cmd_Argv(1)));
          I know you mean well, but your solution is like an elaborate system of buckets when the problem is the sink is leaking.
          Quakeone.com - Being exactly one-half good and one-half evil has advantages. When a portal opens to the antimatter universe, my opposite is just me with a goatee.

          So while you guys all have to fight your anti-matter counterparts, me and my evil twin will be drinking a beer laughing at you guys ...

          Comment


          • #20
            Why are you so stuck on this being some solution? It's just an app. It does what it does. I'm not aware of any problems that people are having with playing quake in any number of engines. My app exists for the sake of it's possibility, and nothing more.

            Stop being the come down king, bro. It's like it's impossible for you to simply let things happen. What have your interludes done to effect this project? Nothing, is what. Just more negativity from you for the Quakeone history book. Relax, man.

            I don't care if I'm solving non-issues. I'm making a cool little app and strengthening my understanding of MANY languages in the process.

            Ie.... it ain't gonna work. I'm not Superman anymore. I'm Batman, and he is immune to your kryptonite. [Rips personal strings from your hands]
            Last edited by MadGypsy; 03-28-2015, 09:30 AM.
            http://www.nextgenquake.com

            Comment


            • #21
              Originally posted by MadGypsy View Post
              Why are you so stuck on this being some solution?
              You did post it as a solution in a public forum, so I did gauge it by that metric.

              Well, anyway ... I'll leave you alone to play with css or make Flash stuff or whatever.
              Quakeone.com - Being exactly one-half good and one-half evil has advantages. When a portal opens to the antimatter universe, my opposite is just me with a goatee.

              So while you guys all have to fight your anti-matter counterparts, me and my evil twin will be drinking a beer laughing at you guys ...

              Comment


              • #22
                I figured out how to create the engine menus on-the-fly. Now "installing" an engine is as simple as the steps in my second to last post.

                @talisa - +skill doesn't seem to do anything. I've checked commandline switches for a handful of engines and none of them document this switch. Can you point me to where you got this information?

                @baker - you have actually been on ignore for me for months (re: your critical thinker rant of uselessness). I know you (enough) and I know me. After reading your 2nd to last post and your penchant to participate with bah-humbug, instead of something talented to say, I can't say I intend to read your last post. I am going to finish this app and anyone that has something unhelpful to say will be entirely ignored. It's actually a shame. You are a talented and knowledgeable guy. You probably possess information that can make my app better, instead you choose to waste your effort and voice. If you want to be helpful and get your message of helpfulness to me, change the title of your response to helpful. Burn it and I will ignore you forever.

                @why is this taking so long

                I only have an hour or 2 a night to work on this. Also as I complete my script, I realize ways to make it better (like dynamic menus) and that sets me back a night. Batwise this program is entirely complete. HTAwise I have a little more work to do.
                Last edited by MadGypsy; 03-29-2015, 06:53 AM.
                http://www.nextgenquake.com

                Comment


                • #23
                  I was thinking about how I intend to package this and make it downloadable. My usual MO is to simply upload to some temporary file upload site but, I want better than that this time. I'm going to figure out how some sites allow you to choose the contents of your download. If I do that, I can put every engine and version in the list and allow people to contour their engine folder prior to download. This will also give me a way to track downloads. Maybe even a simple comment system on the bottom of the page. Most of what I just said is already complete due to my unfinished CMS scripts. Ijust need to figure out how to build a zip on the fly. I work on this everyday and make decent progress considering my limited time... I am not in a rush to complete this though. I want to complete a nice, tight and clean system that was considered from one end clean out to the other. Considered to death, even.

                  I know my app isn't "in demand", it isn't solving any issues, it may even be pointless to some degree. None of that matters to me. I'll take something like this and use it as an example, to someone with money, of the many many languages I program in and my ability to bring ideas and concepts to life, regardless of their complexity or obscurity. Once I bang out the web form/page php and sql will be added to the languages used to complete this... rounding off the languages to include every angle of web development (content, appearance, behavior, server, database) with 2 system languages to boot. A very decent example, indeed.
                  http://www.nextgenquake.com

                  Comment


                  • #24
                    @gypsy
                    it works for me. i always start any maps with the +skill switch

                    all my bats i have created for maps and mods include '+skill 3' at the end
                    cuz i prefer to play in nightmare and this way i dont have to set it manually after starting the map/mod

                    this is something thats engine-independant, it works also in the original quake.

                    just try starting an engine with parameter '+skill 3' and then in-game open console and type 'skill' and you'll see its set to that skill

                    0 is easy, 1 is normal, 2 is hard, and 3 for nightmare

                    .

                    regarding documentation about the +skill switch: http://quakewiki.org/wiki/Installing_addons
                    right at the bottom of that page is a mention of the +skill parameter
                    Last edited by talisa; 03-29-2015, 08:39 AM.
                    .
                    are you curious about what all there is out there in terms of HD content for quake?
                    > then make sure to check out my 'definitive' HD replacement content thread! <
                    everything that is out there for quake and both mission-packs, compiled into one massive thread

                    Comment


                    • #25
                      @skill - i didn't check it via console. I just started e1m1 with skill 3 and it wasn't any different.
                      http://www.nextgenquake.com

                      Comment


                      • #26
                        hmm which engine did you try it in?

                        cuz i know it works in darkplaces, i always start all mods and maps using the +skill parameter so i dont have to change the skill via console
                        .
                        are you curious about what all there is out there in terms of HD content for quake?
                        > then make sure to check out my 'definitive' HD replacement content thread! <
                        everything that is out there for quake and both mission-packs, compiled into one massive thread

                        Comment


                        • #27
                          Originally posted by MadGypsy View Post
                          @skill - i didn't check it via console. I just started e1m1 with skill 3 and it wasn't any different.
                          +skill 3, you need the +
                          www.quakeone.com/qrack | www.quakeone.com/cax| http://en.twitch.tv/sputnikutah

                          Comment


                          • #28
                            @rook - I had the +, I just didn't type it in my post

                            @talisa - I did like you said and typed "skill" in the console and it said "skill 3, [1]" (in darkplaces). It still didn't seem like nightmare, unless nightmare is super easy.

                            ---- fun code stuff

                            Here is the part of my bat that creates the engine selection menu on-the-fly, and "installs" it's config folder.

                            Array's basically don't exist in batch script so, I had to sort of invent them.

                            eng_map basically ends up looking something like this:
                            "1-darkplaces;2-DirectQ;3-glpro493;"...etc

                            v first gets assigned by the user selection then uses itself to become the answer of itself (sort of...it works whatever I did, lol). Basically this is just a string manipulation that uses v- and ; as delimiters BUT I had to throw some voodoo in the mix with "call set", and that had me stumped for a long time cause I have never even heard of call set. I'm still not 100% sure of what it does but, the results are unarguable.

                            Another tricky thing was string concat. My line: set "eng_map=" may look nutty but that is basically creating the var in a way that I can concat to it. I tried it other ways and that is the only one that worked. Finding the proper balance of !var! and %var% in my delayedexpansion was also a bit tricky. I can't lie, bat script has me confused on many levels. I always get this shit to work but, I don't always understand why it works. Searching the internet for some of these answers is futile. Often I end up just resyntaxing things til they finally work.

                            break>filepath is a cheap and quick way for me to create a text file if it doesn't exist.

                            the results of this code dynamically spit out something like
                            1. darkplaces
                            2. DirectQ
                            3. fitzquake085
                            4. fteqw
                            5. glpro493
                            6. g1Qrack
                            7. qbismS8
                            8. quakespasm
                            choose an engine:

                            then your number choice is converted to engineName (via eng_map) and %path%\engines\engineName\engineName.exe becomes the executable. (this part of code is not shown)

                            Code:
                            :ENG_CHOICE
                            @echo off
                            set engPath=%path%engines
                            cd %engPath%
                            
                            set /a c=0
                            set "eng_map="
                            
                            setlocal ENABLEDELAYEDEXPANSION
                            
                            for /d %%a in (*.*) do (
                            	@echo off
                            	set cfgPath=%path%GQE\configs\%%a\
                            	if not exist !cfgPath! md !cfgPath!
                            	if not exist !cfgPath!cmln break>!cfgPath!cmln
                            	
                            	set /a c=c+1
                            	if not "!eng_map!"=="" set "eng_map=!eng_map!;!c!-%%a"
                            	if "!eng_map!"=="" set "eng_map=!c!-%%a"
                            	echo.!c!. %%a
                            )
                            
                            set /p v=engine:
                            if not "%v%"=="" call set v=%%eng_map:*%v%-=%%
                            if not "%v%"=="" set engine=%v:;=&rem.%
                            
                            if not "%engine%"=="0" goto GAM_CHOICE
                            ECHO "%v%" is not a valid choice. Try again
                            
                            endlocal
                            it works great. All you have to do is dump the engine in Quake/engines/folderNamedAfterExeToRun and start Enginator...voila, no hard coding or other bullshit to do

                            EDIT WOOOOPS:
                            line 72: if not exist !cfgPath!cmdl break>!cfgPath!cmdl

                            should be:
                            if not exist !cfgPath!cmln break>!cfgPath!cmln

                            sorry. Already fixed it in the above code
                            Last edited by MadGypsy; 03-30-2015, 11:09 AM.
                            http://www.nextgenquake.com

                            Comment


                            • #29
                              Do y'all want me to release the bat before I finish the HTA?

                              all you have to do is make this directory structure

                              Quake(or whatever you want)
                              Quake/engines/
                              Quake/id1/(or some other game folder)
                              Quake/GQE/configs/
                              Quake/GQE/configs/cmln (empty text file with no extension - put generic switches in this file)
                              Quake/gqe.bat

                              or click here for a premade. You need to supply your own id1 (or equivalent) folder
                              https://anonfiles.com/file/0b9939852...2c9e68ba92228d

                              dump all the engines you want in Quake/engines within properly named folders (same name as engine exe) and start the bat.

                              Ex: Quake/engines/glpro493/glpro493.exe

                              here Is the bat for people "building" from scratch
                              Code:
                              :: turn off console printing for a moment
                              @echo off
                              
                              
                              :CONFIG
                              ::prime some options
                              set usedef=0
                              set useopt=0
                              set engine=0
                              
                              ::path=directory of this bat
                              set path=%~dp0
                              ::get the default command line
                              set /p default=<%path%GQE\configs\cmln
                              ::change CWD to current directory
                              cd /d %path%
                              ::spam clear
                              cls
                              
                              ::check if this is being caslled from the hta menu
                              :CHECK
                              ::if the first variable is set
                              if not "%1"=="" goto FROM_HTA
                              ::else, if it wasn't
                              goto ENG_CHOICE
                              
                              
                              ::if %1 was assigned these need to be assigned as well
                              :FROM_HTA
                              
                              ::engine
                              set engine=%1
                              ::-game
                              if "%2"=="" (goto GAM_ERR) else set gameName=%2
                              ::+map
                              if "%3"=="" (goto MAP_ERR) else set mapName=%~n3
                              ::use default commandline
                              if not "%4"=="y" (set usedef=n) else set usedef=y
                              ::use optional commandline
                              if not "%5"=="y" (set useopt=n) else set useopt=y
                              ::get optional commandline
                              set /p optional=<%path%gqe\configs\%engine%\cmln
                              ::+skill
                              if not "%6"=="n" (set setskill=%6) else set setskill=n
                              goto RUN
                              
                              ::unspecified stuff
                              :GAM_ERR
                              ECHO -game was unspecified
                              :MAP_ERR
                              ECHO +map was unspecified
                              goto END
                              
                              
                              :ENG_CHOICE
                              @echo off
                              set engPath=%path%engines
                              cd %engPath%
                              
                              set /a c=0
                              set "eng_map="
                              
                              setlocal ENABLEDELAYEDEXPANSION
                              
                              for /d %%a in (*.*) do (
                              	@echo off
                              	set cfgPath=%path%GQE\configs\%%a\
                              	if not exist !cfgPath! md !cfgPath!
                              	if not exist !cfgPath!cmdl break>!cfgPath!cmdl
                              	
                              	set /a c=c+1
                              	if not "!eng_map!"=="" set "eng_map=!eng_map!;!c!-%%a"
                              	if "!eng_map!"=="" set "eng_map=!c!-%%a"
                              	echo.!c!. %%a
                              )
                              
                              set /p v=engine:
                              if not "%v%"=="" call set v=%%eng_map:*%v%-=%%
                              if not "%v%"=="" set engine=%v:;=&rem.%
                              
                              if not "%engine%"=="0" goto GAM_CHOICE
                              ECHO "%v%" is not a valid choice. Try again
                              
                              endlocal
                              
                              goto ENG_CHOICE
                              
                              :GAM_CHOICE
                              ::get optional command line file
                              set /p optional=<%path%GQE\configs\%engine%\cmln
                              ::start a choice
                              set /p gameName=-game:
                              ::default to id1 if there is an empty result
                              if "%gameName%"=="" set gameName=id1
                              
                              
                              :MAP_CHOICE
                              ::start a choice
                              set /p mapName=+map:
                              ::if a map was given goto +skill choice
                              if not "%mapName%"=="" goto SKL_CHOICE
                              ::if not...
                              ECHO You didn't supply a mapName. Try again.
                              ::start the choice over
                              goto MAP_CHOICE
                              
                              :SKL_CHOICE
                              ::start a choice
                              set /p setskill=+skill (0-easy to 3-nightmare) or n to skip:
                              if "%setskill%"=="0" goto RESUME
                              if "%setskill%"=="1" goto RESUME
                              if "%setskill%"=="2" goto RESUME
                              if "%setskill%"=="3" goto RESUME
                              if "%setskill%"=="n" goto RESUME
                              ::if the choice did not match any of the approved values...
                              echo %setskill% is not a valid option
                              ::start the choice over
                              goto SKL_CHOICE 
                              
                              
                              :RESUME
                              if not "%default%"=="" goto DEF_CHOICE
                              if not "%optional%"=="" goto OPT_CHOICE
                              goto RUN
                              
                              :DEF_CHOICE
                              Echo %default%
                              set /p usedef=Use default commandline options (y/n):
                              if not "%optional%"=="" goto OPT_CHOICE
                              goto RUN
                              
                              :OPT_CHOICE
                              Echo %optional%
                              set /p useopt=Use engine specific commandline options (y/n):
                              goto RUN
                              
                              :RUN
                              set "base=-basedir %path% -game %gameName% +map %mapName%"
                              
                              if not "%setskill%"=="n" set "base=%base% +skill %setskill%"
                              
                              if "%usedef%"=="y" set "base=%base% %default%"
                              if "%useopt%"=="y" set "base=%base% %optional%"
                              Echo cmd line: %engine%.exe %base%
                              
                              set enginePath=%path%engines\%engine%\
                              cd /d %enginePath%
                              
                              %engine%.exe %base%
                              goto END
                              
                              :END
                              PAUSE
                              
                              EXIT
                              How do you know it really worked, beyond just starting a map in an engine?

                              after running the bat once...
                              1. Check configs folder. You should have a virtual copy of your engines folder structure and within each folder will be an empty cmln file
                              2. Open configs/cmln and type something (preferably switches - ex: -width 1024 -height 768 -window). Now start the bat. When it gets to cmln part it should echo your command line and ask if you want to include it.
                              3. Do the same thing as 2 but to configs/someEngine/cmln and with different switches

                              My hta eliminates the need to navigate to these files but it isn't complete yet.

                              It may seem strange to have a virtualky empty folder (GQE) with nothing but another folder in it. My HTA puts a lot more files in the GQE folder. Basically this is the stripped version, still using the advanced versions folder structure.
                              Last edited by MadGypsy; 03-30-2015, 07:32 AM.
                              http://www.nextgenquake.com

                              Comment


                              • #30
                                One more thing and I'll stop spamming.

                                I built this on a win 8.1 machine. I am not some bat script guru and therefore I have no idea of the backwards/?forwards? compatibility of this script. If you have issues getting something to work, feel free to post here about it and I will attempt to troubleshoot it for you.

                                What kind of info do I need regarding issues?

                                1) how far did the script get before it failed? ie. what is the last expected line in the console window
                                2) what error did it give you?
                                3) what windows operating system are you using?

                                These are pretty much standard but if you think of anything else that you would like to add, feel free. Also keep in mind that I will be troubleshooting your issue "in the dark". I do not have your operating system or access to a computer that does. This means I may never figure out what is wrong but, I will certainly try.

                                I want this to work... period, and I am a talented guy. If my stuff doesn't work, don't get frustrated and assume it is garbage, get proactive. I don't make junk, I simply can't be expected to spit out perfect code for a slew of OS's when I only have 1 OS to test with. If you are using Win 8.1 and you have issues, I call bullshit. Read the directions again.

                                The script fails but the console disappears too fast for me to see what it says. What do I do?

                                You can write PAUSE on a new line anywhere in the script and it will wait for a keypress to continue. It's a little bit of work but you can keep running the script and moving your PAUSE down the script until it gets to a point where your console spits out the error and then pauses. It's not too hard to isolate where to pause because my script happens "in a row" so you can see how far the script gets and eliminate a bunch of labels as the culprit.

                                :ENG_CHOICE <-stuff like this is a label

                                An example:
                                Let's say the script gets to - use default command line (y/n), you input something and it fails. Well, that is the DEF_CHOICE label, and since my script is linear ALL labels before that are not the problem. Which means PAUSE should be put somewhere after the line that asks you to make a choice. Inputting something other than y or n is not going to be the culprit. My script only cares about y and considers anything that is not a y to be an n. You could even just hit enter and it will assume you mean n (except +skill 0 to 3 or n only, anything else will ask you to set it again).

                                This package is pretty portable and can be put basically anywhere on your harddrive BUT it is NOT recommended that you put it anywhere that includes a space or strange characters in the path (ex ProgramFiles (x86)). Will putting it there break it? Probably not but, if it does, it could take forever to isolate that as the problem. Spaces in the path is more of a cygwin console problem but treating all console applications like they have this problem means you will never have this problem.

                                If you are a guest using my app and you have issues but don't want to sign up here to report them, you can email me [email protected] however, I check this account very rarely and it may be some time before you get a response. The fastest way to get help is to post in this thread.

                                If you have issues AND fix them - please please please post about it here.

                                Overall, I'm beating the hell out of this issue drum but you probably aren't going to have any. I ripped a bunch of this script from bats I made on XP. There is a small portion that I'm unsure of (basically my fake array). I just want it to be clear as to how to get me to fix issues and the info I need to start troubleshooting.
                                Last edited by MadGypsy; 03-30-2015, 10:57 AM.
                                http://www.nextgenquake.com

                                Comment

                                Working...
                                X