Removing Random Level Generation Labels

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
User avatar
mintleaf
Posts: 37
Joined: October 23rd, 2012, 10:49 am

Removing Random Level Generation Labels

Post by mintleaf » October 23rd, 2012, 10:59 am

They just annoy me! I have no clue how to program in Lua but I've been reverse engineering the files a bit. I had to edit the english.cfg to remove the names, but when that happened, labels just turned into error notes. I made them empty strings instead, but the labels still exist, they are just invisible.

I want a way to remove those labels so I can name towns, forests and roads myself, in random maps!

Can anybody help me?

User avatar
Elvish_Hunter
Forum Moderator
Posts: 1394
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: Removing Random Level Generation Labels

Post by Elvish_Hunter » October 23rd, 2012, 12:43 pm

Even when using Lua, when placing a label you'll still end up calling wesnoth.wml_actions.label, that is equivalent to the WML tag [label]. So, since this is more a WML question (and especially WML answer) rather than a Lua question, I moved the topic to the WML Workshop.
About removing labels: our wiki says this:
immutable: whether this label is protected from being removed or changed by players. Default yes.
So, I'm pretty sure that you can't remove those labels (per default, they're immutable and we don't have a [remove_label] tag), unless you attempt to modify the map generator (http://wiki.wesnoth.org/MapGeneratorWML).
Current maintainer of these add-ons:
1.14: The Sojournings of Grog, A Rough Life, The White Troll (co-author), Wesnoth Lua Pack
1.12: Children of Dragons

User avatar
mintleaf
Posts: 37
Joined: October 23rd, 2012, 10:49 am

Re: Removing Random Level Generation Labels

Post by mintleaf » October 23rd, 2012, 2:53 pm

Ah, sorry. This just proves my ineptness. Thank you for both the moving of the thread, and the tips. I will report my progress. Thanks again!

EDIT: If you look at the WML Random Map Generator .cfg, there is apparently nothing on labelling. It seems hardcoded. Only the town names are listed, but the suffixes/prefixes are set even though I remove the small label portion in the .cfg.

User avatar
Pentarctagon
Forum Administrator
Posts: 4053
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Removing Random Level Generation Labels

Post by Pentarctagon » October 23rd, 2012, 3:53 pm

Would it allow you to do a FOREACH loop on all the map hexes and set the label to an empty string?
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code

Ceres
Forum Regular
Posts: 620
Joined: September 18th, 2010, 7:56 pm
Location: Germany

Re: Removing Random Level Generation Labels

Post by Ceres » October 23rd, 2012, 4:13 pm

Pentarctagon wrote:Would it allow you to do a FOREACH loop on all the map hexes and set the label to an empty string?
Tried it, nope.

Is there any specific reason for those labels to be immutable? IMO it would make much more sense if they weren't.

User avatar
Crendgrim
Moderator Emeritus
Posts: 1328
Joined: October 15th, 2010, 10:39 am
Location: Germany

Re: Removing Random Level Generation Labels

Post by Crendgrim » October 23rd, 2012, 5:50 pm

Maybe it is enough to edit out the [naming] and [village_naming] tags from the random scenarios (or, if that fails, their content)? I have not tried it, but it seems to be the easiest solution if it works.
UMC Story Images — Story images for your campaign!

Ceres
Forum Regular
Posts: 620
Joined: September 18th, 2010, 7:56 pm
Location: Germany

Re: Removing Random Level Generation Labels

Post by Ceres » October 23rd, 2012, 6:04 pm

I tried that too, but it only removes the random name parts. You have still things like " 's Forest" or "ham" left.

User avatar
Crendgrim
Moderator Emeritus
Posts: 1328
Joined: October 15th, 2010, 10:39 am
Location: Germany

Re: Removing Random Level Generation Labels

Post by Crendgrim » October 23rd, 2012, 6:25 pm

That, again, sounds like a bug or at least a possible FR to me. Imagine you would want to use the generator for a generic scenario, without any of those labels. :hmm:
UMC Story Images — Story images for your campaign!

Anonymissimus
Inactive Developer
Posts: 2458
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: Removing Random Level Generation Labels

Post by Anonymissimus » October 24th, 2012, 12:27 am

Ceres wrote:
Pentarctagon wrote:Would it allow you to do a FOREACH loop on all the map hexes and set the label to an empty string?
Tried it, nope.
Sounds like a bug. The immutable setting is to prevent players from modifying it, but wml/lua should always be able to do it. (Thus one could write some functionality for it using [set_menu_item].)

The underground random map maps in HttT and SoF don't have labels, so there should be some way/reason (unless it's the fact that those are underground... :roll: )

