WML questions: invalid wml

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
battlestar
Posts: 690
Joined: January 1st, 2007, 7:12 am

Re: Question: halo and item images, undo ai?

Post by battlestar »

Thanks.

For 3, I'm looking for a way to prevent ai from moving to certain locations but only temporarily.
LUA: Llama Under Apprenticeship
Hell faction: completed
mattsc
Inactive Developer
Posts: 1217
Joined: October 13th, 2010, 6:14 pm

Re: Question: halo and item images, undo ai?

Post by mattsc »

battlestar wrote:For 3, I'm looking for a way to prevent ai from moving to certain locations but only temporarily.
See Customizing AI in Wesnoth 1.8 [modify_ai] tag

Code: Select all

[modify_ai]
    side=2  # or whatever side
    action=try_delete
    path=aspect[avoid].facet[*]
[/modify_ai]
User avatar
battlestar
Posts: 690
Joined: January 1st, 2007, 7:12 am

Re: Question: halo and item images, undo ai?

Post by battlestar »

Thanks,

I think I get what it's saying, but what's an example of "{OLURFS_LAND}" when the wiki's talking about facets?
LUA: Llama Under Apprenticeship
Hell faction: completed
mattsc
Inactive Developer
Posts: 1217
Joined: October 13th, 2010, 6:14 pm

Re: Question: halo and item images, undo ai?

Post by mattsc »

battlestar wrote:I think I get what it's saying, but what's an example of "{OLURFS_LAND}" when the wiki's talking about facets?
That's just a set of coordinates defined in scenario Hostile Mountains of mainline campaign Legend of Wesmere:

Code: Select all

#define OLURFS_LAND
    x=20-24,19-30,17-30,16-30,14-30,12-30,11-30,10-30,7-30,8-30,10-30,13-30,15-30,18-30,19-30,20-30,22-30,23-30,24-30,23-30,22-30
    y=10,11,12,13-15,16-17,18-19,20,21,22,23,24,25,26,27,28-29,30,31-32 ,33-36,37,38-39,40
#enddef
I'll replace that on the wiki page right away so that it is clearer.

EDIT: You do not have to set the [avoid] content as described on that wiki page though. You can simply use the standard method in the side definition (or in [modify_side]), e.g.:

Code: Select all

[ai]
    [avoid]
        x=1-10
        y=5-8
    [/avoid]
[/ai]
Deletion will still work as shown in my previous post.
User avatar
battlestar
Posts: 690
Joined: January 1st, 2007, 7:12 am

Re: Question: halo and item images, undo ai?

Post by battlestar »

@ Mattsc: Thanks!

Nother question:
1.
Are the following values accessible by WML in single-player?
- recruits, recruit golds, recalls, advancements, losses, losses golds, kills, kills golds, dmg inflicted and dmg taken
(img borrowed from another thread)
Image




2. Does anyone have any ideas about this?
Just made a small sprite, Image as a wall decoration: Image

Turns out that segment of the wall is divided by three hexes. Any ideas on how to place the decoration on the wall at the intended place?
LUA: Llama Under Apprenticeship
Hell faction: completed
User avatar
Crendgrim
Moderator Emeritus
Posts: 1328
Joined: October 15th, 2010, 10:39 am
Location: Germany

Re: Question: halo and item images, undo ai?

Post by Crendgrim »

Regarding your first question, I don't know if there is a better way to achieve this, but you could count those things by yourself by using recruit, recall, advancement, kill, .. events and increasing variables for each of them.
UMC Story Images — Story images for your campaign!
User avatar
battlestar
Posts: 690
Joined: January 1st, 2007, 7:12 am

Re: Question: halo and item images, undo ai?

Post by battlestar »

1. Thanks, functionally that would do it. In case someone knows the variable names, it is still worth learning :)

2. Question remains

3. Is there a way to make the time of day (ie. First watch, dawn) random?


Thanks
LUA: Llama Under Apprenticeship
Hell faction: completed
User avatar
Alarantalara
Art Contributor
Posts: 789
Joined: April 23rd, 2010, 8:17 pm
Location: Canada

Re: Question: halo and item images, undo ai?

Post by Alarantalara »

For 2, there are a few ways.
If you use halo in item with a really big transparent image you can force things where you want. It wastes space, but works.
The terrain_graphics tag can be used for fine control over where things are placed. You could either use a macro similar to the camp fire one to place it at specific coordinates, or define a terrain so you can paint it with the map.

For 3, the various starting times each have their own macro for convenience in mainline.
Generate a random number and then use it to select a schedule. Use replace_schedule to set the desired schedule. You can use this to set a random schedule at the scenario start or change the time at random every turn, since I'm not sure which you intend.
User avatar
battlestar
Posts: 690
Joined: January 1st, 2007, 7:12 am

Re: Question: halo and item images, undo ai?

Post by battlestar »

Thanks for your reply.

2.
- I'm hoping to learn how to use terrain_graphics tag for this, but after reading the wiki page on it, I still have no idea how to apply it in this situation...
- Considered using halo, the image would be in front of any unit close enough to the wall. Curious why it would waste space, can't two halo images co-exist on the same tile?
- Also considered defining a terrain, but then there'd have to be a different terrain for each of the many wall-decorations. Saving this option as a last resort.

3. Changing time at random every turn is what I intended to ask, thanks. :)
LUA: Llama Under Apprenticeship
Hell faction: completed
mattsc
Inactive Developer
Posts: 1217
Joined: October 13th, 2010, 6:14 pm

Re: Question: halo and item images, undo ai?

Post by mattsc »

mattsc wrote:
battlestar wrote:For 3, I'm looking for a way to prevent ai from moving to certain locations but only temporarily.
See Customizing AI in Wesnoth 1.8 [modify_ai] tag

Code: Select all

[modify_ai]
    side=2  # or whatever side
    action=try_delete
    path=aspect[avoid].facet[*]
[/modify_ai]
battlestar: I am in the process of updating AiWML with some of these things (not quite there yet, but working on it) and, in the process, am running a few more tests. While doing that, I noticed that [avoid] tags are not cumulative (nor are any of the other AI parameters). Rather, the latest tag you set up overrides all previous ones (as long as they apply to the same turns and times of day). So, you could also just override your old [avoid] setting with

Code: Select all

[modify_side]
    side=2 # or whatever
    [ai]
        [avoid]
            [not]
            [/not]
        [/avoid]
    [/ai]
[/modify_side]
if you think that is easier or more intuitive. (Internally for the AI engine this is not quite the same, but the effect in the scenario is.)
User avatar
battlestar
Posts: 690
Joined: January 1st, 2007, 7:12 am

Re: Question: halo and item images, undo ai?

Post by battlestar »

That indeed makes the code easier to read. Thanks!

When in the help menu, the game crashes completely when attempt is made to view the demon race information. Help appreciated.

Code: Select all

[race]
	id=Demon
	name=Demon
	plural_name="Demons"
	male_name="Demon"
	female_name="She-Devil"
	description="..."					  male_names="Aamon,Agares,Alastor,Amon,Asura,Balam,Barbatos,Bathin,Buer,Caim,Cimejes,Crocell,Demogorgon,Dmitryus,Eleksha,Fleuretty,Foras,Gremory,Gusion,Halphas,Ipos,Kasdaye,Labal,Kulak,Leraje,Marax,Marbas,Marchosias,Malphas,Mathim,Moloch,Murmur,Naberus,Naphula,Orobas,
Oriax,Oray,Phenex,Pithius,Purson,Pruflas,Ramu,Ronove,Sallos,Seere,Scox,Shaitan,Shax,Sitri,Stolas,Surgat,Tartaruchi,Temeluchus,Vacca,Valefar,Vassago,Vepar,Verrine,Volac,Vual,Xitragupten,Xaphan,Zaebos,Zapar,Zemeu,Zizo"
	female_names="Aul,Ainne,Annatwa,Aeda,Anthrace,Bosie,Bodna,Bonnie,Berjanas,Bierllie,Curuise,Clarai,Dorsephine,Eko,Emxxy,Estrogae,Fanora,Flutter,Graxy,Jessx,Jexxie,Kissie,Kmelia,Kaura,Luxxy,Lovyair,Nitsuj,Nerai,Rebeib,Sweetums,Snoogiesweetiepoo,Testanny,Bokie,Jokie,Lekie,
Mikie,Kikie,Fikie,Sapie,Lepie,Supie,Grukie,Pinla,Pinda,Pinsar,Pinpi"
	ignore_global_traits=yes
	num_traits=1
	{TRAIT_QUICK}
	{TRAIT_INTELLIGENT}
	{TRAIT_RESILIENT}
	{TRAIT_STRONG}
[/race]
I suspect this is the relevant code above.
LUA: Llama Under Apprenticeship
Hell faction: completed
User avatar
battlestar
Posts: 690
Joined: January 1st, 2007, 7:12 am

Re: Question: halo and item images, undo ai?

Post by battlestar »

Can anyone think of any cause for the bug above?

New question:
Trying to insert 30 variables into [unit][variables] with a loop, and my variable naming is wrong but I have no knowledge of what's the correct way to do this.

Code: Select all

	{FOREACH 30 i}
		[modify_unit]
			[filter]
				id={ID}
			[/filter]
			[variables]
				item_slot[$i].name="Empty"
			[/variables]
		[/modify_unit]
	{NEXT i}
Thanks.
LUA: Llama Under Apprenticeship
Hell faction: completed
Ceres
Forum Regular
Posts: 620
Joined: September 18th, 2010, 7:56 pm
Location: Germany

Re: Question: halo and item images, undo ai?

Post by Ceres »

About the new question: well, WML has a [while] loop. If you'd like to have a macro, there's REPEAT.
REPEAT's loop variable is called REPEAT_i and it's starting with 0.
User avatar
battlestar
Posts: 690
Joined: January 1st, 2007, 7:12 am

Re: Question: halo and item images, undo ai?

Post by battlestar »

Thanks, and there's still the problem with "item_slot[$i].name" not being a valid variable name... in this context, it seems. It's given me error messages that stated that both "[" and "$" are unexpected characters in this setting.
LUA: Llama Under Apprenticeship
Hell faction: completed
Ceres
Forum Regular
Posts: 620
Joined: September 18th, 2010, 7:56 pm
Location: Germany

Re: Question: halo and item images, undo ai?

Post by Ceres »

Maybe that's a technical limitation of [modify_unit]. Have you tried to store, modify stored_unit.variables.item_slot[$i].name and unstore?
Post Reply