For - function
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.
For - function
I'm using 1.13.8 so FOR should be supported. I got the code below but the it doesn't run the DO-part at all. The idea is to go through the array "counties" one by one (from 0 to 5) and place images. I'm not sure if the $i is correct reference but it doesn't matter since nothing inside DO-tags is executed.
Isn't this the same as FOR(i=0; i<5; i++){DO(i)}?
Code: Select all
[for]
variable=i
start=0
end=5
step=1
[do]
[image]
x,y=$counties[$i].iconX,$counties[$i].iconY
file=misc/$counties[$i].label|.png
centered=yes
[/image]
[image]
x,y=$counties[$i].iconX,$counties[$i].iconY
file=misc/border.png~RC(magenta>$counties[$i].owner|_color)
centered=yes
[/image]
[/do]
[/for]
Re: For - function
You must be talking about StoryWML, but you didn't say that. Nor did you say what makes you think [for] should work in that context.
Re: For - function
Right, I'm using it in [story]. I always forget that things work only on certain context. Back to drawing board. Thanks.
edit: My problem was solved with [insert_tag] and making the tag inside [event] where [for] can be used. Code is presented here.
edit: My problem was solved with [insert_tag] and making the tag inside [event] where [for] can be used. Code is presented here.
- Celtic_Minstrel
- Developer
- Posts: 2222
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: For - function
Hmm, it might not be too hard to support
[for]
inside [story]
... maybe I'll look into implementing this.