Skip to content

Commit

Permalink
Moved some code from a project I was working on to PsyForge because I…
Browse files Browse the repository at this point in the history
… put it in the wrong place
  • Loading branch information
bruskajp committed Jan 31, 2025
1 parent e21c5ab commit 77e6094
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
5 changes: 0 additions & 5 deletions Runtime/Scripts/Experiment/MathDistractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ public async Task RunInitialTimings() {
}

public async Task Run(bool isPractice, int trialNum, bool setProblemTimings = false) {
if (isPractice) {
await ExpHelpers.PressAnyKey("instructions math distractor", LangStrings.IntroSlidesMathDistractorTitle(),
LangStrings.IntroSlidesMathDistractor().Aggregate((a, b) => a + b));
}

ExpHelpers.SetExperimentStatus(HostPcStatusMsg.DISTRACT(trialNum));
var trueDistractorDurationMs = isPractice ? practiceDistractorDurationMs : distractorDurationMs;

Expand Down
8 changes: 3 additions & 5 deletions Runtime/Scripts/Experiment/VerbalFreeRecall.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ public VerbalFreeRecall(int practiceVerbalFreeRecallDurationMs, int verbalFreeRe
this.verbalFreeRecallDurationMs = verbalFreeRecallDurationMs;
}

public async Task Run(bool isPractice, uint trialNum) {
if (isPractice) {
await ExpHelpers.PressAnyKey("instructions verbal free recall", LangStrings.IntroSlidesVerbalFreeRecallTitle(), LangStrings.PracticeVerbalFreeRecall());
}
public async Task Run(bool isPractice, uint trialNum, LangString verbalRecallDisplay = null) {
verbalRecallDisplay ??= LangStrings.VerbalRecallDisplay();

// Setup
var realVerbalFreeRecallDurationMs = isPractice ?
Expand All @@ -45,7 +43,7 @@ public async Task Run(bool isPractice, uint trialNum) {

// Play start beep
manager.lowBeep.Play();
textDisplayer.Display("verbal recall display", text: LangStrings.VerbalRecallDisplay());
textDisplayer.Display("verbal recall display", text: verbalRecallDisplay);

while (manager.lowBeep.isPlaying) { await Awaitable.NextFrameAsync(); }
await manager.Delay(100); // This is needed so you don't hear the end of the beep in the recording
Expand Down
6 changes: 6 additions & 0 deletions Runtime/Scripts/ExternalDevices/HostPcMsg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ protected HostPcStatusMsg(string name, Dictionary<string, object> dict = null)

public static HostPcStatusMsg PAUSE(bool pauseStart) { return new HostPcStatusMsg("PAUSE", new() { {"pause start", pauseStart} }); }
public static HostPcStatusMsg WAITING() { return new HostPcStatusMsg("WAITING"); }
public static HostPcStatusMsg DISTRACT(int trailNum) { return new HostPcStatusMsg("DISTRACT", new() {{"trial", trailNum}}); }
public static HostPcStatusMsg MATH(bool correct, string problem, string answer, int responseTimeMs) { return new HostPcStatusMsg("MATH",
new() { { "correct", correct }, { "problem", problem }, { "answer", answer }, { "responseTimeMs", responseTimeMs } }
); }
public static HostPcStatusMsg ENCODING(uint trailNum) { return new HostPcStatusMsg("ENCODING", new() {{"trial", trailNum}}); }
public static HostPcStatusMsg RECALL(float duration, uint trailNum) { return new HostPcStatusMsg("RECALL", new() {{"duration", duration}, {"trial", trailNum}}); }
}

// Host PC Closed Loop Message
Expand Down
4 changes: 4 additions & 0 deletions Runtime/Scripts/Utilities/MyLangStrings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ public static partial class LangStrings {
{ Language.English, "*****" },
{ Language.German, "*****" },
}); }
public static LangString MathDistractorPreTrial() { return new( new() {
{ Language.English, "Press any key to start the math task." },
{ Language.German, "Drücken Sie eine beliebige Taste, um die Mathematikaufgabe zu starten." },
}); }
public static LangString ElememConnection() { return new( new() {
{ Language.English, "Waiting for Elemem connection..." },
{ Language.German, "Warte auf Elemem-Verbindung..." },
Expand Down

0 comments on commit 77e6094

Please sign in to comment.