Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Turning variables into text
- the_BOIH
-
Scratcher
35 posts
Turning variables into text
I don’t mean just clicking on the little check box and showing the variable like that because that looks bad
I have a game I am working on for computer science and need a way to show a variable as text. It’s a simple clicker game since Im not that good at coding. And I need a way to show my money substitute variable, and I don’t know how to show it as text, if anyone can help me that would be greatly appreciated. The project is due on the 8th I think.
Here’s the project link, it might get updated while Im working on it so make a remix
https://scratch.mit.edu/projects/1088095102
I have a game I am working on for computer science and need a way to show a variable as text. It’s a simple clicker game since Im not that good at coding. And I need a way to show my money substitute variable, and I don’t know how to show it as text, if anyone can help me that would be greatly appreciated. The project is due on the 8th I think.
Here’s the project link, it might get updated while Im working on it so make a remix
https://scratch.mit.edu/projects/1088095102
- ametrine_
-
Scratcher
1000+ posts
Turning variables into text
in a new sprite, make different costumes for each number (from 0-9) and name them the same number. then do this in its code:
when green flag clicked
hide
forever
render
end
define render
erase all :: pen
set [letter number v] to [1]
go to x: (-150) y: (158) // you can adjust these values if the position is incorrect
repeat (length of (Words))
switch costume to (letter (letter number) of (Words))
stamp
change [letter number v] by (1)
change x by (15)
end
Last edited by ametrine_ (Nov. 4, 2024 16:35:45)
- the_BOIH
-
Scratcher
35 posts
Turning variables into text
Should I put the numbers in order of 0-1-2-3-4-5-6-7-8-9 or 1-2-3-4-5-6-7-8-9-0 or something else?
Also I don’t know where to find the erase all block or the stamp block, I’ve checked all of the sections three times. Is it part of the pen thing?
Thank you so much for helping me I would have never been able to do this without your help.
Also I don’t know where to find the erase all block or the stamp block, I’ve checked all of the sections three times. Is it part of the pen thing?
Thank you so much for helping me I would have never been able to do this without your help.
Last edited by the_BOIH (Nov. 4, 2024 17:39:46)
- ametrine_
-
Scratcher
1000+ posts
Turning variables into text
Should I put the numbers in order of 0-1-2-3-4-5-6-7-8-9 or 1-2-3-4-5-6-7-8-9-0 or something else?0-1-2-3-4-5-6-7-8-9 should work
Also I don’t know where to find the erase all block or the stamp block, I’ve checked all of the sections three times. Is it part of the pen thing?
Thank you so much for helping me I would have never been able to do this without your help.
the erase all/stamp blocks are part of the pen extension
also, make sure you check the “run without screen refresh” option when creating the block, that make the code inside it run all at once
Last edited by ametrine_ (Nov. 4, 2024 18:31:00)
- ametrine_
-
Scratcher
1000+ posts
Turning variables into text
if you want to test out the scratchblocks plugin please do it in this topicChange d v d <♤>
- the_BOIH
-
Scratcher
35 posts
Turning variables into text
Thank you so much this will really help my game look more polished for when I submit it, I will also credit you for being such a great help.
- ametrine_
-
Scratcher
1000+ posts
Turning variables into text
Thank you so much this will really help my game look more polished for when I submit it, I will also credit you for being such a great help.you're welcome!
- the_BOIH
-
Scratcher
35 posts
Turning variables into text
ametrine_ I need some more help. I don’t know why this is happening but when counting up the display counts 1-2-3-4-5-7-6-8-9 instead of 1-2-3-4-5-6-7-8-9. If you can help that would be greatly appreciated. I will still try to troubleshoot the problem until you can find a solution.
Never mind I found the problem, my 6 costume was named 7 and 7 named 6. Now I’ve named them accordingly and it’s fixed.
Never mind I found the problem, my 6 costume was named 7 and 7 named 6. Now I’ve named them accordingly and it’s fixed.
Last edited by the_BOIH (Nov. 5, 2024 16:27:51)
- ametrine_
-
Scratcher
1000+ posts
Turning variables into text
ametrine_ I need some more help. I don’t know why this is happening but when counting up the display counts 1-2-3-4-5-7-6-8-9 instead of 1-2-3-4-5-6-7-8-9. If you can help that would be greatly appreciated. I will still try to troubleshoot the problem until you can find a solution.the costume names for the numbers 6 and 7 are swapped, changing those back should work
also, right click the Render block and check the box that says “run without screen refresh” if you want the numbers to appear all at once
- Royalrubble15
-
Scratcher
43 posts
Turning variables into text
0-1-2-3-4-5-6-7-8-9 should work
the erase all/stamp blocks are part of the pen extension
also, make sure you check the “run without screen refresh” option when creating the block, that make the code inside it run all at once
well, my thing keeps saying “0” at the top, even if i had “run screen without refresh”. I know my score is changing, but the number isn't.
- Discussion Forums
- » Help with Scripts
-
» Turning variables into text