Sudipta's WML questions

The place to post your WML questions and answers.

Moderator: Forum Moderators

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
Sudipta
Posts: 217
Joined: June 10th, 2015, 6:37 pm
Location: Meditating under a waterfall, Heartfangs, Wesnoth

Sudipta's WML questions

Post by Sudipta »

Hello. I'm creating a new campaign and am currently working on the first scenario.
I wanna start off with a small problem.
When trying to start my campaign i keep getting a " the game map could not be loaded: Unknown tile in map: (CmeZ) 'CmeZ; " error after selecting difficulty and the scenario doesn't start. I had installed the UMC_Terrain_Pack and fiddled around with it in the map editor but i don't think i used it in the map design. I've gone over the map several times and replaced every tile which i thought might not be from the default map editor, but the scenario still doesn't start.
Any advice would be helpful. :)

edit: it's definitely from the UMC_Terrain_Pack because after removing this add-on i cant even load the map in the map editor . the same error message appears.
It is the mark of an educated mind to be able to entertain a thought without accepting it.
Playing Wesnoth since 2010, still there is so much left to play
User avatar
Ravana
Forum Moderator
Posts: 2949
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Sudipta's WML questions

Post by Ravana »

You could replace CmeZ with some other terrain then.
User avatar
Sudipta
Posts: 217
Joined: June 10th, 2015, 6:37 pm
Location: Meditating under a waterfall, Heartfangs, Wesnoth

Re: Sudipta's WML questions

Post by Sudipta »

But i have no idea what CmeZ is... how can i replace it if i dont even recognize/know it?

Is there any way to find specific map tiles in the map? like some kind of search function i can use to locate this CmeZ thing
It is the mark of an educated mind to be able to entertain a thought without accepting it.
Playing Wesnoth since 2010, still there is so much left to play
User avatar
Ravana
Forum Moderator
Posts: 2949
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Sudipta's WML questions

Post by Ravana »

You can open map with text editor and use replace all.
User avatar
Xara
Posts: 270
Joined: December 26th, 2014, 12:23 am
Location: Beijing

Re: Sudipta's WML questions

Post by Xara »

You need to load UMC Terrain Pack in your _main.cfg
It pronounces Sha'ha, not Zara.

Feedback Thread of my Add-ons
User avatar
Sudipta
Posts: 217
Joined: June 10th, 2015, 6:37 pm
Location: Meditating under a waterfall, Heartfangs, Wesnoth

Re: Sudipta's WML questions

Post by Sudipta »

yeah using the editor worked. turns out i used a lot of tiles from the addon(desert hills, tundra, troll encampments) but didnt realize it. Anyway i removed all those tiles cause i don't want any dependencies for the campaign right now

Moving on the next problem. I can't make either the LIMIT_RECRUITS or LIMIT_CONTEMPORANEOUS_RECRUITS work. i copied the code from S1 of Eastern invasion and studied the side-utils macro file but cant figure what i'm doing wrong :(

This is the error that comes up when i try to start the campaign
Spoiler:
my code is

Code: Select all

#ifdef HARD
		{LIMIT_RECRUITS 3 Naga Warrior 2}
	#endif
where the naga enemies are Side 3 and i want them to only be able to recruit 2 naga warriors on hard.On easy and normal they can't recruit naga warriors.
It is the mark of an educated mind to be able to entertain a thought without accepting it.
Playing Wesnoth since 2010, still there is so much left to play
User avatar
Xara
Posts: 270
Joined: December 26th, 2014, 12:23 am
Location: Beijing

Re: Sudipta's WML questions

Post by Xara »

Naga Warrior would be interpreted as two parameters unless you use () or "" to glue the two words together.
It pronounces Sha'ha, not Zara.

Feedback Thread of my Add-ons
enclave
Posts: 936
Joined: December 15th, 2007, 8:52 am

Re: Sudipta's WML questions

Post by enclave »

Sudipta wrote: June 4th, 2018, 8:44 pm {LIMIT_RECRUITS 3 Naga Warrior 2}
This:
{LIMIT_RECRUITS 3 "Naga Warrior" 2}
Or this:
{LIMIT_RECRUITS 3 (Naga Warrior) 2}
will work...

Macro expects 3 variables, but thinks that you give it 4, because it treats Naga separate from Warrior.. If you use quotes or brackets then it thinks that it is 1 variable. Using quotes " seems to be preferable, because sometimes if I use brackets it may cut spaces, but only in messages like [message] ... so instead of for example lord save us all it may output message lordsaveusall in certain scenarios... possibly if I need to use + symbols or something... not sure really. But there is such a problem sometimes, never seen any serious or even minor errors though. So using brackets () is perfectly fine, just keep in mind that if you see any problems described above, change to quotes..
User avatar
Sudipta
Posts: 217
Joined: June 10th, 2015, 6:37 pm
Location: Meditating under a waterfall, Heartfangs, Wesnoth

Re: Sudipta's WML questions

Post by Sudipta »

Thanks both of you. Moving on, this next one is not a WML question strictly speaking..

I want to set a tight turn limit in my scenario, and while playtesting it i ran out of turns. How do i add some extra turns within the game(by using debug mode, not by editing .cfg file) ?

Example- I set initial turn limit at 20. i tried using "set_var <turn=30>" in debug mode while playing. The white notification text shows up saying the set_var was used during debug mode, but at the end of turn 20 i still get a game over.
It is the mark of an educated mind to be able to entertain a thought without accepting it.
Playing Wesnoth since 2010, still there is so much left to play
User avatar
Ravana
Forum Moderator
Posts: 2949
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Sudipta's WML questions

Post by Ravana »

You can use these, -1 is no limit.

lua wesnoth.game_config.last_turn=-1
lua wesnoth.game_config.last_turn=30
User avatar
Sudipta
Posts: 217
Joined: June 10th, 2015, 6:37 pm
Location: Meditating under a waterfall, Heartfangs, Wesnoth

Re: Sudipta's WML questions

Post by Sudipta »

Thanks a lot for the quick reply Ravana. I really appreciate it :-)

