Reading and writing system files with wesnoth

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.
Post Reply
Smok
Posts: 53
Joined: June 14th, 2016, 11:52 am

Reading and writing system files with wesnoth

Post by Smok »

Is it possible in WML or Lua to make something like ingame WML files editor? I want to make editor that allows to edit/genearte customized addon template. I konw its better to do it in java for example, but then i need to do reverse enginering and rewite WML parser in java, and update it every time game is updated.
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: Reading and writing system files with wesnoth

Post by gfgtdf »

You coudl output wml by persitence wml, that is [set_global_varaible] and then copy that wml to the file that you want with an editor.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
Smok
Posts: 53
Joined: June 14th, 2016, 11:52 am

Re: Reading and writing system files with wesnoth

Post by Smok »

If only it was possible from java program to order wesnoth to run specyfic script and to reload some data after it was changed (use it just as backgroud WML parser), your solution could work, but if user have to manage working on 2 programs at once it will miss a point. I want to make editor for low/medium expirienced users. It is supposed to be as simple as possible.
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: Reading and writing system files with wesnoth

Post by Sapient »

If only it was possible from java program to order wesnoth to run specyfic script
Yes, it is possible. You can build a scenario config file (as input), then use a Java Process to run wesnoth in a nogui mode (search forum for "nogui" to see examples), then wait for it to complete, then load the persisted WML variable (output) into your java program. However, this seems like a very convoluted way of doing things.

If you wanted to use Python, you could make use of wmlparser2.py in data/tools/python/.

Or, you could take a look at the other efforts that have been done in the past and try to update and improve them ( Wesnoth User Made Content IDE ).
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Smok
Posts: 53
Joined: June 14th, 2016, 11:52 am

Re: Reading and writing system files with wesnoth

Post by Smok »

Thanks Sapient. This was informations i needed. I will try to make something like UMC IDE in python. I wonder if there is documentation for wmlparser3.py.
Post Reply