Macro documentation? VARIABLE_OP etc.

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
marvalis
Posts: 40
Joined: August 16th, 2010, 3:56 am

Macro documentation? VARIABLE_OP etc.

Post by marvalis »

I just waisted a lot of time simply trying to figure out how to increment a variable.
Macro's like VARIABLE_OP could perhaps be mentioned on wiki.wesnoth.org/SyntaxWML#Variables

Where can I find documentation about variable_op and other stuff like that? It would make working with wml a bit more intuitive.
JaMiT
Inactive Developer
Posts: 511
Joined: January 22nd, 2012, 12:38 am

Re: Macro documentation? VARIABLE_OP etc.

Post by JaMiT »

marvalis wrote:Where can I find documentation about variable_op and other stuff like that?
Utility macro reference

To find that, start with ReferenceWML and go down to the "Predefined macros" section.
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: Macro documentation? VARIABLE_OP etc.

Post by Sapient »

If you were reading and learning the essentials about WML then I wouldn't say it was time "waisted".

The page actually does mention macros there, but it doesn't go into detail because macros they are a complex subject on their own. Also it is better to learn the normal way first before you learn the macro shortcut -- otherwise you will be using code snippets without really understanding what they do, which can lead to far worse problems.

If you are having trouble finding an answer in the wiki, then please by all means feel free to post the question in here. Perhaps the example of incrementing a variable would be a good one to include on the SyntaxWML page, as you suggested. So thank you for that suggestion. I will keep it in mind the next time I do a revision to that section.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
marvalis
Posts: 40
Joined: August 16th, 2010, 3:56 am

Re: Macro documentation? VARIABLE_OP etc.

Post by marvalis »

Yes, thanks to both of you. I looked at the macro and its code, and I found out the sytax how to add something to a variable. This is the page about variable that I looked over:
http://wiki.wesnoth.org/InternalActions ... ariable.5D

It would be nice if the part on syntax WML about variable could point straight to internalactionsWML variable operation.
Variable operation are usually the first thing you learn in any language (then tables, logic, etc).
JaMiT
Inactive Developer
Posts: 511
Joined: January 22nd, 2012, 12:38 am

Re: Macro documentation? VARIABLE_OP etc.

Post by JaMiT »

marvalis wrote:It would be nice if the part on syntax WML about variable could point straight to internalactionsWML variable operation.
:hmm: The "part on syntax WML about variable" would be this section? But that already does point straight to [set_variable], so did you mean somewhere else? Perhaps it could be made clearer there that "assigning" includes modifying, but the link is already there.
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: Macro documentation? VARIABLE_OP etc.

Post by Sapient »

I think when you click on the word "macro" from SyntaxWML, it should not take you directly to PreprocessorRef but instead to a page with introductory information about commonly used macros in WML programming.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Post Reply