• There seems to be an uptick in Political comments in recent months. Those of us who are long time members of the site know that Political and Religious content has been banned for years. Nothing has changed. Please leave all political and religious comments out of the forums.

    If you recently joined the forums you were not presented with this restriction in the terms of service. This was due to a conversion error when we went from vBulletin to Xenforo. We have updated our terms of service to reflect these corrections.

    Please note any post refering to a politician will be considered political even if it is intended to be humor. Our experience is these topics have a way of dividing the forums and causing deep resentment among members. It is a poison to the community. We appreciate compliance with the rules.

    The Staff of SOH

  • Server side Maintenance is done. We still have an update to the forum software to run but that one will have to wait for a better time.

DCG + QBasic

Aha! I finally got me one of those Akemi catfish that hang out around Hamburg. They burn just like anything else once you get them lit up.:costumes:
 
OK. I've got this thing to the point where it can be beta tested. This may not be the final version, but it's close. I haven't had time to check it out in a lot of different scenarios. I've been testing it in Europe, and it does what I want it to do there. But I haven't tested it at all in the PTO yet. So if anyone wants to give it a test drive in the PTO, let me know how it comes out.

You can get your QBasic here:
http://www.petesqbsite.com/sections/introduction/intro.shtml

Drop the QBasic files into your CFS2 CAMPAIGNS folder and create a shortcut to QBasic.exe

If you have multiple installs, you'll need to drop copies of QBasic into all your CAMPAIGNS folders and create individually named shortcuts for each install. You can rename a shortcut by right clicking on it and selecting the rename option.

I'll post the code in the following post. You can copy it and paste it into a notpad file. Name the file DCGQB.BAS - or whatever else you want to name it, but it must have a ".BAS" extension. Drop it into your CAMPAIGNS folder. Then you can load the file with QBasic and run it after you generate a DCG mission. You can keep QBasic active on the toolbar while you're flying missions.

The program will do the following:

1. Changes the fighter formations to finger four. This is more realistic, and seems to reduce collisions.

2. Spreads the bomber formations vertically, which seems to reduce collisions.

3. Changes mechanized ground formations to a line astern formation so they will run on roads and railroads. When I get around to it, I'll try to space the formation elements the right distance apart to simulate moving trains.

4. Since DCG does not assign AI fighter squadrons to escort duty, the program re-assigns spare CAP's as escorts. CAP's will only be assigned to escort strikes originating from the same airfields or carriers. The player flight may be reassigned to escort duty if the player gets a CAP or sweep mission. The program will always leave a minimum number of CAP's at an airfield. This minimum number is determined interactively by the user. If DCG does not assign any CAP's to an airfield, the program will not add any. This feature also facilitates long range escorted strategic bombing. Escorts are assigned without regard to range limitations of the fighters, so for realism, only long range fighters should be stationed at bases with long range bombers.

5. Screen prints a cryptic mission briefing on all the flights originating from the player airfield or carrier. Displays squadron names, mission directives, and target coordinates. If you get reassigned to escort duty, you can figure out which strike(s) you're escorting by comparing target coordinates. Then you can look at the original DCG briefing to find the target name.

6. Provides long range loadouts to CAP's reassigned as escorts. For this purpose, the program assumes that payload (1) is Guns Only Long Range, which is the case with all stock fighters and most addons.

7. Offers the player the opportunity to change the payloads on all the player flight aircraft after displaying the mission briefing. DCG only loads out fighters with rockets for strike missions. This option allows the player to switch to bombs or whatever.

8. Searches for and fixes 3 known DCG bugs. There are 2 other intermittent bugs I know of that I haven't gotten around to addressing, but they're not in the Mission file. This program currently only edits the Mission file. There is a bug which sometimes occurs in the Squadrons file when a squadron is transferred to another airfield by DCG. It is also the case that DCG will continue to assign strikes against task forces after all the ships in the task force have been sunk.
 
Here's the code.




