TOUR
PRICING
HELP
Stencylpedia
Blocks Guide
Sample Games
Developer Center
FORUMS
CHAT
#MADEINSTENCYL
EDUCATION
SIGN IN
×
Welcome back!
Username or E-mail
Password
(
Forgot?
)
C
OMMUNITY
Home
Issue Tracker
Inbox [0]
New Posts
New Replies
Search
Stencyl Community
→
Stencyl
→
Ask a Question
→
How do I create an If Statement with Lists?
Pages:
1
How do I create an If Statement with Lists?
ozz
Posts: 575
May 18, 2022, 07:50:05 pm
I some behaviors I only wish to trigger when an item on a list is Complete. How can I set up the blocks for this sort of If Statement?
Justin
Posts: 4689
May 19, 2022, 12:44:13 am
Not sure what you mean by an item on a list being complete. Might help to expand on that.
For Live Support
: Join our
discord
server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)
ozz
Posts: 575
May 19, 2022, 05:56:58 am
Yes, sorry about that I'm still having trouble understanding how lists work. I should have said when the 'Text' from a discrete line on a list reads "complete". Included are some IF Statements that already exist in the game. Ideally I'd like to be able to do that with the text from the list.
Justin
Posts: 4689
May 21, 2022, 12:25:49 am
You can use the
[get item # [_index_] from [_list_]]
block to retrieve the value of an item in the list, and then use the
<[_anything_] = [_anything_]>
block to check if that's equal to the word
complete
.
if <[ get item # [ 0 ] from [ my list ] ] = [ complete ]>
, for example.
For Live Support
: Join our
discord
server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)
ozz
Posts: 575
May 25, 2022, 06:18:53 am
Thank you. I tried several veneration on the image included, but it does seem to work. Did I build the block wrong?
Justin
Posts: 4689
May 26, 2022, 02:08:34 am
That looks correct, but it depends on you setting up the list with the correct data in the first place as well.
Try looping over the list and printing each item to make sure the list contents are what you expect.
For Live Support
: Join our
discord
server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)
ozz
Posts: 575
May 28, 2022, 05:23:50 pm
Thanks, I'm not sure it is in the right place. I'm quite new to lists, but I believe the "Complete" is related to a Key and there are some blocks used that come from the 'Maps' tab. Beyond that I don't really understand how to check for 'Keys' or Placement on a list. How can I discover what place "Complete" is in?
svintaj
Posts: 338
May 31, 2022, 05:38:30 am
Not tested but this should work, it's the basic principle.
Pages:
1