Using Random variable

vicki
vicki Community Member Posts: 75 ♪ Opening Act ♪
Hi all,

I am working on an interaction in Lectora Publisher (v 16.1.2) where, unlike a test that will randomly select 10 questions, I want users to answer 10 questions correctly before moving forward. I have 14 questions that can be cycled through. However, when I test it, it gives 5 questions then stops. I can't figure this out. Perhaps someone has some insight.

The programming is as follows:
  • Action group: Set Question Number
    • Action: Modify variable _question, set equal to, RAND(1,14)
    • Action: Run Action Group Show Question
  • Action Group: Show Question
    • Action: Show Question 1 IF _question is equal to 1 AND Question_0001 Is not correct
    • Action: Show Question 2 IF _question is equal to 2 AND Question_0002 Is not correct
    • (there are 14 of these actions, one for each question with appropriate _question value)
The test questions are standard MC with an image and a submit button. If the answer is correct, there is a Modify Variable _correct to add 1 to the variable. Once the feedback is shown, users click a next question button.

The actions associated with the next question button are:
  • Run Action Group Set Question Number IF _correct Is Less Than 10 ELSE Run Action Group Done (the congrats...move along statement)
  • Hide test question (14 of these actions)
To me, the logic is that with these actions it should cycle through unattempted or incorrect questions until 10 have been answered correctly. But, I must be missing something in my logic.

Thank you in advance for your insights and suggestions.

Comments

  • mallow76
    mallow76 Community Member Posts: 123
    Have you tested the rest of the actions without using the randomise function in the first part - i.e. just set that action to add 1 to _question each time? That will at least test if the rest of your logic is sound.

    Will be tricky to get the rand function to do as you need as it will not reliably cycle between every value in the range 1 to 14.

    And what happens if a question number is selected again and the question has previously been answered correctly? i.e. what happens when:  _question is equal to 1 AND Question_0001 Is Correct? That might be what is happening when it appears to stop after 5 questions.
  • vicki
    vicki Community Member Posts: 75 ♪ Opening Act ♪
    Well, there is good news and bad news this morning.

    As I shut down my computer last night, it installed a windows update. This morning, the interaction is working much better (it showed 22 questions before I stopped) HOWEVER, the question text box shows, the submit button shows, and the feedback shows, but the answer choices, radio buttons, and image do not. So, you cannot answer the question.

    I uploaded to ReviewLink to verify this...that it wasn't just a local issue.

    I have not changed anything this morning. Just opened the file.

    Back to the original issue...you may be right that the program does not know what to do if the question has already been answered correctly. I think I will add an ELSE statement to run the Set Question Number action group again if the question that was randomly selected is not available.

    Thanks!
  • jvalley4735
    jvalley4735 Community Member Posts: 1,357
    If you continue to have issues after updating Windows please let our support team know.  You can email them at [email protected] or select the Submit a Support Ticket button the upper right of the screen under the list of active users.
  • vicki
    vicki Community Member Posts: 75 ♪ Opening Act ♪
    The good people at Trivantis helped me with the issue of stuff not appearing (I had an action out of order. Doh!).

    So back to my original problem that mallow76 pointed out...I think that if a random variable has been used and was correct but is randomly selected again, questions stop appearing.

    I tried adding to the Show Question actions an else statement so that the action read:

    Show question IF variable = 42 (the question number) AND Question is empty (the question is to reset if previously used and incorrect) ELSE Run Action Group Set Question Number

    Adding the else really confused things so I removed it. To me, the logic is that it should work...go and pick another question.

    So, does anyone have any suggestions on how to have a value in a range of values omitted once the question it pulls has been answered correctly?

    Thanks!
  • klaatu
    klaatu Community Member Posts: 988
    Please post a sample so we can work on getting the logic working without having to build everything else. Time is money and the truth is, well, I'm lazy...
  • vicki
    vicki Community Member Posts: 75 ♪ Opening Act ♪
    Here is an exe of one of these interactions. Let me know if there was something else you were expecting. I haven't provided a sample before.

    Thanks!
  • vicki
    vicki Community Member Posts: 75 ♪ Opening Act ♪
    Ack...trying again.
  • klaatu
    klaatu Community Member Posts: 988
    The is nothing attached. It would be best if you could provide a zipped publish of a sample. Make sure it includes the AWT and ini file.
  • vicki
    vicki Community Member Posts: 75 ♪ Opening Act ♪
    Let's try this...There is the awt file with image folder and an exe of the content.
  • klaatu
    klaatu Community Member Posts: 988
    Okay, the last one looks like it will work. A .docx didn't come through but that shouldn't be an issue. Give me at least a day to look it over.
  • klaatu
    klaatu Community Member Posts: 988
    I haven't forgotten about you. I went through it pretty good and your logic seems solid and smart. I didn't find any typo's either. I wonder, did you copy and paste the actions and then make changes? I can speak for Lectora but I know ToolBook didn't like that. I'm also wondering if keeping it all one one page is contributing to the issue. By the way, what you are trying to accomplish and how you have to go about it really shows the weakness of Lectora's action system.

    I've rebuilt a lot of the login in JavaScript. Its reusable and easily allows as many questions in the pool as you wish. You can also change the number of questions asked out of them as well. I still have to add the tossing incorrectly answered questions back in the pool. It's a great quiz interaction that I think a lot of people will like to use.

    I've got two of my three daughters graduating the next two days (one high school the other college) so I'm not going to get at it much until at least this weekend.
  • vicki
    vicki Community Member Posts: 75 ♪ Opening Act ♪
    This interaction was built by another instructional designer who recently left the organization. I get to finish this course that she was working on. When I was first assigned the course, I went through trying to understand her logic. I ended up removing a couple of variables and actions that assigned letters to each question. I thought these variables were redundant and made things more complicated than they needed to be. Perhaps I need to go back and look at her original programming again. I may understand it better now.

    The purpose of this activity is to reinforce users base knowledge. This knowledge will come into play in later chapters with some higher level decision-making (how style of roof can affect fire response efforts).

    Congratulations on the graduations! I too will be out of pocket for the next week, but for a business trip. I will catch up when I get back next weekend.

    Thanks again!
  • klaatu
    klaatu Community Member Posts: 988
    Okay, I think I got it without having to resort to JavaScript. What was happening was if you answered a question correctly there was no mechanism for the "select a question" action group to get fired off if that question was randomly picked again. Adding an "Else" action to each of the show actions did not work.  What I wound up doing was adding actions that trigger the "select a question" action group if the question selected was already answered correctly. I've tested it a few times and so far I have not had it trip up. Test, test, test and then test some more before putting it in production.
  • klaatu
    klaatu Community Member Posts: 988
    By the way, mallow76 hit the nail on the head.  The problem could have occurred on the second question had you answered it correctly as number one and it randomly was selected as number two. The way I debugged this was to temporarily add a display message as the second action of the "select a question" action group. This quickly showed that when a correctly answered question was selected again  - boom!

     
  • vicki
    vicki Community Member Posts: 75 ♪ Opening Act ♪
    So far, that solution is working perfectly! Thank you, thank you, thank you!!!

    I figured it would be a relatively simple fix (such as adding an else...which doesn't work), but couldn't wrap my head around any other fixes.

    I owe you one!
  • klaatu
    klaatu Community Member Posts: 988
    You're very welcome. I'm glad I was able to help.  This engaging interaction requires some logic that is not easy to put together using Lectora actions. It's quite clever how you have it set up.

    Darrel