' DCGQB by Ettico - QBasic for dummy DCG fans
CLEAR
CLS
PRINT "Welcome to the DCG Kicker."
PRINT "You must generate a DCG mission before running this program."
PRINT
PRINT "This program may re-assign some CAP's as escorts."
PRINT
PRINT "Please enter your recommended minimum number of CAP's you want the"
PRINT "program to keep at each carrier or airfield if possible."
PRINT "I recommend a minimum of (2) CAP's per carrier for carrier operations."
PRINT "I recommend (0) to (1) CAP per airfield for ground based operations."
PRINT "If you've already made your recommendation, just hit ENTER at the prompt."
q$ = ""
INPUT q$
IF q$ = "" THEN GOTO 5
x = VAL(q$) + 1
ON ERROR GOTO 3
KILL "capcfg"
3 OPEN "capcfg" FOR OUTPUT AS #1
PRINT #1, x
CLOSE

5 OPEN "capcfg" FOR INPUT AS #1
INPUT #1, mincap
CLOSE
line$ = "": load = 0: gcount = 0: ccount = 0: alt = 0: alt$ = ""
pcount = 0: rf = 0: airflag = 0: capflag = 0: pathflag = 0: pflag = 0: player = 0: wp0 = 0: rcount = 0: rflag = 0
gstart = 0: linecount = 0: gstart = 0: id = 0: name$ = ""
DIM groups$(52, 7)
DIM paths$(364)
DIM caps(52, 2)
DIM airfields$(50, 3)
OPEN "Mission.MIS" FOR INPUT AS #1
10 IF EOF(1) THEN 20
LINE INPUT #1, line$
IF LEFT$(line$, 8) = "[runway." THEN rcount = rcount + 1: rflag = 1
IF rflag = 0 THEN 10
IF LEFT$(line$, 3) = "id=" THEN airfields$(rcount, 1) = RIGHT$(line$, 4)
IF LEFT$(line$, 9) = "base_lat=" THEN airfields$(rcount, 2) = RIGHT$(line$, (LEN(line$) - 9))
IF LEFT$(line$, 9) = "base_lon=" THEN airfields$(rcount, 3) = RIGHT$(line$, (LEN(line$) - 9)): rflag = 0
GOTO 10
20 CLOSE
OPEN "Mission.MIS" FOR INPUT AS #1
OPEN "Missionx" FOR OUTPUT AS #2
400 IF EOF(1) THEN 1700
LINE INPUT #1, line$
linecount = linecount + 1
IF LEFT$(line$, 13) = "[unit.0]" THEN gstart = linecount
IF LEFT$(line$, 11) = "waypoint.6=" THEN gstart = linecount + 2
IF LEFT$(line$, 3) = "id=" THEN id$ = RIGHT$(line$, 4)
IF LEFT$(line$, 18) = "name=%name_string." THEN name$ = line$
430 IF LEFT$(line$, 8) = "[runway." THEN rf = 1
IF rf <> 1 THEN 520
IF LEFT$(line$, 3) <> "id=" THEN 520
rf = VAL(RIGHT$(line$, 4)): ccount = ccount + 1: caps(ccount, 1) = rf: rf = 0
520 IF line$ = "is_player_aircraft=1" THEN load = 1: count = 0
600 IF LEN(line$) < 13 THEN 1380
IF RIGHT$(line$, 9) = "0,300,0.0" THEN line$ = LEFT$(line$, 26) + "0,-150,0": GOTO 1380
IF RIGHT$(line$, 10) = "-300,0,0.0" THEN line$ = LEFT$(line$, 26) + "0,-300,0": GOTO 1380
IF RIGHT$(line$, 9) = "300,0,0.0" THEN line$ = LEFT$(line$, 26) + "0,-450,0": GOTO 1380
IF RIGHT$(line$, 10) = "0,-600,0.0" THEN line$ = LEFT$(line$, 26) + "0,-600,0": GOTO 1380
IF RIGHT$(line$, 13) = "-300,-300,0.0" THEN line$ = LEFT$(line$, 26) + "0,-750,0": GOTO 1380
IF RIGHT$(line$, 12) = "300,-300,0.0" THEN line$ = LEFT$(line$, 26) + "0,-900,0": GOTO 1380
IF RIGHT$(line$, 9) = "0,600,0.0" THEN line$ = LEFT$(line$, 26) + "0,-1050,0": GOTO 1380
IF RIGHT$(line$, 14) = "-500,-1000,-10" THEN line$ = LEFT$(line$, 26) + "-300,-600,0": GOTO 1380
IF RIGHT$(line$, 15) = "-1000,-2000,-20" THEN line$ = LEFT$(line$, 26) + "300,-600,150": GOTO 1380
IF RIGHT$(line$, 15) = "-1500,-3000,-30" THEN line$ = LEFT$(line$, 26) + "600,-1200,150": GOTO 1380
IF RIGHT$(line$, 15) = "-2000,-4000,-40" THEN line$ = LEFT$(line$, 26) + "1200,-1200,300": GOTO 1380
IF RIGHT$(line$, 15) = "-2500,-5000,-50" THEN line$ = LEFT$(line$, 26) + "900,-1800,300": GOTO 1380
IF RIGHT$(line$, 15) = "-3000,-6000,-60" THEN line$ = LEFT$(line$, 26) + "1500,-1800,450": GOTO 1380
IF RIGHT$(line$, 15) = "-3500,-7000,-70" THEN line$ = LEFT$(line$, 26) + "1800,-2400,450": GOTO 1380
IF RIGHT$(line$, 14) = "-1000,-500,-10" THEN line$ = LEFT$(line$, 37) + "-30": GOTO 1380
IF RIGHT$(line$, 13) = "1000,-500,-20" THEN line$ = LEFT$(line$, 36) + "-60": GOTO 1380
IF RIGHT$(line$, 13) = "200,-1000,-30" THEN line$ = LEFT$(line$, 36) + "-90": GOTO 1380
IF RIGHT$(line$, 15) = "-2000,-2000,-40" THEN line$ = LEFT$(line$, 38) + "-120": GOTO 1380
IF RIGHT$(line$, 15) = "-3000,-3000,-50" THEN line$ = LEFT$(line$, 38) + "-150": GOTO 1380
IF RIGHT$(line$, 15) = "-1000,-3000,-60" THEN line$ = LEFT$(line$, 38) + "-180": GOTO 1380
IF RIGHT$(line$, 15) = "-1800,-4000,-70" THEN line$ = LEFT$(line$, 38) + "-210"
1380 PRINT #2, line$
IF line$ = "type=air" THEN gcount = gcount + 1
IF gcount = 0 THEN 400
x = LEN(name$)
n$ = RIGHT$(name$, (x - 6)): x = x - 6
n$ = LEFT$(n$, (x - 1))
IF groups$(gcount, 3) = "" THEN groups$(gcount, 3) = LTRIM$(id$)
IF groups$(gcount, 6) = "" THEN groups$(gcount, 6) = STR$(gstart)
IF groups$(gcount, 7) = "" THEN groups$(gcount, 7) = n$
IF line$ = "players_formation=1" THEN player = gcount
IF LEFT$(line$, 9) = "directive" THEN groups$(gcount, 1) = line$
IF groups$(gcount, 7) = "" THEN 1382
FOR I = 1 TO gcount
x = LEN(groups$(I, 7))
IF MID$(line$, 2, x) = groups$(I, 7) THEN groups$(I, 7) = line$
NEXT I
1382 IF LEFT$(line$, 10) = "waypoint.6" THEN runway$ = RIGHT$(line$, 8): runway$ = LEFT$(runway$, 4)
IF gcount = player THEN 1620
groups$(gcount, 2) = runway$
FOR I = 1 TO rcount
IF groups$(gcount, 2) = airfields$(I, 1) THEN groups$(gcount, 4) = airfields$(I, 2): groups$(gcount, 5) = airfields$(I, 3)
NEXT I
IF LEFT$(line$, 11) <> "waypoint.3=" THEN 400
x = INSTR(1, line$, "N")
IF x = 0 THEN x = INSTR(1, line$, "S")
y = INSTR(1, line$, "E")
IF y = 0 THEN y = INSTR(1, line$, "W")
p = INSTR(1, line$, "+")
lat$ = MID$(line$, x, ((y - 2) - x))
lon$ = MID$(line$, y, ((p - 2) - y))
IF lat$ <> groups$(gcount, 4) THEN 400
IF lon$ <> groups$(gcount, 5) THEN 400
line$ = "waypoint.3=" + "1" + RIGHT$(line$, (LEN(line$) - 14))
groups$(gcount, 1) = "directive=32"
GOTO 400

