For - function

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
SFault
Posts: 483
Joined: November 10th, 2009, 2:21 pm
Location: Esbo, Finland

For - function

Post by SFault »

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.

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]
Isn't this the same as FOR(i=0; i<5; i++){DO(i)}?
segmentation fault
EBfW, GtR, Art, Old art
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: For - function

Post by zookeeper »

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.
User avatar
SFault
Posts: 483
Joined: November 10th, 2009, 2:21 pm
Location: Esbo, Finland

Re: For - function

Post by SFault »

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.
segmentation fault
EBfW, GtR, Art, Old art
User avatar
Celtic_Minstrel
Developer
Posts: 2166
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: For - function

Post by Celtic_Minstrel »

Hmm, it might not be too hard to support [for] inside [story]... maybe I'll look into implementing this.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
Post Reply