My code will not bring up the congratulations screen on the hangman

https://snap.berkeley.edu/snap/snap.html#present:Username=rylie.rice&ProjectName=Rylies%20Arcade%20(copy)

someone help
I have tried putting the good game screen code in a repeat until the coordinates are in the right spot, tried putting the code from inside the custom block out of it, and many more different solutions I thought would have worked but nothing has yet to work. If anyone knows how to fix it so the screen pops up please let me know.

Welcome to the forums, rylie.rice! I'll have to unshare the project if this is for school, we can't do your homework for you. Anyways, your problem is that you need to put "coordinates for winner" in a ring, which you can find in the operators tab. There are three shapes for all blocks, stacks, reporters, and predicates. The reason why you have to do this is because if you don't, it gets evaluated instantly and then reports a boolean that can't be changed.

When you put it in rings, instead, you can call it whenever you want, because it's reporting the script that will be ran later. When you don't, it immediately gets computed and returns false because you didn't win the game yet, and then when you put it in the custom block later, they see false because that was what was reported in the past.

The second thing you need to do is go into the "good game screen" custom block and put "coordinates for winner" in the call block. I haven't figured out scratchblocks so I can't send you an image but you should find it in the control category. When you use call or run, you tell what is in the ring to run.

Another way you could do this is by putting "coordinates for winner" in its own custom block, and then calling it when you need to. By putting it in a custom block, that also makes it run when you need it to.

In conclusion, the problem is that "coordinates for winner" runs right after the variable is set. By putting it in a ring or making it a custom block, you can run it when you want. I'll send you the fixed project: here

this is the first time i debugged a real person's code btw

Do you pretend to be an admin bot?
I do not want to be rude, but your post sounds so GPT-ishy, like it was created or at least, assisted with an AI.

I see that the code you added worked but I am not sure the reasoning behind it.
Do you mind going into more detail what this means? I'm not sure how to do the rings or what that changes in my code (how does it all of a sudden make my code work).
Also, what does the call block do? Because how would it make sense to call the coordinates and not just use an if statement so if the coordinates of needed letters are in the correct position it was display the congratulations screen?
This is for school but my teacher told me to post it on here to receive feedback and help because he can't figure it out as well.
Thank you for your help!

Could I suggest that you read Chapter VI, "Procedures as Data," starting on page 65 of the manual? Then you can ask a more specific question if you don't understand something.

No, I do not pretend to be an admin bot. I do use Grammarly though.

If your teacher allowed it then I guess it's ok. I believe I explained it in my first post. When you add the rings it reports the blocks that are in it, so you're storing code that can be run later. The call block can call a ring (or script) that reports a value. But without the ring, it evaluates it before reporting something that is not a script, unless it's supposed to report a script.

Answering your first question, you're not calling the coordinates. You're calling everything in the ring, which is the entire "and" block. When you put it in a ring you save the block for later, the "call" block will evaluate the "and" block and report what it will report.

You need to keep it in a ring because simply putting it in the variable won't make it a script. It will immediately run and report a boolean, which cannot be changed. Then when you get the value later, it reports the boolean that can't be changed that was reported before.

You aren't storing coordinates, you're making a predicate that checks the coordinates and reports a boolean. Putting it in a ring still gives the predicate, but instead of reporting the value, it reports the predicate itself. Think of it like taking the "coordinates for winner" variable's value and dragging it straight into the block. Instead of running it once at the start of the project, it checks at the right times.

Maybe you should read that part of the manual like bh said.

This helped a lot, thank you so much! I think what I didn't completely understand is what a ring did, but now that you explained it and I read the manual I get it. Thank you for your help!

You're welcome!

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