I need to learn the lua stuff soon. I've been using WML mainly but seems like Lua brings some interesting stuff to the table.
It is the mark of an educated mind to be able to entertain a thought without accepting it.
Playing Wesnoth since 2010, still there is so much left to play
Shiki
Developer
Posts: 348
Joined: July 13th, 2015, 9:53 pm
Location: Germany

Re: Sudipta's WML questions

Post by Shiki »

You can also use debug mode, there are commands for it:
:turn xxx and :turn_limit xxx
https://wiki.wesnoth.org/COMMANDMODE

While I'm not sure, it may be that the commands posted by ravana work from the lua console (available after activating mode with some shortcut, I think `)
Try out the dark board theme.
enclave
Posts: 936
Joined: December 15th, 2007, 8:52 am

Re: Sudipta's WML questions

Post by enclave »

Sudipta wrote: June 13th, 2018, 4:40 pm I need to learn the lua stuff soon. I've been using WML mainly but seems like Lua brings some interesting stuff to the table.
Not everything in the world has to be done through lua...
https://wiki.wesnoth.org/InternalAction ... e_turns.5D
https://wiki.wesnoth.org/DirectActionsW ... y_turns.5D
Just create a menu with set_menu_item:

Code: Select all

[set_menu_item]
		id=aaa_make_game_longer
		description=_"<b>Add 5 turns to turn limit</b>"
		image="attacks/trident.png~SCALE(22,22)"
		[show_if]
[variable]
name=development_in_process
boolean_equals=true
[/variable]
[/show_if]
[command]
[modify_turns]
add=5
[/modify_turns]
[/command]
[/set_menu_item]
and add options to your add-on https://wiki.wesnoth.org/OptionWML like:

Code: Select all

[/multiplayer]
...
	[checkbox]
		id=development_in_process
		default=false
		name=_"Enable this if you want to use development menu"
		description=_"For Developers use only"
	[/checkbox]
...
[/multiplayer]
But yeah... if you want to do it in debug mode then what can I say ;) learn lua... I guess..
Sorry if I wasn't helpful, but maybe It could help somebody else when they find it :D

Alternatively you could write in debug mode command line: lua wesnoth.fire("modify_turns", { add=5 }) :D as a long version of mix of wml and lua :D should work..
User avatar
Sudipta
Posts: 217
Joined: June 10th, 2015, 6:37 pm
Location: Meditating under a waterfall, Heartfangs, Wesnoth

Re: Sudipta's WML questions

Post by Sudipta »

Shiki wrote: June 13th, 2018, 7:05 pm You can also use debug mode, there are commands for it:
:turn xxx and :turn_limit xxx
https://wiki.wesnoth.org/COMMANDMODE

While I'm not sure, it may be that the commands posted by ravana work from the lua console (available after activating mode with some shortcut, I think `)
Uhh, i used the commands u provided but both of them set turn number or turn limit number to 1 regardless of what value i put in it. :?

for example i use turn [8] in debug mode but it sets turn number to 1. using turn_limit [50] sets turn limit to 1.

@enclave thanks for the alternate method but i find ravana's lua suggestions simpler. I'm just starting out so set_menu_item stuff goes over my head for now ;)
It is the mark of an educated mind to be able to entertain a thought without accepting it.
Playing Wesnoth since 2010, still there is so much left to play
User avatar
Ravana
Forum Moderator
Posts: 2949
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Sudipta's WML questions

Post by Ravana »

Those are used without []. In documentation [] means optional.
Post Reply