1620 IF LEFT$(line$, 15) = "waypoint.1=4,1," THEN runway$ = RIGHT$(line$, 8): runway$ = LEFT$(runway$, 4)
IF LEFT$(line$, 12) = "waypoint.3=," THEN line$ = LEFT$(line$, 11) + "1" + RIGHT$(line$, (LEN(line$) - 11))
groups$(player, 2) = runway$
IF wp = 7 THEN 400
IF groups$(player, 1) <> "directive=128" AND groups$(player, 1) <> "directive=2048" THEN 400
IF LEFT$(line$, 9) <> "waypoint." THEN 400
IF LEFT$(line$, 10) = "waypoint.0" THEN pcount = pcount + 1: paths$(pcount) = runway$
pcount = pcount + 1
IF LEFT$(line$, 10) <> "waypoint.1" THEN 1630
x = LEN(line$) - 5
line$ = LEFT$(line$, x)
line$ = RIGHT$(line$, (x - 12))
line$ = "waypoint.1=32" + line$ + groups$(gcount, 3) + ",0,1"
1630 paths$(pcount) = line$: wp = wp + 1
GOTO 400
1700 CLOSE
FOR I = 1 TO gcount
name$ = groups$(I, 7)
x = LEN(name$)
name$ = LEFT$(name$, (x - 2)): x = x - 2
name$ = RIGHT$(name$, (x - 15)): x = x - 15
y = INSTR(name$, "=")
name$ = RIGHT$(name$, (x - y))
groups$(I, 7) = name$
NEXT I
gcount = 0
OPEN "Missionx" FOR INPUT AS #1
1710 IF EOF(1) THEN 1720
LINE INPUT #1, line$
IF line$ = "type=air" THEN gcount = gcount + 1
IF gcount = 0 THEN 1710
IF groups$(gcount, 1) <> "directive=128" AND groups$(gcount, 1) <> "directive=2048" THEN 1710
IF LEFT$(line$, 9) <> "waypoint." THEN 1710
IF LEFT$(line$, 10) = "waypoint.0" THEN pcount = pcount + 1: paths$(pcount) = runway$
pcount = pcount + 1
IF LEFT$(line$, 10) <> "waypoint.1" THEN 1715
x = LEN(line$) - 5
line$ = LEFT$(line$, x)
line$ = RIGHT$(line$, (x - 12))
line$ = "waypoint.1=32" + line$ + groups$(gcount, 3) + ",1,1"
1715 paths$(pcount) = line$

