Random Questions?

Phil Davis davis.phil at comcast.net
Sat Oct 1 13:47:50 EDT 2005


Hi again -

I just realized I may have answered what you weren't asking.  :o/

It's still easy! If you have questions that contain multiple 
CR-delimited lines, you can do this:

1) separate complete questions with a character that will never appear 
in the questions - like a pipe "|" or tilde "~".

2) put that special character between questions.

3) Refer to it this way in code:
     set the lineDelimiter to "~" -- or whatever the char is
     put any line of fld "questionList" into fld "question"

Thanks -
Phil

Phil Davis wrote:

>
>
> SupermanSlyr at aol.com wrote:
>
>> I'm trying to make a testing program that inserts random questions 
>> into a  field when the card is open. I was not sure exactly how to go 
>> about doing this.  This is what I tried to do. I put a field on each 
>> card with a few names on it,  just to see if I had the random thing 
>> down. The I made the field invisible. I  tried to scripted the card to:
>> On opencard
>> get random(item 1 of field "ranName") put it into field "Question" 
>> end opencard  
>> (I know I said the field has names in it. I  just wanted to see if I 
>> could get random text this way before I went nuts adding  long 
>> questions.) 
>> Also I'm still not 100% sure how (even if the above did work) to 
>> make  the question occupy more than just one line of text. I assume 
>> I'd have  to use "item" and maybe a chunk operation? Because I wasn't 
>> sure how  Revolution knows when an item begins, and when it ends. I 
>> just want to make  a simple testing program that doesn't always give 
>> the same questions. I  know the answer is probably very simple, and 
>> right under my nose again.
>
>
> You're right - it's easy.
>
> If 'random' is confusing, you can do this instead to display long 
> questions:
>
>  put any line of fld "ranName" into fld "question"
>
> In Rev fields, a "line" is a string of text ending with a CR. That 
> means it can "soft wrap" in a field an still be used as a single line.
>
> HTH -
> Phil Davis





More information about the use-livecode mailing list