+ Reply to Thread
Results 1 to 4 of 4

Thread: name+variable in expression?

  1. #1
    Wire Noob ThePearl's Avatar
    Join Date
    Oct 2007
    Posts
    18

    Default name+variable in expression?

    Hi there!

    I'm trying to create a check that checks with name+number. Let's say I've got a 4x5 pixel setup, and every pixel is named Pixel1 Pixel2 etc. up to Pixel20.

    Now what I want to do is I want Pixel1 to glow, and when you hit the right button I want Pixel+1 to start glowing, with other words, Pixel2, and when I hit it again I want Pixel+1 (Pixel3) to start glowing, etc. Is this possible? In some programming languages I know that you could do like.. pixel+"1" or "pixel+1" but I don't know how to do it in expression?

    Oh, and E1 or E2 doesn't matter. Help would be appreciated!

  2. #2
    Expressionism 2.0 Syranide's Avatar
    Join Date
    Mar 2007
    Location
    Sweden
    Posts
    4,573

    Default Re: name+variable in expression?

    Quote Originally Posted by ThePearl View Post
    Hi there!

    I'm trying to create a check that checks with name+number. Let's say I've got a 4x5 pixel setup, and every pixel is named Pixel1 Pixel2 etc. up to Pixel20.

    Now what I want to do is I want Pixel1 to glow, and when you hit the right button I want Pixel+1 to start glowing, with other words, Pixel2, and when I hit it again I want Pixel+1 (Pixel3) to start glowing, etc. Is this possible? In some programming languages I know that you could do like.. pixel+"1" or "pixel+1" but I don't know how to do it in expression?

    Oh, and E1 or E2 doesn't matter. Help would be appreciated!
    It certainly is possible, but I'm not sure how to best approach the idea.
    The "problem" is that there is really no way of avoiding having 20 outputs, one for each light.

    There is no possibility of dynamically addressing outputs in E2 (or E1).

    But here you have a starting point, unless I did something wrong, this will start out black, and, when when you press the button connected to Right, it will go "black > P1 > P2 > P3 > P4 > black" (one step for each press).

    Code:
    @inputs  Right
    @outputs Pixel1 Pixel2 Pixel3 Pixel4
    @persist Pos
    if(~Right & Right) { Pos++ }
     
    Pixel1 = (Pos == 1)
    Pixel2 = (Pos == 2)
    Pixel3 = (Pos == 3)
    Pixel4 = (Pos == 4)
    Not perfect, not complete, but it's a starting point.
    Not sure how much help you want or exactly what you are trying to achieve.
    Just ask if you need more help.

    (That code was E2 btw)

  3. #3
    Wire Noob ThePearl's Avatar
    Join Date
    Oct 2007
    Posts
    18

    Default Re: name+variable in expression?

    Oh yeah! Simple and smart! I didn't think of that... You can have a cookie! But you'll have to Google it yourself because I can't be asked and the one included in the forum doesn't look like a cookie, now does it? :huh:

  4. #4
    Lifetime Supporter shadowkeeper's Avatar
    Join Date
    Jul 2007
    Location
    Heffen, Belgium
    Posts
    478

    Default Re: name+variable in expression?

    yes it does
    I am nowhere, yet I am everywhere, I am the eyes that don't see but see all, I am therefore I live


+ Reply to Thread

Similar Threads

  1. E2 Variable Insertion.
    By Bletotum in forum Installation and Malfunctions Support
    Replies: 17
    Last Post: 03-17-2009, 09:15 AM
  2. Variable Stabiliser Expression
    By Soup in forum Installation and Malfunctions Support
    Replies: 25
    Last Post: 10-05-2008, 07:43 AM
  3. Variable Numbering
    By chinoto in forum Ideas & Suggestions
    Replies: 10
    Last Post: 09-24-2008, 10:25 PM
  4. adv. pod variable out put.
    By _-=DEF_CON=-_ in forum Installation and Malfunctions Support
    Replies: 10
    Last Post: 03-03-2008, 01:49 AM
  5. Variable wont zero out.
    By tomato3017 in forum Installation and Malfunctions Support
    Replies: 2
    Last Post: 04-17-2007, 05:36 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots