tekelili advanced WML 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
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: tekelili WML noob questions

Post by Dugi »

Overlays aren't shown when viewing the recall list, this inconvenience was bugging me for long.

The appearance of units on the map can be changed by assigning it different animations (via [object]) for standing, moving and selected (and maybe also for other things), but not for those on the recall list. In this case, I suppose that ImagePathFunctionWML will still work (add it via [object] -> [effect] -> apply_to=image_mod, see the wiki for details), so you can use blank-hex.png as ~MASK to erase the unit's image and then use ~BLIT to paste the image of another unit over it (this might have to be removed after recalling the unit and returned to all units that might be recalled).
User avatar
pyrophorus
Posts: 533
Joined: December 1st, 2010, 12:54 pm

Re: tekelili WML noob questions

Post by pyrophorus »

Excuse me but, [variation] don't work for you ?
I'm pretty sure the modifications appear even in the recall list.
Friendly,
User avatar
tekelili
Posts: 1039
Joined: August 19th, 2009, 9:28 pm

Re: tekelili WML noob questions

Post by tekelili »

pyrophorus wrote:Excuse me but, [variation] don't work for you ?
I'm pretty sure the modifications appear even in the recall list.
Friendly,
I am confussed, isnt [variation] a subtag from [unit_type]? And wiki says [variation] dont accept [variation] subtags, wouldnt do this impossible display walking corpses overlayed? Sorry if I am wrong, trying to learn :hmm:
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
User avatar
pyrophorus
Posts: 533
Joined: December 1st, 2010, 12:54 pm

Re: tekelili WML noob questions

Post by pyrophorus »

It would be creating variations of your unit (in the unit_type) holding its different pictures. Switching between variations on real units would make them show accordingly, even in the recall list.
HTH
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: tekelili WML noob questions

Post by Dugi »

Variation is not a good solution. It is worse than another unit_type, in fact. Every saved unit contains all its possible variations, an entirely new unit_type creates instances of units that are much shorter (because of this, Walking Corpses and Soulless can easily occupy most of the size of save files if you use plague too much). I am not sure if tekelili wasn't trying to give them appearance according to variables, but that can't be done via variations.
User avatar
tekelili
Posts: 1039
Joined: August 19th, 2009, 9:28 pm

Re: tekelili WML noob questions

Post by tekelili »

Dugi wrote:And tekelili, maybe you could rename your topic, these are no longer noob questions (when you made a developer err in his post).
Done :)
From now I had only succes with effect, apply_to=image_mod (other ways could fail due to my unskill or just didnt tried them because I had some kind of doubt). However this was a "meh" succes, as overlay was shown only in the side image of recall menu, and not over the unit image directly inside recall list. It showed also some slow perfomance and an almost error (I had to click over "empty variable value image from debug").

Edit
I feel explain my problem in detail can help:
In my campaign units get a trait "trained" that can vary a lot in its effect. To help players to keep track of most powerfull trained units, I let them add an is_special overlay. As traits effects are not displayed in recall menu, here becomes even more usefull have an is_special overlay to point important units. I am adding "!!" to units names as temporal solution, something like this

Code: Select all

    {FOREACH iotd_recall_store i}
            [if]
                [variable]
                    name=iotd_recall_store[$i|].overlays
                    contains="is_special.png"
                [/variable]
            [then]
                {VARIABLE iotd_recall_store[$i|].name "$iotd_recall_store[$i|].name !!"}
            [/then]
        [unstore_unit]
            variable=iotd_recall_store[$i]
            x,y=recall
        [/unstore_unit]
    {NEXT i}
    {CLEAR_VARIABLE iotd_recall_store}
I asked about walking corpses because I never used [unit_type] and was worried about exceptions (as may also be female variations). I tried define a copy of all default unit_type with different image, using a loop and insert_tag, just to realize I cant use unit_type tag inside an event :augh:

EDIT: Units overlays are shown in recall menu in versiosn 1.11, I rather wont complicate anymore my life with this issue in 1.10 ;)
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
User avatar
tekelili
Posts: 1039
Joined: August 19th, 2009, 9:28 pm

Re: tekelili advanced WML questions

Post by tekelili »

I want to change all hex in a map with terrain Xu to random value among "Uu","Uh","Uu^Uf".
As I dont dominate syntax, I wonder if this can be done with a single terrain tag :hmm:
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
User avatar
Adamant14
Posts: 968
Joined: April 24th, 2010, 1:14 pm

Re: tekelili advanced WML questions

Post by Adamant14 »

tekelili wrote:I want to change all hex in a map with terrain Xu to random value among "Uu","Uh","Uu^Uf".
As I dont dominate syntax, I wonder if this can be done with a single terrain tag :hmm:
Untested:

