I have a problem inserting my multiline code.
I'll try to make a short brief about what I want:
I'm trying to make random missions to a game called Dangerous Waters (DW to abreviate), a naval warfare simulation. It's a great game but lacks of a dynamic campaign and a good random mission generator.
I has, however, a very good mission editor and the missions are in simple text, so it can be read by notepad.
So what I'm trying to do is making a good random mission generator by creating a bunch of different situations in the DW editor, then copying all of them to my game-editor program and it will give out a mission generated choosing between the ones I selected and randomizing the weather conditions. (That's why I asked for creating a .txt file and, even better, game-editor can create directly a .mu file, the mission ones on DW).
My first problem is, as I said above, the multiline. Porting a very simple mission to game-editor is already long... porting a bit more complex mission will be
terrible So, please, any tip about how to do this would be very apreciated.
My second problem is when trying to randomize weather.
This is my code (well, is more Bee-Ant's):
- Code: Select all
FILE *f=fopen("00base.mu","w");
fprintf(f,"VERSION 3"
"OWNALLIANCE 0"
"DIFFICULTY 1"
"TOTALNUMSIDES 1"
"NUMDRIVEABLES 1"
"MONTH 1"
"WORLDGRID 2"
"LATLONG 54.071823 -11.025635"
";"
"SEASTATE %i\n",seastate
"MDR 0 0 0"
"BOTTOMTYPE %i\n",bottomtype
"TIMEOFDAY %i\n",timeofday
"WEATHER %i\n",weather
"CLOUDHEIGHT %i\n",clouds
"SSP %i\n",ssp
""
""
"ENTITY 2342 SUBENTITY"
"HULLID 1"
"ALLIANCE 1"
"POS 305928.125000 597045.187500 -70"
"POINTS 750"
"COURSE 0"
"SPEED 5"
"PROB 100"
"DRIVEABLE 1"
"UNIQUENAME "SSN""
"COMMSINTERVAL 0.000000"
"TACTIC RANDOMBOX"
"BOX 266453.875000 638493.187500 345402.343750 555597.250000"
"AIRLOADOUT 244"
"AIRCRAFT 1722 1 Alert5 0 : Alert15 1 : 0 Alert30 0 : "
"END");
fclose(f);
This is a mission with just one submarine (the player). No other objects, no missions... figure out how hard would be to add quotes to all lines on a normal mission...
My problem is that, when I press ok I got this error: "Error line 13: expected )"
line 13 is the bottomtype one.
the seastate, bottomtype, weather... variables are been defined before and are like:
- Code: Select all
seastate=rand(5);
bottomtype=rand(3);
and so on...
I switched some lines and the problem is after the first random event so in not line 13 the problem, but where the second random event is).
What can it be?
I hope to have been clear enough, I'm not English.
Thank you very much.
EDIT:
If I change the quotes for \
- Code: Select all
FILE *f=fopen("00base.mu","w");
fprintf(f,"VERSION 3" \
OWNALLIANCE 0\
DIFFICULTY 1\
TOTALNUMSIDES 1\
NUMDRIVEABLES 1\
MONTH 1\
WORLDGRID 2\
LATLONG 54.071823 -11.025635\
;"\
SEASTATE %i\n,seastate \
MDR 0 0 0\
BOTTOMTYPE %i\n,bottomtype \
TIMEOFDAY %i\n,timeofday \
WEATHER %i\n,weather \
CLOUDHEIGHT %i\n,clouds \
SSP %i\n,ssp \
\
\
ENTITY 2342 SUBENTITY \
HULLID 1 \
ALLIANCE 1 \
POS 305928.125000 597045.187500 -70 \
POINTS 750 \
COURSE 0 \
SPEED 5\
PROB 100\
DRIVEABLE 1\
UNIQUENAME "SSN" \
COMMSINTERVAL 0.000000\
TACTIC RANDOMBOX\
BOX 266453.875000 638493.187500 345402.343750 555597.250000\
AIRLOADOUT 244\
AIRCRAFT 1722 1 Alert5 0 : Alert15 1 : 0 Alert30 0 : \
END");
fclose(f);
I gives me no more the first error, but
Error line 35: Expected )
Error line 35: Expected ;
But line 35 already has );
Also, the line
UNIQUENAME "SSN"
, has this format on the mission files, each platform has its name and comes quoted, can this be a problem?
I'm pretty lost, as you can see..