For - function

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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

Postby SFault » October 11th, 2017, 1:26 pm

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
My campaign, My art, My old art
User avatar
SFault
 
Posts: 454
Joined: November 10th, 2009, 2:21 pm
Location: Esbo, Finland

Re: For - function

Postby zookeeper » October 11th, 2017, 1:35 pm

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
zookeeper
WML Wizard
 
Posts: 9603
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: For - function

Postby SFault » October 11th, 2017, 1:45 pm

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
My campaign, My art, My old art
User avatar
SFault
 
Posts: 454
Joined: November 10th, 2009, 2:21 pm
Location: Esbo, Finland


Return to WML Workshop

Who is online

Users browsing this forum: No registered users and 1 guest