﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Millisecond Forums » Millisecond Forums » Inquisit 5  » Conditional statements and captions</title><generator>InstantForum 2017-1 Final</generator><description>Millisecond Forums</description><link>https://forums.millisecond.com/</link><webMaster>Millisecond Forums</webMaster><lastBuildDate>Thu, 09 Apr 2026 02:25:03 GMT</lastBuildDate><ttl>20</ttl><item><title>Conditional statements and captions</title><link>https://forums.millisecond.com/Topic27564.aspx</link><description>Hello, &lt;br/&gt;&lt;br/&gt; I would appreciate any help with a couple of questions about changing the presentation on the screen based on conditional statements. &lt;br/&gt; &lt;br/&gt; First, how could I conditionally change the colour of a caption, if a certain value (trialtype == 1) is met?&lt;br/&gt; &lt;br/&gt; Under surveypages, I tried the following:&lt;br/&gt; if (values.trialtype == 1) {&lt;br/&gt; values.player_c = "you";&amp;nbsp; &lt;br/&gt; caption.c.txcolor = red}&lt;br/&gt; &lt;br/&gt; This did not work as it did for the text in the forum response here: &lt;a href="https://www.millisecond.com/forums/Topic16701.aspx"&gt;&lt;a href="https://www.millisecond.com/forums/Topic16701.aspx"&gt;https://www.millisecond.com/forums/Topic16701.aspx&lt;/a&gt;&lt;/a&gt;&lt;br/&gt; &lt;br/&gt; Is there any way to get around this?&lt;br/&gt; &lt;br/&gt; In addition, I want to create a caption on the surveypage that only occurs if trialtype ==1 is met. Would I approach this the same way as I did above?&lt;br/&gt; &lt;br/&gt; Thank you&lt;br/&gt;</description><pubDate>Wed, 07 Aug 2019 13:30:55 GMT</pubDate><dc:creator>psych101</dc:creator></item><item><title>RE: Conditional statements and captions</title><link>https://forums.millisecond.com/Topic27570.aspx</link><description>Thanks, Dave! This worked for both the cases I needed help with.&amp;nbsp;</description><pubDate>Wed, 07 Aug 2019 13:30:55 GMT</pubDate><dc:creator>psych101</dc:creator></item><item><title>RE: Conditional statements and captions</title><link>https://forums.millisecond.com/Topic27565.aspx</link><description>&lt;div data-id="27564" class="if-quote-wrapper" unselectable="on" data-guid="1565203769074"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="27564" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="27564" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="27564" title=" "&gt;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;psych101 - 8/7/2019&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-27564"&gt;&lt;div class="if-quote-message-margin"&gt;Hello, &lt;br/&gt;&lt;br/&gt; I would appreciate any help with a couple of questions about changing the presentation on the screen based on conditional statements. &lt;br/&gt; &lt;br/&gt; First, how could I conditionally change the colour of a caption, if a certain value (trialtype == 1) is met?&lt;br/&gt; &lt;br/&gt; Under surveypages, I tried the following:&lt;br/&gt; if (values.trialtype == 1) {&lt;br/&gt; values.player_c = "you";&amp;nbsp; &lt;br/&gt; caption.c.txcolor = red}&lt;br/&gt; &lt;br/&gt; This did not work as it did for the text in the forum response here: &lt;a href="https://www.millisecond.com/forums/Topic16701.aspx"&gt;&lt;a href="https://www.millisecond.com/forums/Topic16701.aspx"&gt;https://www.millisecond.com/forums/Topic16701.aspx&lt;/a&gt;&lt;/a&gt;&lt;br/&gt; &lt;br/&gt; Is there any way to get around this?&lt;br/&gt; &lt;br/&gt; In addition, I want to create a caption on the surveypage that only occurs if trialtype ==1 is met. Would I approach this the same way as I did above?&lt;br/&gt; &lt;br/&gt; Thank you&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="27564"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/div&gt;&lt;br/&gt;Changing the color is not possible with captions. To make a caption appear or disappear conditionally, manipulate its position.&lt;br/&gt;&lt;br/&gt;&amp;lt;caption mycaption&amp;gt;&lt;br/&gt;/ caption = "Bla"&lt;br/&gt;/ position = (values.x, values.y)&lt;br/&gt;&amp;lt;/caption&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;list trialtypes&amp;gt;&lt;br/&gt;/ items = (1,1,0,0)&lt;br/&gt;&amp;lt;/list&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;values&amp;gt;&lt;br/&gt;/ trialtype = 0&lt;br/&gt;/ x = -10%&lt;br/&gt;/ y = -10%&lt;br/&gt;&amp;lt;/values&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;surveypage mypage&amp;gt;&lt;br/&gt;/ ontrialbegin = [&lt;br/&gt;values.trialtype = list.trialtypes.nextvalue;&lt;br/&gt;]&lt;br/&gt;/ ontrialbegin = [&lt;br/&gt;if (values.trialtype == 1) {&lt;br/&gt;values.x = 40%;&lt;br/&gt;values.y = 10%;&lt;br/&gt;} else {&lt;br/&gt;values.x = -10%;&lt;br/&gt;values.y = -10%;&lt;br/&gt;}&lt;br/&gt;]&lt;br/&gt;/ questions = [1=mycaption]&lt;br/&gt;/ showpagenumbers = false&lt;br/&gt;/ showquestionnumbers = false&lt;br/&gt;&amp;lt;/surveypage&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;block myblock&amp;gt;&lt;br/&gt;/ trials = [1-4 = mypage]&lt;br/&gt;&amp;lt;/block&amp;gt;&lt;br/&gt;&lt;br/&gt;Theoretically, you can use the same position-trick above to get your color-change effect. I.e. if trialtype is 1, move a caption with /txcolor = red on-screen (move it off-screen otherwise), if trialtype is not 1, move a different caption with /txcolor = black on-screen (move it off otherwise).&lt;br/&gt;</description><pubDate>Wed, 07 Aug 2019 11:56:43 GMT</pubDate><dc:creator>Dave</dc:creator></item></channel></rss>