[set_variables] not doing anything for me
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.
[set_variables] not doing anything for me
I'm trying to use [insert_tag] to create a spell menu that adjusts as the game goes on, but [set_variables] isn't working for me AT ALL. Here's a little code I used to test it before I committed to anything. I can't find what I did wrong.
EDIT: Still having problems. If it helps, I used inspect and nothing showed up, nothing was adjusted.
Code: Select all
[set_variables]
name=$side_number|.spells.option
mode=append
[value]
[message]
message={MENU_IMG_TXT "attacks/fireball.png" "Fireball"}
[/message]
[command]
[message]
speaker=narrator
side_for=$side_number
message= _ "This spell inflicts 10 damage to target unit."
[/message]
[/command]
[/value]
[/set_variables]
I'm just... a guy...
I'm back for now, I might get started on some work again.
I'm back for now, I might get started on some work again.
Re: [set_variables] not doing anything for me
Where did you get that code? Is there an example where something like that works? It looks nothing like what's in the wiki, to me at least...
Maybe you should post more of your code.
Maybe you should post more of your code.
BfW 1.12 supported, but active development only for BfW 1.13/1.14: Bad Moon Rising | Trinity | Archaic Era |
| Abandoned: Tales of the Setting Sun
GitHub link for these projects
| Abandoned: Tales of the Setting Sun
GitHub link for these projects
Re: [set_variables] not doing anything for me
Nevermind, I found the problem. I just needed message=, instead of putting it in brackets.
Code from wiki.wesnoth.org/InternalActionsWML
EDIT: Nevermind, STILL not working.
Code from wiki.wesnoth.org/InternalActionsWML
EDIT: Nevermind, STILL not working.
I'm just... a guy...
I'm back for now, I might get started on some work again.
I'm back for now, I might get started on some work again.
Re: [set_variables] not doing anything for me
[message] & [command] inside [set_variables]? I don't think that's in the wiki. Maybe you want to be using [message]->[command] from a [fire_event]?
BfW 1.12 supported, but active development only for BfW 1.13/1.14: Bad Moon Rising | Trinity | Archaic Era |
| Abandoned: Tales of the Setting Sun
GitHub link for these projects
| Abandoned: Tales of the Setting Sun
GitHub link for these projects
Re: [set_variables] not doing anything for me
I've done tag manipulation like that before, I'm just confused why it isn't working in this instance. It works when I remove the variable substitution (replace $side_number with a defined side, like 1), but problem is, I need the variable substitution.doofus-01 wrote:[message] & [command] inside [set_variables]? I don't think that's in the wiki. Maybe you want to be using [message]->[command] from a [fire_event]?
EDIT: FOUND THE PROBLEM. THE EVENT THAT SETS THE VARIABLE BASED ON $side_number IS A PRESTART EVENT. God, I feel stupid now.
I'm just... a guy...
I'm back for now, I might get started on some work again.
I'm back for now, I might get started on some work again.
Re: [set_variables] not doing anything for me
Good you got it working. I don't think I helped, but cheers anyway.
For anyone reading this who is confused: it doesn't make any sense to me either.
For anyone reading this who is confused: it doesn't make any sense to me either.
BfW 1.12 supported, but active development only for BfW 1.13/1.14: Bad Moon Rising | Trinity | Archaic Era |
| Abandoned: Tales of the Setting Sun
GitHub link for these projects
| Abandoned: Tales of the Setting Sun
GitHub link for these projects
- Pentarctagon
- Project Manager
- Posts: 5564
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: [set_variables] not doing anything for me
You can store code in the [set_variables] tag. For example, one way I've done it is:doofus-01 wrote:Good you got it working. I don't think I helped, but cheers anyway.
For anyone reading this who is confused: it doesn't make any sense to me either.
Code: Select all
[set_variables]
name=varname
[value]
message="my message"
[command]
...stuff to do...
[/command]
[/value]
[/set_variables]
Code: Select all
[insert_tag]
name=option
variable=varname
[/insert_tag]
Code: Select all
{VARIABLE varname.message "new message"}
The [insert_tag] tag also wraps the [option] tag (or whatever tag you used) around every index. So you can also append more options into the array as varname[1], varname[2], etc. and the [insert_tag] would create an option for each index.
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
- Elvish_Hunter
- Posts: 1575
- Joined: September 4th, 2009, 2:39 pm
- Location: Lintanir Forest...
Re: [set_variables] not doing anything for me
I think that the probem is in this line:A Guy wrote:I can't find what I did wrong.
Code: Select all
name=$side_number|.spells.option
Code: Select all
name=side_$side_number|.spells.option
Code: Select all
-- this Lua code works fine
wesnoth.set_variable(3,"test")
A Guy wrote:EDIT: FOUND THE PROBLEM. THE EVENT THAT SETS THE VARIABLE BASED ON $side_number IS A PRESTART EVENT. God, I feel stupid now.
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)
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
Re: [set_variables] not doing anything for me
WML variables can.Elvish_Hunter wrote:and this doesn't work because variable names cannot start with a number
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm.