+ Reply to Thread
Results 1 to 3 of 3

Thread: Connecting Strings with or? E2

  1. #1
    Wire Noob Hexogen's Avatar
    Join Date
    Jan 2010
    Posts
    9

    Question Connecting Strings with or? E2

    Hey guys,
    i guess its a pretty easy solution but i can't figure it out at the moment.
    Im trying to link two strings with "or" |.

    Example:
    I got a door opening with numpad 0, one ranger infront and one behind it, with steamid outputs.
    My E2 chip is looking something like that:

    Code:
    @inputs A:string B:string (The steamid strings)
    @outputs C 
    X = "My_STEAMID"
    Y = "Friends_STEAMID"
    
    if ((A|B)==(X|Y))
    {
      C=1
    } else
    {
      C=0
    }
    What im trying to achieve:
    If string A OR string B equal to string X OR string Y then open door

    Ovbiously it didnt work, so how do i connect strings with an or?
    When doing A|B the output is 1, but thats actually not what im trying to do ^^
    any ideas?

    i guess i could workaround using if((A=X)|(A=Y)|(B=X)|(B=Y)) etc, but thatd be pretty unfavorable with more than 2 strings

    thanks in advance
    Hexo

    -edit Just found the E2 help subforum, sorry for wrong forum post, move please if neccessary
    Last edited by Hexogen; 03-17-2010 at 03:02 PM. Reason: Wrong forum

  2. #2
    Wire Sofaking ktccd's Avatar
    Join Date
    Sep 2009
    Posts
    751

    Default Re: Connecting Strings with or? E2

    if (A==X | A==Y | B==X | B==Y) is how I'd have done it.

    no, wait... if A B C D etc is any of XYZ etc?

    tables, if it's string, array if numbers.

    STRING["My string",number] = 1
    if (STRING[A,number] | STRING[B,number]) and so on. that makes it a little shorter ^^.

  3. #3
    Ursus maritimus Drunkie's Avatar
    Join Date
    Feb 2009
    Location
    Canada
    Posts
    5,661
    Blog Entries
    1

    Default Re: Connecting Strings with or? E2

    -snip-

+ Reply to Thread

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