Discuss Scratch

itsoutchy
Scratcher
29 posts

How can I make a block loop through the stack inside of it?

I'm trying to make a c block where it would loop through all contents if the boolean provided is true, but I'm stumped on how It would run the stack inside of it.

It will be a recreation of the forever if block:
forever if <> :: extension
...
end
Already added a while loop like this:
// "BOOLEAN" is the condition here.
while (true) {
        if (args.BOOLEAN == true) {
            return 1;
        }
    }
If you want to see the current behaviour of it go to this url.
Any help will be appreciated

Last edited by itsoutchy (July 27, 2023 10:48:54)


———————————————————————————————————————————————————
my website | fake window experiment | html helper
———————————————————————————————————————————————————
hi! im a guy trying to get a career in game development/programming
define itsoutchy(i have made lots of games and projects)
tell [reader v] [i am willing to help people make games] :: sensing
tell [reader v] [because teamwork makes the dream work!] :: sensing
forever
tell [reader v] [have fun!] :: sensing
end
ask [have you read my signature?] and wait
if <(answer)=[yes]> then
tell [reader v] [thank you] :: sensing
tell [reader v] [i hope your projects go well!] :: sensing
end

ask [can you look at my stuff?] and wait
forever if <(answer)=[yes]> :: control
tell [reader v] [thanks!] :: sensing
end

when [reader v] answers :: control hat
forever if <[reader v] says [i like this profile v]> :: control
print [yay] :: sensing
play video [credits v] and wait :: sensing
show message box [enjoy!]
end

function [show message box] (input) :: hat
get library[system v] :: control
do function [message box v] from library [system v] with parameters [message v] as (input) :: control





NeonG4
Scratcher
1000+ posts

How can I make a block loop through the stack inside of it?

itsoutchy wrote:

I'm trying to make a c block where it would loop through all contents if the boolean provided is true, but I'm stumped on how It would run the stack inside of it.

It will be a recreation of the forever if block:
forever if <> :: extension
...
end
Already added a while loop like this:
// "BOOLEAN" is the condition here.
while (true) {
        if (args.BOOLEAN == true) {
            return 1;
        }
    }
If you want to see the current behaviour of it go to this url.
Any help will be appreciated
repeat until <not <thing :: grey>>
stuff :: grey
end
this should have the same behaviors

Visit my shop!
Be high contrast
Hi! I'm NeonG4! I help on the HWS forum, create lame projects, and give advice.
My advice: Read this => https://en.scratch-wiki.info/wiki/User:Jvvg/Essays/Some_thoughts_on_the_forums
ROYGBIV (Rainbow text)



Sigs can go on for a while lol


Hi
when green flag clicked
set [move (10) steps] to [10]
think [move (10) steps]



Golly gee, what if I say something important like: I'm making minecraft in scratch! Follow me or I'll steal your ovens' fans' cabinets' glass. Or just a glass from your cabinet next to your oven fan. Do ovens have fans? Maybe its a stove fan, idk.






















































































]

Generation 3: The first time you see this, copy and paste it on top of your signature in the Scratch forums, and increase the generation by 1. Social experiment.

Never gonna give you up, never gonna let you down.
You didn't learn.
Spentiline
Scratcher
100+ posts

How can I make a block loop through the stack inside of it?

You can do this:
define function
forever
if <bool :: grey> then
set [output v] to (1)
stop [this script v]
end
end

comment “a” on my profile

Powered by DjangoBB