moving backwards through a list

MSpape sovspape at cognitology.eu
Fri Feb 17 08:09:54 UTC 2012


Hi,

Moving in different ways through the list can quickly get ugly in E-
Prime, I
think. Keeping in mind I (still?) don't have E-Prime here, here's one
idea
(so forgive the syntax errors, there's no way i can check it!):

1. Declare array with words in an inline

Dim myWords as String(1 to 3)
myWords(1) = "A word"
myWords(2) = "Another word"
myWords(3) = "Last Word"
Dim ShowThisWord as Integer

2. Enter a label: Label1
3. Another inline:
ShowThisWord = ShowThisWord + 1
c.SetAttrib "WordToShow", myWords(ShowThisWord)
4. TextDisplay1 with text "[WordToShow]". Duration infinite, allowable
keys
{LEFT}{RIGHT} (or was it {LEFT-ARROW}, I forgot...). Terminate on
press.
5. Last inline
IF TextDisplay1.TEXT = "{LEFT}" THEN
                ShowThisWord = ShowThisWord - 2
                IF ShowThisWord = -1 THEN ShowThisWord = 0 'to avoid
negative scenarios
                GOTO Label1
ELSE
                IF ShowThisWord < 3 THEN GOTO Label1
END IF

Alternatively I think it might be possible to something with colon
syntax,
which would be much more elegant, but I cannot check this. Say, we
have the
same structure, except MyWords is now a nested list 1. Inline

Dim WordToShow as integer
WordToShow = 1
2. Label1
3. Another inline:
c.SetAttrib "WordToShow", c.GetAttrib("myWords:" & cstr(ShowThisWord))
4. same
5. Inline:
IF TextDisplay1.TEXT = "{LEFT}" THEN
                ShowThisWord = ShowThisWord - 1
                IF ShowThisWord = 0 THEN ShowThisWord = 1 'to avoid
negative scenarios
                GOTO Label1
ELSE
                ShowThisWord = ShowThisWord + 1
                IF ShowThisWord <= 3 THEN GOTO Label1
END IF

More elegant, I think, but not sure whether one could hack into this
colon
syntax like this...

HTH,

Mich



From: e-prime at googlegroups.com [mailto:e-prime at googlegroups.com] On
Behalf
Of michael franklin
Sent: 17 February 2012 01:38
To: e-prime at googlegroups.com
Subject: moving backwards through a list



Hi All,

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.



More information about the Eprime mailing list