Some 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.
Post Reply
Ethan
Posts: 23
Joined: July 19th, 2006, 7:11 am

Some questions

Post by Ethan »

Hi,
I would need some confirmation/answers.

Is WML case sensitive?
There is no special character to end instruction? What is the behavior with the newline character ?
(EDIT : According to the wiki newline is only mandatory in an assignment of a value to a key and in define macro command for the preprocessor)

How to define a commentary ? ##
"creating" instruction for the prepropressor use #
"using" {}
This would imply that commentaries slow down preprocessor, and that we can't use {} for something else ? Like in a dialog ? (Yes, I know : why would I want to use it ... )
There is a way to use variables, arrays (even if I don't know how now), but can we e.g. add a variable for each unit ? (addition of an attribute to the object...)

Can we use .. in a file path ?

Thanks (that's all for today)
Ringcaat
Posts: 68
Joined: August 21st, 2004, 11:54 am
Location: Minneapolis, Minnesota
Contact:

Related question...

Post by Ringcaat »

I once asked about how to comment out a block of text, and I got a lot of useful suggestions. The most efficient suggestion was to enclose the text I wanted to comment out in braces, as it was very unlikely to be a preprocessor directive. I've done that successfully for a long time, but recently I've begun finding that sometimes code that fails to load will load when I remove a block of code that I've surrounded by braces. Which means that there is some problem with using braces for debugging. Can anyone tell me why that is, and what I might use instead?
This is a young gryphon. She likes cheese. She will steal all your cheese.
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Re: Some questions

Post by toms »

Ethan wrote:Is WML case sensitive?
Yes. everything is written in lower case, except macros, and variable names &values may have upper case letters.
Ethan wrote:How to define a commentary ? ##
"creating" instruction for the prepropressor use #
Comments need a #. After it, the line is ignored. You cannot use long comments (#*...*#)
The preprocessor commands also use this sign: # It uses the keywords define,enddef,undef and ifdef. Do not begin comments with these words and it won't crash.
Ethan wrote: There is a way to use variables, arrays (even if I don't know how now), but can we e.g. add a variable for each unit ? (addition of an attribute to the object...)
If you store multiple units or locations at once, you get an array. You can iterate over it, and/or manipulate the variables. You can give the fifth unit of some stored units exactly 15 hp by using:

Code: Select all

[set_variable]
name=units[5].hitpoints
value=15
[/set_variable]
Ethan wrote:Can we use .. in a file path ?
Not that way. Say, you are in the scenario directory. You want to include a file from the subdirectory 'utils'. Then you use {./utils/some_utils.cfg}.

Read on here: http://www.wesnoth.org/wiki/ReferenceWML
First read, then think. Read again, think again. And then post!
Ethan
Posts: 23
Joined: July 19th, 2006, 7:11 am

Post by Ethan »

ok, thanks.
That is why I am asking. :p
If you don't understand what I want to say, it may be quite normal, just ask me to reformulate. :p And your are welcome to correct my errors. :p
Post Reply