# Find Stimulus in Code

**URL:** <https://discourse.psychopy.org/t/find-stimulus-in-code/25964>\
**Category:** Coding\
**Tags:** code\
**Created:** [November 14, 2021, 7:52pm UTC](https://discourse.psychopy.org/t/find-stimulus-in-code/25964 "2021-11-14T19:52:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![aboye](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@aboye](https://discourse.psychopy.org/u/aboye)\
**Post date:** [November 14, 2021, 7:52pm UTC](https://discourse.psychopy.org/t/find-stimulus-in-code/25964/1 "2021-11-14T19:52:45Z")

</div>

URL: [trailMaking [PsychoPy]](https://run.pavlovia.org/aboye/trailtrailtesting/html/? __pilotToken=98f13708210194c475687be6106a3b84&__ oauthToken=02dbb1dfd89eaf6840b2bd9af00cdc2906fbbc16ed79aa62e2bf1a57f8210b75)

Hi. I downloaded this task from Pavlovia. I want to make another task where participants only select from A → B → C → etc., but I cannot find where in the code the stimuli A, B, C, 1, 2, 3, etc. is defined. I see that it is labeled trialTarget, but I do not see where I can edit the A, B, C, 1, 2, 3. Please help. Thank you in advance.

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [November 14, 2021, 8:58pm UTC](https://discourse.psychopy.org/t/find-stimulus-in-code/25964/2 "2021-11-14T20:58:14Z")

</div>

Is there an associated spreadsheet?

---

<div class="post-metadata">

**Author:** ![aboye](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@aboye](https://discourse.psychopy.org/u/aboye)\
**Post date:** [November 14, 2021, 10:05pm UTC](https://discourse.psychopy.org/t/find-stimulus-in-code/25964/3 "2021-11-14T22:05:00Z")

</div>

There is no associated spreadsheet. Do you need more information to help me with this? I’d be happy to provide that.

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [November 14, 2021, 10:56pm UTC](https://discourse.psychopy.org/t/find-stimulus-in-code/25964/4 "2021-11-14T22:56:05Z")

</div>

Please could you link to the original repository or upload a screenshot of the flow and loop definition?

---

<div class="post-metadata">

**Author:** ![aboye](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@aboye](https://discourse.psychopy.org/u/aboye)\
**Post date:** [November 14, 2021, 11:38pm UTC](https://discourse.psychopy.org/t/find-stimulus-in-code/25964/5 "2021-11-14T23:38:54Z")

</div>

Here is the original repository: [smcl / TrailMaking · GitLab](https://gitlab.pavlovia.org/smcl/trailmaking)

Thank you so much in advance

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [November 15, 2021, 8:59am UTC](https://discourse.psychopy.org/t/find-stimulus-in-code/25964/6 "2021-11-15T08:59:42Z")

</div>

Here’s the code you need to change in Begin Routine of Target Code

```auto
if (index % 2 == 0) {
        trialTargetLabels[index].text = parseInt(index, 10)/2 + 1;
    } else {
        trialTargetLabels[index].text = alphaID.next();
    }

```

In English this means:

If the index is even, the label should be a number  
otherwise add the next letter

However, since this has been written in JS code directly rather than translated Python, then there is a lot of code I am unfamiliar with.

---

<div class="post-metadata">

**Author:** ![aboye](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@aboye](https://discourse.psychopy.org/u/aboye)\
**Post date:** [November 15, 2021, 3:51pm UTC](https://discourse.psychopy.org/t/find-stimulus-in-code/25964/7 "2021-11-15T15:51:41Z")

</div>

Thank you so much, I will try that.

I made sure that the code that defined the stimulus was in Python. I found this out by deleting all of the JS in the Begin Routine tab and it still ran with just the Python.
