+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Variable Numbering

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

    Default Variable Numbering

    I want to be able to use a variable to make new variables using the same kind of system as concommand('$H$:$M$:$S$') does. I am making a number sorter for an "infinite floor elevator" Heres my current code which is supposed to be used with a target finder and may or may not work.
    My new code if this feature were added would be something like "~A -> A$A$ = Max;"
    Code:
    N@Number Sorter
    I@In
    O@Next A1 A2 A3 A4 A5
    interval(20)
    ((In > Min) & (In < Max)) | (Min >= Max) | A -> Max = In;
    (Next = !Next * (A < 5)) & ~Next -> N += 1;
    N > 30 -> A += 1;
    (A == 1) & ~A -> A1 = Max;
    (A == 2) & ~A -> A2 = Max;
    (A == 3) & ~A -> A3 = Max;
    (A == 4) & ~A -> A4 = Max;
    (A == 5) & ~A -> A5 = Max;
    (\__/) 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."

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

    Default Re: Variable Numbering

    Aw comon, doesn't anyone think this is a good idea.
    (\__/) 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."

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

    Default Re: Variable Numbering

    Quote Originally Posted by chinoto View Post
    Aw comon, doesn't anyone think this is a good idea.
    It's not possible to implement in egate1 and it will most likely be available as an extension in e2 (array).
    Implementing it as dynamic variable names is just pure ugly.

  4. #4
    Wirererer 3dfactor's Avatar
    Join Date
    Aug 2008
    Posts
    178

    Default Re: Variable Numbering

    In normal cases all floors are of the same height, and there is a slight offset from the ground and/or top... Why in hell you need to have elevator height in all the floors if you can count it via (FloorHeight*DesiredFloor)+Offset ??? That way you'd get really infinite (well virtually infinite, you're still bound to number and other limitations) elevator with less headache...
    2d head with 3d brains

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

    Default Re: Variable Numbering

    I dont know why I even made that expression, but this one I made shortly after would benefit from variable numbering because it would be able to have as many coordinates as a person wants (is there a limit to variables and do vectors have any problems like packets do?).
    Code:
    N@Multi-Coordinate Teleporter
    I@Xi Yi Zi Prev Next Set Go Act
    O@Xo Yo Zo Cs Jump Cd
    interval(100)
    Cs += (Prev & ~Prev) - (Next & ~Next)
    Cs > 10 -> Cs = 1;
    Cs < 1 -> Cs = 10;
    (Cs == 1) & Set -> V1 = vector(Xi, Yi, Zi);
    (Cs == 2) & Set -> V2 = vector(Xi, Yi, Zi);
    (Cs == 3) & Set -> V3 = vector(Xi, Yi, Zi);
    (Cs == 4) & Set -> V4 = vector(Xi, Yi, Zi);
    (Cs == 5) & Set -> V5 = vector(Xi, Yi, Zi);
    (Cs == 6) & Set -> V6 = vector(Xi, Yi, Zi);
    (Cs == 7) & Set -> V7 = vector(Xi, Yi, Zi);
    (Cs == 8) & Set -> V8 = vector(Xi, Yi, Zi);
    (Cs == 9) & Set -> V9 = vector(Xi, Yi, Zi);
    (Cs == 10) & Set -> V10 = vector(Xi, Yi, Zi);
    Cs == 1 -> Xo = vecx(V1), Yo = vecy(V1), Zo = vecz(V1);
    Cs == 2 -> Xo = vecx(V2), Yo = vecy(V2), Zo = vecz(V2);
    Cs == 3 -> Xo = vecx(V3), Yo = vecy(V3), Zo = vecz(V3);
    Cs == 4 -> Xo = vecx(V4), Yo = vecy(V4), Zo = vecz(V4);
    Cs == 5 -> Xo = vecx(V5), Yo = vecy(V5), Zo = vecz(V5);
    Cs == 6 -> Xo = vecx(V6), Yo = vecy(V6), Zo = vecz(V6);
    Cs == 7 -> Xo = vecx(V7), Yo = vecy(V7), Zo = vecz(V7);
    Cs == 8 -> Xo = vecx(V8), Yo = vecy(V8), Zo = vecz(V8);
    Cs == 9 -> Xo = vecx(V9), Yo = vecy(V9), Zo = vecz(V9);
    Cs == 10 -> Xo = vecx(V10), Yo = vecy(V10), Zo = vecz(V10);
    first() | (Cd <= -1) -> Cd = 5, I = 0;
    Go -> Cd = 5, I = -0.1;
    Cd += I
    Jump = (Cd <= 0) & Act
    (\__/) 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."

  6. #6
    Wirererer 3dfactor's Avatar
    Join Date
    Aug 2008
    Posts
    178

    Default Re: Variable Numbering

    Why not just use memory chip with floor number as address? Seriously, don't get things more complicated than they are in reality
    2d head with 3d brains

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

    Default Re: Variable Numbering

    Did I say this one was for an elevator, no. It is for storing any coordinates, then being able to retrieve them for use with a hoverdrive.
    Last edited by chinoto; 09-24-2008 at 10:24 AM.
    (\__/) 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."

  8. #8
    Spucatum Tauri Bull's Avatar
    Join Date
    Jun 2008
    Location
    Finland
    Posts
    6,009

    Default Re: Variable Numbering

    Quote Originally Posted by chinoto View Post
    ..I am making a number sorter for an "infinite floor elevator"..
    That made it quit seem you did. I didn't knew you switched projects neither.
    But anyways, 3dfactor has a point.

    Adress
    0 indexnumber
    1 x
    2 y
    3 z
    4 indexnumber
    5 x
    6 y
    7 z
    8 indexnumber
    9 x
    10 y
    11 z
    etc.

    Increment index by 4 and retrieve X Y Z from there. With 3 seperate RAM you don't even need to loop through data.

    Or am I totally wrong here?
    My signature has a point.
    Quote Originally Posted by Squeakyneb View Post
    when l3ulletje says do it, do it.
    That

    Quote Originally Posted by Anticept View Post
    By the way, Bull is in charge.

  9. #9
    Wire Sofaking Azrael's Avatar
    Join Date
    Aug 2007
    Posts
    1,946

    Default Re: Variable Numbering

    Uh, the GPS can save and retrieve coordinates for you. But if you want to store it in RAM, do it like l3ulletje said, but you don't need an index number. Just multiply it by 3 and subtract two, ie. 1 => 1, 2 => 4 etc., and then loop through them. Actually, looping in the expression gate is a pain -- use E2 or the CPU.

  10. #10
    Spucatum Tauri Bull's Avatar
    Join Date
    Jun 2008
    Location
    Finland
    Posts
    6,009

    Default Re: Variable Numbering

    True Azreal. Indexnumbers would only make it more complicated. The place of the data on the RAM is already an index.

    I was thinking too diffiult. My thought was if you want to retrieved saved position 33, you would go to indexnumber 33.
    But just retrieve data from 99, 100, 101 would be enough
    My signature has a point.
    Quote Originally Posted by Squeakyneb View Post
    when l3ulletje says do it, do it.
    That

    Quote Originally Posted by Anticept View Post
    By the way, Bull is in charge.

+ Reply to Thread
Page 1 of 2 12 LastLast

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. (E2) Variable self-check
    By CDRW in forum Expression 2 Discussion & Help
    Replies: 3
    Last Post: 01-11-2009, 02:07 PM
  3. name+variable in expression?
    By ThePearl in forum Expression 2 Discussion & Help
    Replies: 3
    Last Post: 01-04-2009, 02:46 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