How to alter all but one (or some) variables?

I want to make a game where you have a bunch of moves, but you can only do a move if you aren’t currently in the process of performing another one. So for example, if you are currently jumping, “canJump” has to be true, and jumping would automatically set “canRun”, “canSwim” and “canClimb” to false until the jump is complete.

I can create a jump block that automatically does “set canRun to false”, “set canSwim to false”, etc. But that’s very wordy, so I’d rather have every variable be in a list and have a script that sets every canVariable aside from jump to false, then sets them back to true at the end. How can I do this?

if you remake the set variable block as a custom block you can input text and reporters into the first slot (unlike the regular set variable block). With that you should be able to loop through a list of variable names and set them however you like.

I would put an image here showing the custom block, but unfortunately I am unable to. You can still right-click the set variables block and hit edit to see how to recreate it

I made these two blocks:

This block sets each variable listed to different thing:
Tamagotchi script pic (14)

This block sets each variable listed to the same thing:
Tamagotchi script pic (15)

If I'm understanding correctly what you want to accomplish, I don't think you need a separate variable for every kind of move. Just have a current move variable that you set to "jump" when you're jumping, etc. Set it to "none" or something when you finish a move. Then you can say

If that won't do, I like your original idea of putting them all in a list:

Then you can test them with
untitled script pic (10)
and set them with
untitled script pic (11)

PS This is a good programming language; no need for hideous camelCase in variable names!

Thanks!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.