How Do Code?

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.
Post Reply
genduke
Posts: 2
Joined: March 8th, 2019, 12:18 am

How Do Code?

Post by genduke » March 11th, 2019, 11:47 pm

Where do you access the interface to add event triggers and such? I dont know how to do that, but I'm trying to help set up a scenario and I dont know where to start.

gfgtdf
Developer
Posts: 1202
Joined: February 10th, 2013, 2:25 pm

Re: How Do Code?

Post by gfgtdf » March 12th, 2019, 12:18 am

There is no interface for adding events, you do all of that with a normal text editor by editing the .cfg files of your scenario. The wiki should contain information about that https://wiki.wesnoth.org/BuildingScenarios is the colses i coudl find with a quick look in the wiki for a writing scenarios intro. Its probalby a little outdated though.
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.

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

Re: How Do Code?

Post by Pentarctagon » March 12th, 2019, 12:44 am

To add to that, you should probably use one of these editors. You can also check out this page on the wiki.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code

genduke
Posts: 2
Joined: March 8th, 2019, 12:18 am

Re: How Do Code?

Post by genduke » March 12th, 2019, 1:25 am

The wiki uses a lot of terminology that I'm unfamiliar with. It seems to assume I know anything at all about coding, which I dont. How do I read the file? I can view it but it is arcane to me. And what are tags, and how are they applied?

User avatar
josteph
Developer
Posts: 740
Joined: August 19th, 2017, 6:58 pm

Re: How Do Code?

Post by josteph » March 12th, 2019, 2:44 am

This is a tag:

https://github.com/wesnoth/wesnoth/blob ... fg#L31-L34

I suggest that you start by adding a "hello world" message to the campaign An Orcish Incursion. Try and get the orc leader to say "Hello world" at the start of blue's third turn, for example.

edit: You'd do that by adding [event] and [message] tags later in the scenario file. Thanks Pentarctagon for pointing out that I should have clarified this.

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

Re: How Do Code?

Post by Pentarctagon » March 12th, 2019, 4:29 am

genduke wrote:
March 12th, 2019, 1:25 am
The wiki uses a lot of terminology that I'm unfamiliar with. It seems to assume I know anything at all about coding, which I dont. How do I read the file? I can view it but it is arcane to me. And what are tags, and how are they applied?
"view" and "read" are the same thing - you open the file in the text editor, which allows you to make changes to it. Tags are, for the sake of simplicity, how you tell Wesnoth to do something(there is also lua, but that's something to tackle later).

As a more specific example of what josteph mentioned, if you place this code inside the file he linked:

Code: Select all

[event]
  name=start
  [message]
    message="testing123"
  [/message]
[/event]
The [event] name=start part tells Wesnoth to do whatever is between the [event] and [/event] tags at the start of a scenario. [message] message="testing123" then tells it to display a message to the user that has the text "testing123".
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code

gnombat
Posts: 244
Joined: June 10th, 2010, 8:49 pm
Contact:

Re: How Do Code?

Post by gnombat » March 12th, 2019, 12:26 pm

I don't know if you've seen it or not, but there is a tutorial designed for beginners:

https://wiki.wesnoth.org/WML_for_Complete_Beginners

This will explain things like what a "tag" is, etc.

Post Reply