Adding WML commands

Discussion of all aspects of the game engine, including development of new and existing features.

Moderators: Forum Moderators, Developers

Post Reply
talosds
Posts: 4
Joined: August 24th, 2008, 10:29 pm
Location: Buenos Aires, Argentina

Adding WML commands

Post by talosds »

Hi everybody,

I've recently started writing a mod for BfW and I've found myself stuck in doing so. After getting the source code to compile and playing with it for some time, I decided it was time to start doing what I intended to in the first place: adding new WML commands. However, I'm afraid that I am clueless as to where to find the parser and most of the implementation of the WML commands. Browsing in this forum, the most I got to find is that the WML engine is quite entwined within the game, and that there's a WML parser in the utils/ directory. I've taken a look at the wml.pm Perl module and understand how it works, but I'm clueless as to what do you use it for.

Could somebody out there please lend me a hand? I'm not asking for a step-by-step guide on how to add WML commands, but just a couple of tips and the minimum amount of information so that I can get to do it myself. :) Any help, no matter how small, will be greatly appreciated! :)

Thanks a lot beforhand.

Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Re: Adding WML commands

Post by Dave »

You generally add new WML commands in game_events.cpp. See each of the blocks using the WML_HANDLER_FUNCTION macro. Each of these blocks implements a WML command.

David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming

User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: Adding WML commands

Post by Sapient »

I'm curious what you're planning to add.
The list at wesnoth.org/wiki/FutureWML could give you some ideas maybe.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."

talosds
Posts: 4
Joined: August 24th, 2008, 10:29 pm
Location: Buenos Aires, Argentina

Re: Adding WML commands

Post by talosds »

Thank you very much for your help, Dave! I had certainly overlooked that file. Now I'm back on track again. :D

Sapient, that list you sent me has got some interesting ideas. I think I'm going to try implementing the easier unit modification. But going back to what I'm planning to add, it's basically some new attributes needed for a no-luck mod I'm working on with fosprey (another BfW forum user and a friend of mine) and commands related to it. Our idea is to make this mod "silent" by default, so that it can be activated on demand and doesn't bother BfW users who don't want to use it.

User avatar
Rhishisikk
Posts: 214
Joined: August 12th, 2008, 4:58 pm
Location: As Contract Demands
Contact:

Re: Adding WML commands

Post by Rhishisikk »

Okay, not to be stupid:

In multiplayer mode, how do players know whether the mod is in effect or not? Clearly, either all must use the mod or none. I'm just wondering how to know whether it is in use or not? Will all eras need with_code and without_code versions?
Typhon Rhishisikk

If a man has a talent and cannot use it, he has failed. - Thomas Wolfe
Wesluck (TM): Guaranteed unlike any other luck, anywhere else. - Typhon

Main Projects: ANL: Universal (era), Gambit's Empire Builder

Post Reply