Skip to content

Commit

Permalink
obviousAlexC/newgroundsIO: Cast medalID inputs for medal arguments (#…
Browse files Browse the repository at this point in the history
…1733)

This can cause weird issues where the medal ID is a string and therefore
technically does not exist:

https://github.com/user-attachments/assets/59b8768f-3304-4124-81bb-e226c7d59cd2

This also fixes the input type from STRING to NUMBER since the other
block for medals uses NUMBER as well.
  • Loading branch information
JeremyGamer13 authored Oct 23, 2024
1 parent 5c91389 commit 63377ee
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions extensions/obviousAlexC/newgroundsIO.js
Original file line number Diff line number Diff line change
Expand Up @@ -9286,7 +9286,7 @@
text: Scratch.translate("unlock medal [medalID]"),
arguments: {
medalID: {
type: Scratch.ArgumentType.STRING,
type: Scratch.ArgumentType.NUMBER,
defaultValue: Scratch.translate("MedalID"),
},
},
Expand Down Expand Up @@ -9672,7 +9672,7 @@
if (loggedIn) {
NGIO.keepSessionAlive();
}
NGIO.unlockMedal(medalID);
NGIO.unlockMedal(Scratch.Cast.toNumber(medalID));
}
}

Expand All @@ -9682,7 +9682,7 @@
if (loggedIn) {
NGIO.keepSessionAlive();
}
return NGIO.getMedal(medalID).unlocked;
return NGIO.getMedal(Scratch.Cast.toNumber(medalID)).unlocked;
} else {
return false;
}
Expand Down

0 comments on commit 63377ee

Please sign in to comment.