Multiple values possible for "becomes equal to" ?

Posted on
Sat Apr 27, 2019 2:53 pm
sumocomputers offline
Posts: 267
Joined: Jun 23, 2008

Multiple values possible for "becomes equal to" ?

Please see screenshots.

I want the value of variable B to change based on the value of variable A.

Variable A can have values of 01-31.

On this particular trigger, I want values of 01, 21, & 31 of Variable A to trigger a change of Variable B to "st".

I am using "becomes equal to:" with commas as separators, but it doesn't seem to be working correctly.

Is what I am trying to do even possible? If so, am I using the incorrect separator?

I know I could make a separate trigger for every possible value between 01-31 or maybe use conditions, but was trying to do less manual work.

2.jpg
2.jpg (254.09 KiB) Viewed 1543 times


1.jpg
1.jpg (241.55 KiB) Viewed 1543 times

Posted on
Sun Apr 28, 2019 4:07 am
DaveL17 offline
User avatar
Posts: 6744
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Multiple values possible for "becomes equal to" ?

I could be wrong, but I don't think Indigo will evaluate based on a list like that (although that would be an awesome feature). I suspect that it will evaluate the list literally--that is, your trigger will only fire when the variable becomes equal to the entire list.

If it were me, I would do the following which still gets you the same behavior with one trigger:

Trigger: variable changes
Condition: if conditions match rules:
any
- variable foo is equal to value 1
- variable foo is equal to value 21
- variable foo is equal to value 31

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Sun Apr 28, 2019 7:49 am
sumocomputers offline
Posts: 267
Joined: Jun 23, 2008

Re: Multiple values possible for "becomes equal to" ?

Thanks for confirming. I used conditions as you suggested, and it works great.

The "th" was a lot of clicking. 120 clicks to be exact, lol.

3.jpg
3.jpg (427.55 KiB) Viewed 1488 times

Posted on
Mon Apr 29, 2019 9:43 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Multiple values possible for "becomes equal to" ?

Or, here's a little Python script snippet I found:

Code: Select all
day = indigo.variables[IDFORDAYNUM].getValue(int)
suffix = ""
if 4 <= day <= 20 or 24 <= day <= 30:
    suffix = "th"
else:
    suffix = ["st", "nd", "rd"][day % 10 - 1]
indigo.variable.updateValue(IDFORSUFFIXVAR, value=suffix


Not tested fully, but it's pretty close. Then you just execute the script for any change to the source variable.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Apr 29, 2019 5:12 pm
sumocomputers offline
Posts: 267
Joined: Jun 23, 2008

Re: Multiple values possible for "becomes equal to" ?

Thanks Jay, I'll give it a go.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 4 guests

cron