Code: Select all

				[store_locations]
					terrain=Xu
					variable=terrain_to_change
				[/store_locations]

				{FOREACH terrain_to_change i}
					{RANDOM (Uu, Uu, Uu, Uh, Uu^Uf)}   # you can add here more than one terrain-code to change the hit possibility
					[terrain]
						x=$terrain_to_change[$i].x
						y=$terrain_to_change[$i].y
						terrain=$random
					[/terrain]
				{NEXT i}

				{CLEAR_VARIABLE terrain_to_change}
Last edited by Adamant14 on January 1st, 2014, 10:06 pm, edited 2 times in total.
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR
User avatar
tekelili
Posts: 1039
Joined: August 19th, 2009, 9:28 pm

Re: tekelili advanced WML questions

Post by tekelili »

Ty Adamant14. I just writed RANDOM inside loop and worked :)
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
User avatar
Adamant14
Posts: 968
Joined: April 24th, 2010, 1:14 pm

Re: tekelili advanced WML questions

Post by Adamant14 »

Yes you are right, the random must be inside the loop.
Sorry for that. :)

I edited my post above.
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR
User avatar
tekelili
Posts: 1039
Joined: August 19th, 2009, 9:28 pm

Re: tekelili advanced WML questions

Post by tekelili »

I have tried to learn from other add ons how to declare scenarios for 1.11 but I was unable. What should I change from this 1.10 code to work on 1.11?

_main.cfg

Code: Select all

#ifdef MULTIPLAYER
	[binary_path]
		path=data/add-ons/World_Conquest_tek
	[/binary_path]
	{~add-ons/World_Conquest_tek/WC_tek_Era/_main.cfg}
	{~add-ons/World_Conquest_tek/utils}
	{~add-ons/World_Conquest_tek/scenarios}
#endif
/scenarios/Wc_tek_Start.cfg

Code: Select all

[multiplayer]
    id=World_Conquest_tek
    name= _ "3p WC tek"
    map_generation=default
    description=_"A randomly generated cooperative multiplayer campaign for 1-3 players. It has 5 scenarios and 5 level of difficulties."
    
[generator]
    {WORLD_CONQUEST_TEK_GENERATOR 35 20 5 8000 3 4 2}
[scenario]
    id=World_Conquest_tek_Start
    name= _ "World Conquest tek"
    next_scenario=WC_tek_Island2
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
User avatar
trewe
Translator
Posts: 122
Joined: December 24th, 2012, 5:37 pm
Location: Portugal
Contact:

Re: tekelili advanced WML questions

Post by trewe »

tekelili wrote:I have tried to learn from other add ons how to declare scenarios for 1.11 but I was unable. What should I change from this 1.10 code to work on 1.11?
Nothing.


Unless you want it to be recognized as a campaign, in which case your _main.cfg becomes something like the following:

Code: Select all

[campaign]
    id=mp_campaign_World_Conquest_tek
    name= _ "World Conquest"
    abbrev= _ "WC"
    define=MP_CAMPAIGN_WC_tek
    difficulties=EASY,NORMAL,HARD,NIGHTMARE
    first_scenario=World_Conquest_tek
    description= _ "A randomly generated cooperative multiplayer campaign for 1-3 players. It has 5 scenarios and 5 level of difficulties."

    type=mp
    min_players=1
    max_players=3
[/campaign]

#ifdef MP_CAMPAIGN_WC_tek
   [binary_path]
      path=data/add-ons/World_Conquest_tek
   [/binary_path]
   {~add-ons/World_Conquest_tek/WC_tek_Era/_main.cfg}
   {~add-ons/World_Conquest_tek/utils}
   {~add-ons/World_Conquest_tek/scenarios}
#endif
A warning, if you plan to use a campaign with random maps to not define any roads, as it will crash the game. (set the attribute roads to zero in the generators).

In general, the syntax follows standard campaign wml.
User avatar
tekelili
Posts: 1039
Joined: August 19th, 2009, 9:28 pm

Re: tekelili advanced WML questions

Post by tekelili »

When a player uses recall option, he can select any unit in his recall list. When he picks his option, if he has less than 20 gold then he gets a message that informs recall cant be done... but is storaged player´s option in any variable at that moment, that I can acces from wml?

Edit: I am starting to realiaze that answer to my question is probably "no"... so side questions: can I detect from wml every time players open the recall menu? can I fire from wml the recall menu?
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: tekelili advanced WML questions

Post by Dugi »

can I detect from wml every time players open the recall menu?
Not if he hits cancel or lacks gold to recall.
can I fire from wml the recall menu?
No, the only way to do it needs a complex workaround, so complex that it's better not to do it unless the reason for it is really serious.
User avatar
tekelili
Posts: 1039
Joined: August 19th, 2009, 9:28 pm

Re: tekelili advanced WML questions

Post by tekelili »

Thanks Dugi (and also to other answers, thanks guys for help).

A very simple doubt about pango: I want convert "Resistances" into "resistances" using pango, it is possible?
I tried

Code: Select all

"<span variant='smallcaps'>"+_ "Resistances"+"</span>"
but doesnt look do anything.

Edit: if no possible with pango, anyway to convert a string to lower case would help me.
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
Post Reply