GOTO 1710
1720 CLOSE
FOR I = 1 TO ccount
FOR J = 1 TO gcount
vr = VAL(groups$(J, 2))
IF vr = caps(I, 1) AND groups$(J, 1) = "directive=32" THEN caps(I, 2) = caps(I, 2) + 1
NEXT J
NEXT I
FOR I = 1 TO pcount
p$ = paths$(I)
K = LEN(p$)
IF K < 5 THEN 1900
p1 = INSTR(p$, "+") + 1
p2 = INSTR(p1, p$, ","): p3 = p2 - p1
a$ = MID$(p$, p1, p3): a = VAL(a$) + 2000: a$ = LTRIM$(STR$(a))
n1$ = LEFT$(p$, (p1 - 1)): n2$ = RIGHT$(p$, (K - p2 + 1))
p$ = n1$ + a$ + n2$: K = LEN(p$)
IF LEFT$(p$, 10) = "waypoint.1" THEN p$ = LEFT$(p$, K)
IF LEFT$(p$, 10) = "waypoint.2" THEN p$ = LEFT$(p$, K)
IF LEFT$(p$, 10) = "waypoint.3" THEN p$ = LEFT$(p$, K)
IF LEFT$(p$, 10) = "waypoint.4" THEN p$ = LEFT$(p$, K)
IF LEFT$(p$, 10) = "waypoint.5" THEN p$ = LEFT$(p$, K)
IF LEFT$(p$, 10) = "waypoint.3" THEN p4 = INSTR(p$, ",")
IF LEFT$(p$, 10) = "waypoint.3" THEN p$ = "waypoint.3=1," + RIGHT$(p$, (K - p4))
paths$(I) = p$
1900 NEXT I
FOR I = 1 TO gcount
runway = VAL(groups$(I, 2))
FOR J = 1 TO ccount
IF groups$(I, 1) <> "directive=32" THEN 2080
IF runway <> caps(J, 1) THEN 2080
IF caps(J, 2) < mincap THEN 2080
groups$(I, 0) = "available": caps(J, 2) = caps(J, 2) - 1
IF groups$(player, 1) <> "directive=32" AND groups$(player, 1) <> "directive=8" THEN 2080
IF groups$(player, 0) = "available" THEN 2080
IF caps(J, 2) >= mincap THEN groups$(player, 0) = "available": groups$(I, 0) = ""
2080 NEXT J
NEXT I
FOR I = 1 TO (pcount - 7) STEP 8
FOR J = 1 TO gcount
IF groups$(J, 0) <> "available" THEN 3070
IF groups$(J, 2) <> paths$(I) THEN 3070
groups$(J, 0) = "assigned": groups$(J, 1) = "directive=16"
paths$(I) = STR$(J)
3070 NEXT J
NEXT I
G = 0
OPEN "Missionx" FOR INPUT AS #1
OPEN "Missionxx" FOR OUTPUT AS #2
4020 IF EOF(1) THEN 5000
LINE INPUT #1, line$
IF line$ <> "type=air" THEN 4200
PRINT #2, line$
G = G + 1
4030 LINE INPUT #1, line$
IF LEFT$(line$, 10) = "directive=" THEN line$ = groups$(G, 1)
PRINT #2, line$
IF LEFT$(line$, 3) <> "id=" THEN 4030

