+ Reply to Thread
Page 11 of 26 FirstFirst ... 91011121321 ... LastLast
Results 101 to 110 of 253
Like Tree5Likes

Thread: A Beginners Guide to Expression 2

  1. #101
    Wirererer carocrazy132's Avatar
    Join Date
    May 2009
    Posts
    122

    Default Re: A Beginners Guide to Expression 2

    BUT they would all be in the same lua script, so
    a asks b who it knows,
    b asks c who it knows,
    c asks d who it knows,
    d asks e who it knows,
    e asks f who it knows,
    and f asks g who it knows.

    Now

    F tells e it knows g
    e now knows g
    e tells d that it knows f AND g
    d now knows f and g
    d tells c it knows e f and g
    c now knows e f and g
    c tells b it knows d e f and g
    b now knows everyone which it reports to a

  2. #102
    Developer Matte's Avatar
    Join Date
    Jan 2009
    Location
    Norway
    Posts
    3,109

    Default Re: A Beginners Guide to Expression 2

    And that's what nescolona's code does.
    "If anybody says he can think about quantum physics without getting giddy, that only shows he has not understood the first thing about them."
    -- Niels Bohr

  3. #103
    Wirererer carocrazy132's Avatar
    Join Date
    May 2009
    Posts
    122

    Default Re: A Beginners Guide to Expression 2

    Right, so why can't that code be a function pre-coded into expression 2?
    If he can make it in e2 it could be in e2 already.

  4. #104
    Wire Sofaking nescalona's Avatar
    Join Date
    Apr 2007
    Location
    Shoreline, Washington
    Posts
    1,299

    Default Re: A Beginners Guide to Expression 2

    Okay I figured out what was wrong. (Aside from not initializing Set1, Set2, or Done) I forgot that I had guess that if array R was empty, then (R[1,entity]) would end up false. Wrong. So, I changed the tests to while/if (R:count()) to see if the array is empty or not. Then it worked.

    Also I got off my ass and added the array of already scanned props as a blacklist. That bug I mentioned earlier shouldn't occur. Yay!

    [highlight=e2]Color = vec(randint(0,255),randint(0,255),randint(0,255))
    Done = 0
    Set1 = array()
    Set2 = array()
    Scanned = array()
    Set1[1,entity] = entity()
    while (!Done) {
    while (Set1:count()) {
    WasScanned = 0
    N = 0
    while (!WasScanned & N < Scanned:count()) {
    N++
    if (Scanned[N,entity] == Set1[1,entity]) {
    WasScanned = 1
    }
    }
    if (!WasScanned) {
    Set1[1,entity]:setColor(Color)
    R = Set1[1,entity]:getConstraints()
    while (R:count()) {
    Set2ushEntity(R[1,entity])
    R:remove(1)
    }
    }
    ScannedushEntity(Set1[1,entity])
    Set1:remove(1)
    }
    Done = 1
    while (Set2:count()) {
    WasScanned = 0
    N = 0
    while (!WasScanned & N < Scanned:count()) {
    N++
    if (Scanned[N,entity] == Set2[1,entity]) {
    WasScanned = 1
    }
    }
    if (!WasScanned) {
    Set2[1,entity]:setColor(Color)
    R = Set2[1,entity]:getConstraints()
    while (R:count()) {
    Set1ushEntity(R[1,entity])
    R:remove(1)
    }
    }
    ScannedushEntity(Set2[1,entity])
    Set2:remove(1)
    }
    }
    selfDestruct()
    [/highlight]

    While you're right R=E:constrainedToAll() or some such could be implemented into E2, since I can do it in E2 already, it would be redundant. I know there's loads of redundant stuff in E2 already, but do we need to add more?
    Last edited by nescalona; 08-03-2009 at 03:18 AM.

  5. #105
    Developer Matte's Avatar
    Join Date
    Jan 2009
    Location
    Norway
    Posts
    3,109

    Default Re: A Beginners Guide to Expression 2

    I think that function could be too expensive if you have large contraptions.
    "If anybody says he can think about quantum physics without getting giddy, that only shows he has not understood the first thing about them."
    -- Niels Bohr

  6. #106
    Wire Sofaking nescalona's Avatar
    Join Date
    Apr 2007
    Location
    Shoreline, Washington
    Posts
    1,299

    Default Re: A Beginners Guide to Expression 2

    Lol I tested it and it is crazy expensive. I'll try and separate the coloring over several ticks. Looks like making an E2 function might be a good idea.
    Last edited by nescalona; 08-03-2009 at 04:17 AM.

  7. #107
    Wire Sofaking nescalona's Avatar
    Join Date
    Apr 2007
    Location
    Shoreline, Washington
    Posts
    1,299

    Default Re: A Beginners Guide to Expression 2

    F'ING HELL
    alright guys i made the program way shorter

    [highlight=e2]Color = vec(randint(0,255),randint(0,255),randint(0,255))
    entity():setColor(Color)
    R = entity():getConstraints()
    I = 0
    while(I < R:count()) {
    R[I,entity]:setColor(Color)
    }
    [/highlight]
    :dots:

    That's right. E:getConstraints() gets all entities constrained to E, and all entities constrained to those entities, etc. etc.

    In other words I wasted a long time because E2's documentation sucks ass. Thanks for not properly describing E:getConstraints(). :winner:
    Last edited by Matte; 08-03-2009 at 04:26 AM. Reason: Constrain your language.

  8. #108
    Developer Matte's Avatar
    Join Date
    Jan 2009
    Location
    Norway
    Posts
    3,109

    Default Re: A Beginners Guide to Expression 2

    If you think the documentation suck ass, why don't you update it?
    "If anybody says he can think about quantum physics without getting giddy, that only shows he has not understood the first thing about them."
    -- Niels Bohr

  9. #109
    Wire Sofaking nescalona's Avatar
    Join Date
    Apr 2007
    Location
    Shoreline, Washington
    Posts
    1,299

    Default Re: A Beginners Guide to Expression 2

    I do when I find something in error (rare). If information is just missing (more common), I ask a dev to add it or try to figure out the missing info on my own by testing.

    The wiki description for that function is fixed now

    Sorry about the outburst

  10. #110
    Wire Tutor chinoto's Avatar
    Join Date
    Apr 2008
    Location
    Brooklyn Park, MN. Lost my thumbdrive yet again...
    Posts
    1,983

    Default Re: A Beginners Guide to Expression 2

    ...FUCK! I thought the same thing... WHHAAAAAAAA!
    (\__/) Expression 2 Resources: E2 Beginner's Guide | E2 Formatting Guide | E2 Function Reference | E2 Examples | Me
    (='.'=) PM me code and I'll send it back optimized if possible. (I find it fun dammit!)
    (")_(") Drunkie referring to an E2: "It's obvious that Chinoto made this, his coding style is all over it."

+ Reply to Thread
Page 11 of 26 FirstFirst ... 91011121321 ... LastLast

Similar Threads

  1. An Intermediate Guide to Expression 2
    By Matte in forum Expression 2 Discussion & Help
    Replies: 101
    Last Post: 06-16-2010, 12:21 PM
  2. Key-Points For Beginners
    By Hitman271 in forum CPU, GPU, and Hi-speed Discussion & Help
    Replies: 7
    Last Post: 01-09-2010, 11:28 AM
  3. Guide
    By Conmanx360 in forum Installation and Malfunctions Support
    Replies: 4
    Last Post: 05-05-2008, 10:12 PM
  4. Thrusters Only Guide
    By Bernie in forum Gate Nostalgia (Old School Wiring) Discussion & Help
    Replies: 13
    Last Post: 04-08-2008, 10:03 AM
  5. Wiremod Guide?
    By Tjuven in forum Installation and Malfunctions Support
    Replies: 14
    Last Post: 03-28-2008, 07:18 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