- Joined
- Dec 14, 2016
- Messages
- 19
- Reaction score
- 2
- First Language
- Filipino
- Primarily Uses
Good day!
I am a JavaScript beginner who's still trying to learn, and I'm having some trouble running a particular plugin I made for an old project I've recently come back to. Originally, this part of my project was a mess of conditional branches, but after finding out about switch statements, I tried changing it entirely. I was originally hoping to put the entire code on a script call, but it did not fit within the max limit. So I tried saving it externally as a plugin, yet I can't seem to get it to work.
Here's what I wrote for the plugin:
I then do a script call for wellDefined(); , but the Developer Tools windows popup due to an error.
I would be very grateful for any advice as to how I might fix my code, as well as any suggestions as to how I can further optimize it.
Thank you so much
I am a JavaScript beginner who's still trying to learn, and I'm having some trouble running a particular plugin I made for an old project I've recently come back to. Originally, this part of my project was a mess of conditional branches, but after finding out about switch statements, I tried changing it entirely. I was originally hoping to put the entire code on a script call, but it did not fit within the max limit. So I tried saving it externally as a plugin, yet I can't seem to get it to work.
Here's what I wrote for the plugin:
JavaScript:
var wellDefined = function() {
switch ($gameVariables.value(2)) {
case 1:
$gameVariables.setValue(21, "primary colors");
break;
case 2:
$gameVariables.setValue(21, "famous dancers");
break;
case 3:
$gameVariables.setValue(21, "all multiples of 5");
break;
// 47 more cases...
}
};
I then do a script call for wellDefined(); , but the Developer Tools windows popup due to an error.
I would be very grateful for any advice as to how I might fix my code, as well as any suggestions as to how I can further optimize it.
Thank you so much