4050 FOR I = 1 TO (pcount - 7) STEP 8
p = VAL(paths$(I))
IF p <> G THEN 4160
FOR J = 1 TO 7
PRINT #2, paths$(I + J)
LINE INPUT #1, line$
NEXT J
4160 NEXT I
GOTO 4020
4200 PRINT #2, line$
GOTO 4020
5000 CLOSE
KILL "Missionx"
NAME "Missionxx" AS "Missionx"
G = 0: linecount = 0
OPEN "Missionx" FOR INPUT AS #1
OPEN "Missionxx" FOR OUTPUT AS #2
6020 IF EOF(1) THEN 6500
LINE INPUT #1, line$
linecount = linecount + 1
FOR I = 1 TO gcount
x = VAL(groups$(I, 6))
IF linecount <> x THEN 6022
G = G + 1
6022 NEXT I
IF G = 0 THEN 6200
IF LEFT$(line$, 8) <> "payload=" THEN 6025
IF groups$(G, 1) = "directive=32" THEN line$ = "payload=1"
IF groups$(G, 1) = "directive=16" THEN line$ = "payload=1"

6025 IF LEFT$(line$, 14) <> "waypoint.3=512" THEN 6200
IF groups$(G, 1) <> "directive=32" THEN 6200
line$ = "waypoint.3=" + "1" + RIGHT$(line$, (LEN(line$) - 14))
GOTO 6200
6030 IF LEFT$(line$, 9) <> "waypoint." THEN 6200
K = LEN(line$)
line$ = LEFT$(line$, (K - 3)) + "1,1"
IF LEFT$(line$, 10) = "waypoint.6" THEN line$ = LEFT$(line$, (K - 8)) + "0,0,1"
6200 PRINT #2, line$
GOTO 6020
6500 CLOSE
KILL "Missionx"
FOR I = 1 TO gcount
IF groups$(I, 1) = "directive=8" THEN groups$(I, 1) = ": armed recon at: "
IF groups$(I, 1) = "directive=16" THEN groups$(I, 1) = ": escort to: "
IF groups$(I, 1) = "directive=32" THEN groups$(I, 1) = ": combat air patrol at: "
IF groups$(I, 1) = "directive=128" THEN groups$(I, 1) = ": strike at: "
IF groups$(I, 1) = "directive=2048" THEN groups$(I, 1) = ": anti-ship strike at: "
IF I = player THEN groups$(I, 1) = ": YOUR SQUADRON " + groups$(I, 1)
NEXT I
OPEN "Mission.mis" FOR INPUT AS #1
OPEN "Missionxx" FOR INPUT AS #2
OPEN "Missionx" FOR OUTPUT AS #3
6510 IF EOF(1) THEN 6900
IF EOF(2) THEN 6900
LINE INPUT #1, line1$
LINE INPUT #2, line2$
line$ = line2$
IF LEFT$(line1$, 11) = "waypoint.0=" THEN line$ = line1$
PRINT #3, line$
GOTO 6510
6900 CLOSE
KILL "missionxx"
G = 0: linecount = 0
OPEN "Missionx" FOR INPUT AS #1
7000 IF EOF(1) THEN 7900
LINE INPUT #1, line$
linecount = linecount + 1
IF line$ = "type=air" THEN G = G + 1
IF G = 0 THEN 7000