EDIT
I made a quick check using the interactive :lua debug command, and could remove one of the labels that way, so the FOREACH... should work, something else was wrong I suppose.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign

User avatar
ancestral
Developer
Posts: 1108
Joined: August 1st, 2006, 5:29 am
Location: Motion City

Re: Removing Random Level Generation Labels

Post by ancestral » October 24th, 2012, 3:16 am

I personally hate the placename labels and the fact that it’s not optional on random-generated maps.

Yuck yuck yuck yuck. Did not ask for that.
Wesnoth BestiaryPREVIEW IT HERE )
Unit tree and stat browser
CanvasPREVIEW IT HERE )
Exp. map viewer

User avatar
mintleaf
Posts: 37
Joined: October 23rd, 2012, 10:49 am

Re: Removing Random Level Generation Labels

Post by mintleaf » October 24th, 2012, 10:21 am

Yes, exactly. I've analyzed the WML Random Level Generator and it seems hard coded too. Almost as if they went through extra lengths to keep those labels there. Doesn't that suck?

Haha, anyway, I hope somebody comes up with a solution.

Max
Posts: 1449
Joined: April 13th, 2008, 12:41 am

Re: Removing Random Level Generation Labels

Post by Max » October 24th, 2012, 11:15 am

mintleaf wrote:Yes, exactly. I've analyzed the WML Random Level Generator and it seems hard coded too.
it is:

here's the file that's placing those labels:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/mapgen.cpp
mintleaf wrote:Almost as if they went through extra lengths to keep those labels there. Doesn't that suck?
it creates labels, sets x/y and text=. immutable isn't set and the default happens to be yes.

User avatar
mintleaf
Posts: 37
Joined: October 23rd, 2012, 10:49 am

Re: Removing Random Level Generation Labels

Post by mintleaf » October 24th, 2012, 3:28 pm

Max wrote:
mintleaf wrote:Yes, exactly. I've analyzed the WML Random Level Generator and it seems hard coded too.
it is:

here's the file that's placing those labels:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/mapgen.cpp
mintleaf wrote:Almost as if they went through extra lengths to keep those labels there. Doesn't that suck?
it creates labels, sets x/y and text=. immutable isn't set and the default happens to be yes.
Mmmm, that's some really adept snooping. Could you kindly explain to me how to disable those commands without ruining the integrity of the program? I'm not quite sure what to take apart here.

Max
Posts: 1449
Joined: April 13th, 2008, 12:41 am

Re: Removing Random Level Generation Labels

Post by Max » October 24th, 2012, 4:56 pm

wrong link, sorry...
http://svn.gna.org/viewcvs/wesnoth/trun ... dialog.cpp

adding label["immutable"] = "no"; should be enough...

User avatar
mintleaf
Posts: 37
Joined: October 23rd, 2012, 10:49 am

Re: Removing Random Level Generation Labels

Post by mintleaf » October 24th, 2012, 5:07 pm

Sorry to take your time even more, but I'd need a quick tutorial on how to do that. Is that inside the Wesnoth exe? I can't find that file in any of the directories. How do I go about editing this? Once again, sorry!

Post Reply