Problem with switch
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.
Problem with switch
Hi,
I have problem witch [switch] [case] Wiki example https://wiki.wesnoth.org/ConditionalAct ... Bswitch.5D
I don't understand why don't work, no error is displayed. It just does not enter [switch], i try more times and debug witch message.
Armor is it, +15 hp it work. When I use message =$temp_rand_value, i see 1 or 2. When i delate switch and case, I give resistance bonuses. Can anyone help?
I have problem witch [switch] [case] Wiki example https://wiki.wesnoth.org/ConditionalAct ... Bswitch.5D
I don't understand why don't work, no error is displayed. It just does not enter [switch], i try more times and debug witch message.
Code: Select all
#define Armor X Y
{VARIABLE ArmorName A}
[item]
x={X}
y={Y}
image=items/armor.png
[/item]
[event]
name=moveto
[filter]
x={X}
y={Y}
[/filter]
{VARIABLE_OP temp_rand_value rand (1,2)}
[object]
image=items/armor.png
silent=yes
[filter]
x={X}
y={Y}
[/filter]
[then]
[unit_overlay]
x={X}
y={Y}
image=overlays/arcane-icon.png
[/unit_overlay]
[remove_item]
x,y={X},{Y}
[/remove_item]
[/then]
[effect]
apply_to=hitpoints
increase=15
increase_total=15
[/effect]
[switch]
variable=$temp_rand_value
[case]
value=1
#ArmorName= _ "Arcane Armor"
[effect]
apply_to=resistance
replace=false
[resistance]
arcane=-5
[/resistance]
[/effect]
[/case]
[case]
value=2
#ArmorName= _ "Pierce Armor"
[effect]
apply_to=resistance
replace=false
[resistance]
pierce=-5
[/resistance]
[/effect]
[/case]
[/switch]
#name=$ArmorName
[/object]
[/event]
#enddef
Re: Problem with switch
[switch] is not subtag of [object].
- Pentarctagon
- Project Manager
- Posts: 5526
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: Problem with switch
I'd assume you'd need to put the [switch] inside of the [then].
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
Re: Problem with switch
But when I put the [switch] inside of the [then] i have error:
<invalid WML found> [effect] not supprted
In game (the game turns on, the error is displayed as it tries to take an artifact)
meaby [effect] it can not be inside [then]
Somewhere I can find information about what tag can be in what tag?
<invalid WML found> [effect] not supprted
In game (the game turns on, the error is displayed as it tries to take an artifact)
meaby [effect] it can not be inside [then]
Somewhere I can find information about what tag can be in what tag?
-
- Posts: 198
- Joined: January 1st, 2016, 4:40 pm
- Location: Hopelessly trapped within the Submachine
Re: Problem with switch
You might have to do some digging around, but this is a good starting point:
https://wiki.wesnoth.org/ActionWML
It says that ConditionalActionsWML (which [switch] is a part of) belongs to ActionWML, and you have a list of cases where it can be used; [object] is not one of them.
https://wiki.wesnoth.org/ActionWML
It says that ConditionalActionsWML (which [switch] is a part of) belongs to ActionWML, and you have a list of cases where it can be used; [object] is not one of them.
Re: Problem with switch
Inside [case] goes ActionWML, and [effect] is not part of ActionWML. Possible solutions for your use are:
[insert_tag],
[lua],
multiple [object]s.
I suggest last one.
[insert_tag],
[lua],
multiple [object]s.
I suggest last one.
Re: Problem with switch
Ok, thx.
Making a few objects will be the most easy.
[topic can close]
Making a few objects will be the most easy.
[topic can close]