IF LEFT$(line$, 11) <> "waypoint.3=" THEN 7000
x = INSTR(1, line$, "N")
IF x = 0 THEN x = INSTR(1, line$, "S")
y = INSTR(1, line$, "E")
IF y = 0 THEN y = INSTR(1, line$, "W")
p = INSTR(1, line$, "+")
lat$ = MID$(line$, x, ((y - 2) - x))
lon$ = MID$(line$, y, ((p - 2) - y))
groups$(G, 4) = lat$
groups$(G, 5) = lon$
GOTO 7000
7900 CLOSE
PRINT "Some of the fighter squadrons' missions may have been changed."
PRINT "The current mission plan for squadrons at your airfield follows:"
PRINT
FOR I = 1 TO gcount
IF groups$(I, 2) <> groups$(player, 2) THEN 7930
PRINT groups$(I, 7); " "; groups$(I, 1); " "; groups$(I, 4); " "; groups$(I, 5)
7930 NEXT I
PRINT
PRINT "hit ENTER to continue."
INPUT q$
' change player squad payloads
PRINT
PRINT "You can change your squadron's payloads now."
PRINT
PRINT "Enter only the number of the desired payload, as found in the aircraft DP file."
PRINT "Be careful! If you enter something invalid, you will corrupt the mission file."
PRINT
PRINT "If you accidentally corrupt the mission file, go to your 'MISSIONS' folder."
PRINT "Copy 'Mission' from the 'MISSIONS' folder, drop it into your 'CAMPAIGNS' folder,"
PRINT "and run DCGQB again."
PRINT
PRINT "Just keep hitting ENTER at the prompt if you don't want to change your payloads."
PRINT
G = 0: linecount = 0: count = 0
gstart = VAL(groups$(player, 6))
OPEN "Missionx" FOR INPUT AS #1
OPEN "Missionxx" FOR OUTPUT AS #2
8000 IF EOF(1) THEN 8900
LINE INPUT #1, line$
linecount = linecount + 1
IF linecount < gstart THEN 8880
IF LEFT$(line$, 8) <> "payload=" THEN 8880
count = count + 1
IF count = 1 THEN PRINT "player "; line$: GOTO 8010
PRINT "wingman "; count; " "; line$
8010 q$ = ""
INPUT "desired payload (hit ENTER for no change)"; q$
IF q$ = "" THEN 8880
PRINT "you entered "; q$
PRINT "hit ENTER if that is correct, or enter 'n' for 'no' if not"
r$ = ""
INPUT r$
IF r$ <> "" THEN 8010
line$ = LEFT$(line$, 8) + q$
8880 PRINT #2, line$
8890 GOTO 8000
8900 CLOSE
8910 KILL "Mission.mis"
KILL "Missionx"
NAME "Missionxx" AS "Mission.mis"
10000 CLEAR : END
 
Back
Top