tekelili advanced WML questions
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.
Re: tekelili WML noob questions
untested, but might work: {VARIABLE_OP ($Victory+"_victory") add 1}
Re: tekelili WML noob questions
No, the preprocessor will concatenate those two strings before variable interpolation occurs.Max wrote:untested, but might work: {VARIABLE_OP ($Victory+"_victory") add 1}
Instead you should use operator |, like so:
Code: Select all
[set_variable]
name="$Victory|_victory"
add=1
[/set_variable]
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Re: tekelili WML noob questions
I am getting this error message:
"<invalid WML found> possible deprecated [or] syntax: now forcing reinterpretation"
Code looks work ok anyway, and I didnt found in WML guide nothing to understand why I get this error.
"<invalid WML found> possible deprecated [or] syntax: now forcing reinterpretation"
Code looks work ok anyway, and I didnt found in WML guide nothing to understand why I get this error.
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
World Conquest II
Re: tekelili WML noob questions
just a guess - might be caused by this years old change:
Code: Select all
Date: 15:37:18, Samstag, 14. Juli 2007
Message:
* the syntax for logical OR-filters is now "cond1[or]cond2[/or]"
instead of "[or]cond1[/or][or]cond2[/or]"
-
- Posts: 876
- Joined: November 28th, 2008, 6:18 pm
Re: tekelili WML noob questions
In past I decided whether to use fire_event or insert_tag for a recursion, and I felt insert_tag was better (and maybe also more powerfull, but I forgot why )tekelili wrote:I need a function (done with an event or anything else can work for it) to operate over an array (that I include as parameter when calling function). And I need can call recursively that function from inside itself. But as macros can not be called recursively,and {CALL_FUNTION} doesnt look accept arrays as parameter, I dont manage to imagine how do it. Can events be used for this in some way?
edit: the link has been replaced: more here, download the file and search for 'process_region_list_code'
I work on Conquest Minus • I use DFoolWide, Retro Terrain Package and the add-on 'High Contrast Water'
I moved to Nosebane's corner (Doc Paterson's signature); I am spending my time there, so PM me if I don't answer your post in forums
I moved to Nosebane's corner (Doc Paterson's signature); I am spending my time there, so PM me if I don't answer your post in forums
Re: tekelili WML noob questions
I am unexperienced with pango. I used it once sucesfully in a message for 1.9, but I am now trying use it for a label on 1.8 and I am not able. Do pango works for labels?
In case answer is yes: what exactly I must write to change this label so $faction is writen in white?
In case answer is yes: what exactly I must write to change this label
Code: Select all
{SET_LABEL 1 1 "FACTION: $faction"}
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
World Conquest II
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: tekelili WML noob questions
This here just worked for me
wml_actions.label({ x = 15, y = 5, text = "<span foreground='blue'>blah</span>" })
So what you need is (untested)
{SET_LABEL 1 1 "FACTION: <span foreground='blue'>$faction|</span>"}
I dunno about variable substitution+pango though, perhaps they interfere.
EDIT
Of course you use the word white instead of blue.
wml_actions.label({ x = 15, y = 5, text = "<span foreground='blue'>blah</span>" })
So what you need is (untested)
{SET_LABEL 1 1 "FACTION: <span foreground='blue'>$faction|</span>"}
I dunno about variable substitution+pango though, perhaps they interfere.
EDIT
Of course you use the word white instead of blue.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Re: tekelili WML noob questions
I still dont get pango working, so I guess variable substitution is problemAnonymissimus wrote: I dunno about variable substitution+pango though, perhaps they interfere.
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
World Conquest II
-
- Posts: 876
- Joined: November 28th, 2008, 6:18 pm
Re: tekelili WML noob questions
In my code Variable substitution doesn't interfere with pango.
<b>something</b>
works with labels, and <b>
should be a pango code (http://forums.wesnoth.org/viewtopic.php ... 74#p471974). So I think this should work:
Code: Select all
{SET_LABEL 1 1 "FACTION: <span color='#FFFFFF'>$faction</span>"}
The reason is: WML with insert_tag is a more powerful than WML without insert_tag.SlowThinker wrote:In past I decided whether to use fire_event or insert_tag for a recursion, and I felt insert_tag was better (and maybe also more powerfull, but I forgot why )
I work on Conquest Minus • I use DFoolWide, Retro Terrain Package and the add-on 'High Contrast Water'
I moved to Nosebane's corner (Doc Paterson's signature); I am spending my time there, so PM me if I don't answer your post in forums
I moved to Nosebane's corner (Doc Paterson's signature); I am spending my time there, so PM me if I don't answer your post in forums
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: tekelili WML noob questions
You never know...SlowThinker wrote:Variable substitution doesn't interfere with pango.
I could imagine that pango could get applied first and afterwards the string gets variable-substituted. So the nicely colored variable name gets replaced by its uncolored value.
EDIT
Checked the source; variables in the text= attribute value are substituted upon constructing a label as you say.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Re: tekelili WML noob questions
Sorry guys for keep bothering with this, but SlowThinker code neither works for me, I still get the pango code diplayed on map as if it where a string value
EDIT: Just for if it were important, I remember I am using BfW 1.8.5
EDIT: Just for if it were important, I remember I am using BfW 1.8.5
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
World Conquest II
-
- Posts: 876
- Joined: November 28th, 2008, 6:18 pm
Re: tekelili WML noob questions
Anonymissimus: Also from my experience the following code works as expected (edit: but not with labels):
Also I can't imagine the logic of applying the pango first: how would we apply a variable substitution to a formated text? I can imagine the variable substitution is applied to a code only.
*****************************************
Edit:
I just ran a test with my 1.8.5, and pango with <span> doesn't work with labels:
Line 1, line 2 don't work, line 3 works:
(So <b> is not a pango code maybe ...)
Code: Select all
<span color='$color_action'>$faction</span>
*****************************************
Edit:
I just ran a test with my 1.8.5, and pango with <span> doesn't work with labels:
Line 1, line 2 don't work, line 3 works:
Code: Select all
{SET_LABEL 1 1 ("<span size='small'>$Scn_tot_gold Gold</span> $Scn_tot_villas Villas")}
{SET_LABEL 1 1 ("<span size='small'>Total bonuses and villas</span>")}
{SET_LABEL 1 1 ("<b>Total bonuses and villas</b>")}
I work on Conquest Minus • I use DFoolWide, Retro Terrain Package and the add-on 'High Contrast Water'
I moved to Nosebane's corner (Doc Paterson's signature); I am spending my time there, so PM me if I don't answer your post in forums
I moved to Nosebane's corner (Doc Paterson's signature); I am spending my time there, so PM me if I don't answer your post in forums
Re: tekelili WML noob questions
I guess this must be easy, but didnt manage to find out it:
¿Can default set_menu_item like "set label" and "next unit" be removed? if yes, how?
EDIT: As side nte to previous issue, if pango is some day enabled for labels, would be nice if also worked for description in set_menu_item. Or at least add a color variable.
¿Can default set_menu_item like "set label" and "next unit" be removed? if yes, how?
EDIT: As side nte to previous issue, if pango is some day enabled for labels, would be nice if also worked for description in set_menu_item. Or at least add a color variable.
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
World Conquest II
Re: tekelili WML noob questions
Notekelili wrote:I guess this must be easy, but didnt manage to find out it:
¿Can default set_menu_item like "set label" and "next unit" be removed?
Possibly... you should put in a feature request.tekelili wrote: EDIT: As side nte to previous issue, if pango is some day enabled for labels, would be nice if also worked for description in set_menu_item. Or at least add a color variable.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
-
- Posts: 876
- Joined: November 28th, 2008, 6:18 pm
Re: tekelili WML noob questions
Concerning set_menu_item:
- "=" inside the description works like a <TAB>. For example
Code: Select all
description="Unboard=unreversible!"
- items within the menu are ordered by id=
I work on Conquest Minus • I use DFoolWide, Retro Terrain Package and the add-on 'High Contrast Water'
I moved to Nosebane's corner (Doc Paterson's signature); I am spending my time there, so PM me if I don't answer your post in forums
I moved to Nosebane's corner (Doc Paterson's signature); I am spending my time there, so PM me if I don't answer your post in forums