Discuss Scratch

araisfeld
New Scratcher
1 post

Getting Scratch to execute one line of code every time you click

I remember a few years back I was able to do this easily. Being able to run a single line of code with each click made it very easy to find out where the mistakes in my code were. I just started again with Scratch for the first time in several years and I can't seem to find how to do this. Was this feature removed or am I simply missing how to do this? Thank you.
ThatOneWeirdDude
Scratcher
1000+ posts

Getting Scratch to execute one line of code every time you click

You could always single out the code by moving the blocks under it and then moving that block out so you can perform a single action.
Scratch-Minion
Scratcher
1000+ posts

Getting Scratch to execute one line of code every time you click

Single Stepping was in Scratch 1.4 and has long been removed: https://en.scratch-wiki.info/wiki/Single_Stepping
TrueWolfGod21
New Scratcher
1 post

Getting Scratch to execute one line of code every time you click

Does anyone know how to make a line of code that can only be used once?
awesome-llama
Scratcher
1000+ posts

Getting Scratch to execute one line of code every time you click

TrueWolfGod21 wrote:

Does anyone know how to make a line of code that can only be used once?

Use a variable. Once the code runs, change the variable value to something else.
An if block allows you to determine if the code should run.

if <(var) = [0]> then
... // run code
set [var v] to [1] // now the above code can't run again, var is now 1.
end
The_Game_
Scratcher
1000+ posts

Getting Scratch to execute one line of code every time you click

I'm fairly certain stepping isn't a thing in base Scratch since the extension I use allows me to toggle it.
medians
Scratcher
1000+ posts

Getting Scratch to execute one line of code every time you click

TrueWolfGod21 wrote:

Does anyone know how to make a line of code that can only be used once?
This was from 3 years ago, but you can just use a variable to detect if it has been ran, like here:

The_Game_ wrote:

I'm fairly certain stepping isn't a thing in base Scratch since the extension I use allows me to toggle it.
It was, but it got replaced with Turbo Mode.

Last edited by medians (March 30, 2023 01:25:21)

The_Game_
Scratcher
1000+ posts

Getting Scratch to execute one line of code every time you click

medians wrote:

TrueWolfGod21 wrote:

Does anyone know how to make a line of code that can only be used once?
This was from 3 years ago, but you can just use a variable to detect if it has been ran, like here:
Oh, * didn't realise. Saw the 202 and assumed it was today. Oops.
wer65hertg
Scratcher
1000+ posts

Getting Scratch to execute one line of code every time you click

TrueWolfGod21 wrote:

Does anyone know how to make a line of code that can only be used once?
Do not necropost. Make a new thread instead.

Powered by DjangoBB