# All numbers expression?

Get help using Construct 2

### » Mon Jan 11, 2016 9:10 pm

I'm using "List" as an inventory in my game. I want to make something like "if player has a pistol in his inventory, then quest starts". To make that I'm using "Compare item text at" in my event table, but it asks me for "Index" (where my pistol is based ny number in the list), player can find it in any moment in the game, not specific, so I want to make it read ALL numbers from zero to, for example, 99999, so wherever pistol is placed in a list, an event will occur. I can't find any expression that will read all the numbers. How to make it?
B
6
Posts: 20
Reputation: 266

### » Mon Jan 11, 2016 9:36 pm

Why use the list object for this?
If the quest starts when the pistol is added to the inventory it seems unnescessary..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

### » Tue Jan 12, 2016 3:16 pm

LittleStain wrote:Why use the list object for this?
If the quest starts when the pistol is added to the inventory it seems unnescessary..

I don't know how to use arrays and tutorials about array inventory are too complicated. List is much simplier and it's perfect for text games.
B
6
Posts: 20
Reputation: 266

### » Tue Jan 12, 2016 3:49 pm

If it helps with Arrays, think of them as a room number in a hotel. "room 234" The first number is the floor your on, the second is the wing you are in, and the third is the room. Treat the array as 1 number and it's easier to grasp how it holds a value. Every combination holds it's own value.
If you only use X & Y it gets simpler, you only have floor and room.

(yes you can have more than a single digit in each, but it's a weird hotel.)

LittleStain, I grasp what he means, if you pick up the banana, and you have a pistol in your inventory, the quest starts. Or you enter the forbidden zone, and you have the pistol...

does this work?

> System | For "Search" from 1 to List.ItemCount|
> > List | Item loopindex text is "pistol" (ignore case) | System | Set CurrentQuest to "PistolQuest"
B
252
S
65
G
34
Posts: 907
Reputation: 41,528

### » Tue Jan 12, 2016 4:00 pm

Wow, thanks! I'm gonna try this out in minutes!
B
6
Posts: 20
Reputation: 266

It doesn't work
B
6
Posts: 20
Reputation: 266

### » Tue Jan 12, 2016 7:53 pm

Dombrowski wrote:
It doesn't work

You are only checking item 0

if you check item loopindex it works..

so you should replace the 0 in the list item compare condition with loopindex

I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

### » Wed Jan 13, 2016 4:09 pm

Oh, it actually works! Thanks
B
6
Posts: 20
Reputation: 266