PDA

View Full Version : Kind of "customisable" LOOKUP(2), possible?



flotulopex
- 5th May 2009, 11:11
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?

mister_e
- 5th May 2009, 14:48
Not sure to follow you :o

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?

Jerson
- 5th May 2009, 17:06
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

flotulopex
- 5th May 2009, 19:45
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 ;-)