my wml questions thread

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
bejacomune
Posts: 11
Joined: February 20th, 2023, 8:38 am

my wml questions thread

Post by bejacomune »

Since I have many questions, I think that one thread will be better that many (specially that my questions come from a newbie).
question 1:
do WFL work like a variable value?

Code: Select all

[event]
	name=side 1 turn refresh
	first_time_only=no
	[if]
		[variable]
			name=Dharkshow
			equals=yes
		[/variable]
		# Dharkshow is a variable that turned to yes after firing an event x
		# turns from show set by storing turns in the event x then storing the value of turns into var turns_from_show 
		[then]
			[switch]
				variable=turn_number
				[case]
					equals=$($turns_from_show + 2)
					[message]
						speaker=Zortheus
						message= _ "The village located west of the lake is the home of a former apprentice of mine. He lives there as an hermit since the end of the war. He might be willing to help us."
					[/message]
					[scroll_to]
						x=5
						y=21
					[/scroll_to]
					[delay]
						time=300
					[/delay]
					[message]
						speaker=Duck
						message= _ "We should send someone to take a look to this keep then."
					[/message]
					[message]
						speaker=Zortheus
						message= _ "I must go myself, he won't allow anyone else to see him."
					[/message]
					[message]
						speaker=Gar
						message= _ "Poor little shy Mage."
					[/message]
				[/case]
				[case]
					equals=$($turns_from_show + 3)
					[allow_recruit]
						type=Imp
						side=5
					[/allow_recruit]
				[/case]
				[case]
					equals=$($turns_from_show + 7)
					[message]
						speaker=Gar
						message= _ "Hold fast soldiers or the Realm will be lost!"
					[/message]
					[message]
						speaker=Duck
						message= _ "All this is the fault of Syran!"
					[/message]
					[message]
						speaker=Thanatos
						message= _ "Your resistance is useless, pathetic creatures. We have conquered countless worlds, and yours will be no exception."
					[/message]
					{MODIFY_TERRAIN Ql (9,10) (11,11)}
					{MODIFY_TERRAIN Uu (5-9) (13-16)}
				[/case]
				[case]
					equals=$($turns_from_show + 9)
					{MODIFY_TERRAIN Ql (13-17) (4-5)}
					{MODIFY_TERRAIN Uu (16-20) (5-7)}
				[/case]		
				[case]
					equals=$($turns_from_show + 11)
					{MODIFY_TERRAIN Ql (11-15) (15-16)}
					{MODIFY_TERRAIN Uu (13-18) (18-19)}
				[/case]	
				[case]		
					equals=$($turns_from_show + 15)
					{MODIFY_TERRAIN Ql (5-9) (20-22)}
					{MODIFY_TERRAIN Uu (1-3) (17-20)}
				[/case]
			[/switch]
		[/then]
		[else]
			{VARIABLE turns_from_show 0}
		[/else]
	[/if]
[/event]
User avatar
Ravana
Forum Moderator
Posts: 3020
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: my wml questions thread

Post by Ravana »

Your [case] does not have value, so they dont do anything. https://wiki.wesnoth.org/ConditionalAct ... Bswitch.5D
bejacomune
Posts: 11
Joined: February 20th, 2023, 8:38 am

Re: my wml questions thread

Post by bejacomune »

Ravana wrote: April 15th, 2023, 6:29 pm Your [case] does not have value, so they dont do anything.
:lol: :lol: :lol: How did I miss that :o
thank u.
but, the other parts (the wfl syntaxe ) are they good?
User avatar
beetlenaut
Developer
Posts: 2827
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: my wml questions thread

Post by beetlenaut »

You also need to put these formulas in quotes so the "+" will add the numbers. (In normal WML, the "+" concatenates two strings.) It should look like: value="$($turns_from_show + 2)".

In the future, you would do better to explain what you want your code to do, and what it's actually doing. That's because, in this case, the answer to your question is "yes".
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
bejacomune
Posts: 11
Joined: February 20th, 2023, 8:38 am

Re: my wml questions thread

Post by bejacomune »

beetlenaut wrote: April 15th, 2023, 6:34 pm You also need to put these formulas in quotes so the "+" will add the numbers. (In normal WML, the "+" concatenates two strings.) It should look like: value="$($turns_from_show + 2)".

In the future, you would do better to explain what you want your code to do, and what it's actually doing. That's because, in this case, the answer to your question is "yes".
Good,
Thank u
bejacomune
Posts: 11
Joined: February 20th, 2023, 8:38 am

Re: my wml questions thread

Post by bejacomune »

question 2
I am trying to run Gui.pyw from bfw1.17
I am using python3.2
I got this error message

Code: Select all

  File "C:\Program Files\Battle for Wesnoth 1.17.5\data\tools\wmlindent", line 64, in <module>

    import sys, os, argparse, filecmp, re, codecs, signal

ImportError: No module named argparse
complete report

Code: Select all

C:\Python31\pythonw.exe "C:\Program Files\Battle for Wesnoth 1.17.5\data\tools\wmllint" "C:\Program Files\Battle for Wesnoth 1.17.5\data\core" C:\Users\aa\Desktop\A_Princes_Tale
  File "C:\Program Files\Battle for Wesnoth 1.17.5\data\tools\wmllint", line 1816

    unit_movetypes.append((unit_id, *movetype))

SyntaxError: can use starred expression only as assignment target
User avatar
Elvish_Hunter
Posts: 1576
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: my wml questions thread

Post by Elvish_Hunter »

Why are you trying to use a version of Python that ancient? Its last release was in 2014 :shock:
You must update both your Wesnoth version (1.17.5 is ten development releases ago, considering that 1.17.15 was tagged today) and your Python version to at least 3.8 (which is the maximum version available on Windows 7), then everything will work correctly.

EDIT: In your reports I see that your version of Python isn't 3.2 as you stated, but 3.1. That's even more ancient, since it last release was in 2012.
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
User avatar
hermestrismi
Posts: 626
Joined: February 6th, 2016, 11:28 pm
Location: Tunisia
Contact:

Re: my wml questions thread

Post by hermestrismi »

Elvish_Hunter wrote: April 16th, 2023, 3:40 pm Why are you trying to use a version of Python that ancient? Its last release was in 2014 :shock:
You must update both your Wesnoth version (1.17.5 is ten development releases ago, considering that 1.17.15 was tagged today) and your Python version to at least 3.8 (which is the maximum version available on Windows 7), then everything will work correctly.

EDIT: In your reports I see that your version of Python isn't 3.2 as you stated, but 3.1. That's even more ancient, since it last release was in 2012.
Thank you. We'll, after years with my windows7, that was the last call before being convinced that it is time to stop updating the os indirectly (kb files ect ect) and migrate to windows 11.
Now, it works although my PC became of course hyper slow (normal since it is 4gb ram)
Post Reply