Kind of "customisable" LOOKUP(2), possible?


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891

    Default Kind of "customisable" LOOKUP(2), possible?

    Hello,

    I want to make a choice between five (or more or less) options (values, datas, etc).

    When the selection process starts, I have a loop (FOR...NEXT) proposing those five options, one after another and separated by a 3 seconds pause (time to accept and I want to progressively keep only the ones that "please" me.

    This is an example of how I would like it to work:
    FOR x = 0 to LKUP
    LOOKUP, LKUP,[alpha, bravo, delta, charly, echo], Choice
    ' accept "delta"
    NEXT x

    next time:
    LKUP = LKUP - 1
    FOR x = 0 to LKUP
    LOOKUP, LKUP,[alpha, bravo, charly, echo], Choice
    ' accept "alpha"
    NEXT x

    next time:
    LKUP = LKUP - 1
    FOR x = 0 to LKUP
    LOOKUP, LKUP,[bravo, charly, echo], Choice
    ' accept "echo"
    NEXT x
    ...etc.

    In brief: how can I reduce the number of values or contants in a LOOKUP(2) command?
    Roger

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Not sure to follow you

    But how about using always the same big lookup, but using a smaller range for the FOR-TO-NEXT (i.e. Start @ different place, end @ different place)... then make some decision from there?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    947


    Did you find this post helpful? Yes | No

    Default

    I think I understood what you want to do. However, I do not think Lookup or even Lookup2 is suitable for this kind of thing. See, the Lookup2 statement expands into an assembly language macro with the parameters coded at 'compile' time.

    Now, a possible solution could be to put the choices into an array. Everytime you pick one choice out of the array, re-pack the array after removing the chosen one. Use a little code to do what Lookup2 does and offer choices from the array.

    Jerson

  4. #4
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default

    Yes Jerson,

    I'm currently trying your way but I'm still unsuccessful.

    I'll post my code tomorrow since I have to try some other options before asking again ;-)
    Roger

Similar Threads

  1. Kind of stuck
    By gti_uk in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 31st May 2009, 20:45
  2. LOOKUP2 please help
    By emilhs in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 12th May 2009, 23:13
  3. lookup2?
    By jonas2 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 28th February 2009, 12:26
  4. Lookup2 & Lookdown2
    By saladlee in forum Serial
    Replies: 1
    Last Post: - 4th February 2008, 20:41

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts