map madness
Moderator: Forum Moderators
map madness
Okay, this should be really simple, but I'm having a lot of trouble making scenarios load maps from a seperate file Everything works fine when I just cut and paste the map into the scenario file. But I'd prefer to have the maps stored seperatly so I can easily change which map a scenario uses.
Problem 1: Dynamic links don't seem to work.
Using the tip in the WML campaign help page, I tried typing this in my campaign file:
#define MY_DATA DATA_NAME
{campaigns/My_Campaign/{DATA_NAME}}
{~campaigns/My_Campaign/{DATA_NAME}}
#enddef
Then, in my scenario file I'd type:
map_data="{MY_DATA/maps/MyMap}"
But it never worked, It just displayed a blank map and said, "you were defeated".
I am required to type:
map_data="{campaigns/My_Campaign/maps/MyMap}"
in order for it to work? Why? I've seen the shortcuts work when loading .cfg files. Is my syntax bad somehow?
Problem 2: Using OS X TextEdit, when saving map files as text, Wesnoth can't read them. I save them as text files, I even tried switching the encomidng to unicode 16 or 8, but it made no difference. The mac scenario editor can read the files however, and the maps that it exports can be read by Wesnoth. So to make a map wesnoth can read I have to build it using the editor, or at least import it into the editor, and then export it as a new file.
(This makes using custom terrains a pain, becuase the I haven't figured out how to make the editor load custom terrain files from user campaigns.)
But in short I can't see a reason why text maps created by TextEdit in OS X 10.2.8 shouldn't be able to be read by Wesnoth. It reads the .cfg text files fine.
I've spent the last hour or two wrestling with the combination of these two problems. If anyone has any ideas about what I'm doing wrong, I'd appreciate it.
Thanks.
Problem 1: Dynamic links don't seem to work.
Using the tip in the WML campaign help page, I tried typing this in my campaign file:
#define MY_DATA DATA_NAME
{campaigns/My_Campaign/{DATA_NAME}}
{~campaigns/My_Campaign/{DATA_NAME}}
#enddef
Then, in my scenario file I'd type:
map_data="{MY_DATA/maps/MyMap}"
But it never worked, It just displayed a blank map and said, "you were defeated".
I am required to type:
map_data="{campaigns/My_Campaign/maps/MyMap}"
in order for it to work? Why? I've seen the shortcuts work when loading .cfg files. Is my syntax bad somehow?
Problem 2: Using OS X TextEdit, when saving map files as text, Wesnoth can't read them. I save them as text files, I even tried switching the encomidng to unicode 16 or 8, but it made no difference. The mac scenario editor can read the files however, and the maps that it exports can be read by Wesnoth. So to make a map wesnoth can read I have to build it using the editor, or at least import it into the editor, and then export it as a new file.
(This makes using custom terrains a pain, becuase the I haven't figured out how to make the editor load custom terrain files from user campaigns.)
But in short I can't see a reason why text maps created by TextEdit in OS X 10.2.8 shouldn't be able to be read by Wesnoth. It reads the .cfg text files fine.
I've spent the last hour or two wrestling with the combination of these two problems. If anyone has any ideas about what I'm doing wrong, I'd appreciate it.
Thanks.
I saw Invisible Philosopher type {MAP filename} to load a map in a scenario file in his wesvoid scenario campaign. So does that mean that this code should work?
#define MAP DATA_NAME
{campaigns/My_Campaign/maps/{DATA_NAME}}
{~campaigns/My_Campaign/maps/{DATA_NAME}}
#enddef
Then, in my scenario file I'd type:
{MAP MyMap}
(I'm not sure how he got the scenaio to realize that this block of text was the map. I guess I must be missing a step)
#define MAP DATA_NAME
{campaigns/My_Campaign/maps/{DATA_NAME}}
{~campaigns/My_Campaign/maps/{DATA_NAME}}
#enddef
Then, in my scenario file I'd type:
{MAP MyMap}
(I'm not sure how he got the scenaio to realize that this block of text was the map. I guess I must be missing a step)
Check and see how I do it in my campaign. I havein Flight_Freedom.cfg, and in each scenario, I have for map 1.
You'll code won't work, because it will interpret the return as a character in the map.
As for maps not loading, it is because TextEdit does not save in regular text, it saves in Rich Text. You have to make a copy of an existing map, edit it, and save it.
Code: Select all
#define MAP NUMBER
map_data="{campaigns/Flight_Freedom/maps/drake{NUMBER}}{~campaigns/Flight_Freedom/maps/drake{NUMBER}}"
#enddef
Code: Select all
{MAP 01}
You'll code won't work, because it will interpret the return as a character in the map.
As for maps not loading, it is because TextEdit does not save in regular text, it saves in Rich Text. You have to make a copy of an existing map, edit it, and save it.
"ILLEGITIMIS NON CARBORUNDUM"
Father of Flight to Freedom
http://www.wesnoth.org/wiki/FlightToFreedom
Father of Flight to Freedom
http://www.wesnoth.org/wiki/FlightToFreedom
Thanks for the code. I'll try it out and see if it makes a difference.MadMax wrote:Check and see how I do it in my campaign. I havein Flight_Freedom.cfg, and in each scenario, I haveCode: Select all
#define MAP NUMBER map_data="{campaigns/Flight_Freedom/maps/drake{NUMBER}}{~campaigns/Flight_Freedom/maps/drake{NUMBER}}" #enddef
for map 1.Code: Select all
{MAP 01}
You'll code won't work, because it will interpret the return as a character in the map.
As for maps not loading, it is because TextEdit does not save in regular text, it saves in Rich Text. You have to make a copy of an existing map, edit it, and save it.
I knew about text edit saving as rich text normally. With all my maps I converted them into normal text files and the saved them. My point was that Wesnoth 0.8.2 could read text .cfg files, but not my map files, and I wasn't sure why.
-
- Posts: 873
- Joined: July 4th, 2004, 9:14 pm
- Location: My imagination
- Contact:
Actually an extra return doesn't seem to matter. This is how I do it:
So {MAP Lichs_Claw} expands to
and then to
(although I'm not sure which extra returns actually exist)
and then to
Code: Select all
#define WESVOID_DATA DATA_NAME
{campaigns/Wesvoid_Campaign/{DATA_NAME}}
{~campaigns/Wesvoid_Campaign/{DATA_NAME}}
#enddef
#define MAP NAME
map_data="{WESVOID_DATA maps/{NAME}}"
#enddef
Code: Select all
map_data="{WESVOID_DATA maps/Lichs_Claw}"
Code: Select all
map_data="
{campaigns/Wesvoid_Campaign/maps/Lichs_Claw}
{~campaigns/Wesvoid_Campaign/maps/Lichs_Claw}
"
and then to
Code: Select all
map_data="
mmmmmmmmmmmcccmmmmmmmmmmm
mmmmmmhhhmmccchhhhmmmmmmm
mmmhhhhhhhhccchhhhhhhhmmm
mhhtCthhhhhccchhhhhtCthhm
mhCCCCChhhhccchhhhCCCCChm
mhtC2CthhggcccgghhtC3Cthm
mhCtCtChgggcccggghCtCtChm
mhhhChhggvgcccvggghhChhhm
mhhhhhhgggccccccvghhhhhhm
mmhhhhhgggccvgccgghhhhhmm
mmhhhhggvcccggcccgghhhhmm
mmmhhhgggcvcgggcccghhhmmm
mmmhhhgggccggggvccvhhhmmm
mmmmhhgggccgggggccccccccc
mmmmhhggcccgggggggccccccc
mmmmmhhgccvggggggghmmmmmm
mmmmmhhvccgggggggghmmmmmm
mmmmmmhcccggggvggghhmmmmm
cccccccccgggggggghhmmmmmm
ccccccchggvgggggghhmmmmmm
mmmmmmhhggggggggvhhhmmmmm
mmmmmmmhhggnnngghhhmmmmmm
mmmmmmhhhggn1ngghmmmmmmmm
mmmmmmmhhgggnggghmmmmmmmm
mmmmmmmmhgvggggghmmmmmmmm
"
Play a Silver Mage in the Wesvoid campaign.
What if it is in the user campaign folder? Then the extra return is up top, and you get an illegal map error.
"ILLEGITIMIS NON CARBORUNDUM"
Father of Flight to Freedom
http://www.wesnoth.org/wiki/FlightToFreedom
Father of Flight to Freedom
http://www.wesnoth.org/wiki/FlightToFreedom
Well to good news is that I tried using the MAP macro to load maps in 0.8.0 and 0.8.1 and it worked in both version. Here's the code I used:
#define MAP DATA_NAME
map_data="{campaigns/Desert_campaign/maps/{DATA_NAME}}"
#enddef
But oddly, when this code is used in 0.8.2, it loads a blank map and says "you have been defeated". I think this is some sort of bug with the mac build.
My continuing problem it is that 0.8.0, 0.8.1 and 0.8.2 won't read my map text files, it will only read the text files that are exported by the mac scenario editor. Yes, i'm saving in regular text, yes the files look exactly the same when I open them, but darned if I know why it doesn't work.
I'm glad that the MAP macro works in older versions, it makes me think it is just a bug in the 0.8.2 OS X build I'm using. Still with all this trouble, I'm starting to think it might be easier just to paste the map in with the scenario, like I used to do.
#define MAP DATA_NAME
map_data="{campaigns/Desert_campaign/maps/{DATA_NAME}}"
#enddef
But oddly, when this code is used in 0.8.2, it loads a blank map and says "you have been defeated". I think this is some sort of bug with the mac build.
My continuing problem it is that 0.8.0, 0.8.1 and 0.8.2 won't read my map text files, it will only read the text files that are exported by the mac scenario editor. Yes, i'm saving in regular text, yes the files look exactly the same when I open them, but darned if I know why it doesn't work.
I'm glad that the MAP macro works in older versions, it makes me think it is just a bug in the 0.8.2 OS X build I'm using. Still with all this trouble, I'm starting to think it might be easier just to paste the map in with the scenario, like I used to do.
-
- Posts: 873
- Joined: July 4th, 2004, 9:14 pm
- Location: My imagination
- Contact:
No I don't that error. I tried changing toMadMax wrote:What if it is in the user campaign folder? Then the extra return is up top, and you get an illegal map error.
Code: Select all
#define WESVOID_DATA DATA_NAME
{~campaigns/Wesvoid_Campaign/{DATA_NAME}}
{campaigns/Wesvoid_Campaign/{DATA_NAME}}
#enddef
and it still worked. Extra returns at the beginning or end of the map_data do not cause a problem. (however that change broke some other things for reasons I don't understand... If anyone actually complains about any problems with putting it in the "user campaign folder", then I'll try to see what's wrong with it. But the map works fine even with that change.)
Try copying the contents of the text file and pasting them into a new text file... that sometimes works for me when things seem randomly broken.quartex wrote:Well to good news is that I tried using the MAP macro to load maps in 0.8.0 and 0.8.1 and it worked in both version. Here's the code I used:
#define MAP DATA_NAME
map_data="{campaigns/Desert_campaign/maps/{DATA_NAME}}"
#enddef
But oddly, when this code is used in 0.8.2, it loads a blank map and says "you have been defeated". I think this is some sort of bug with the mac build.
My continuing problem it is that 0.8.0, 0.8.1 and 0.8.2 won't read my map text files, it will only read the text files that are exported by the mac scenario editor. Yes, i'm saving in regular text, yes the files look exactly the same when I open them, but darned if I know why it doesn't work.
I'm glad that the MAP macro works in older versions, it makes me think it is just a bug in the 0.8.2 OS X build I'm using. Still with all this trouble, I'm starting to think it might be easier just to paste the map in with the scenario, like I used to do.
Play a Silver Mage in the Wesvoid campaign.