Discuss Scratch

JustAContentCreator
Scratcher
33 posts

Set the part of a variable to a certain number

Im trying to make a minecraft game that saves, but the limit of cloud variables is ten,
I know there's a way to make code where it set's the first part of SEED (Variable) to the block's costume number.
And then if 1st letter of SEED is 1, set costume number to 1.
But how do i make it so it only changes the first part of the Variable to that certain costume number. also it may
Well there over 10 costumes so it need to set the first part to the costume number. so this it what it will be like:

Set (number) letter Of (variable) to (costume number)
Or
Set (number) letter Of (variable) to (Number)

Thanks i hope i find an answer to this, i found something on it, but i don't think it will be compatible with the way i want to do it.

Last edited by JustAContentCreator (Dec. 15, 2021 20:38:08)

LG125
Scratcher
500+ posts

Set the part of a variable to a certain number

delete all of [seed modifier v]
set [i v] to [0]
repeat until <(length of (seed)) = ((i) + (1))> //this script separates every letter into different items in a list
add (letter (i) of (seed)) to [seed modifier v]
change [i v] by (1)
end
replace item (number ::grey) of [seed modifier v] with (thing you want ::grey)
set [Seed v] to [] //blank
set [i v] to [0]
repeat (length of [Seed modifier v] :: list)
change [i v] by (1)
set [Seed v] to (join (seed) (item (i) of [seed modifier v] :: list)
end

Should work? Might be missing something.

Last edited by LG125 (Dec. 15, 2021 22:09:47)




JustAContentCreator
Scratcher
33 posts

Set the part of a variable to a certain number

Thanks! can i haven't tested it yet! but im putting it in now.
Can you make it so it sets costume number two the first two letters.
FULL EXPLANATION OF HOW I WANT IT TO WORK
So you can change the sprite, then it always changes the first(or any number) Two letters of seed (the cloud variable)
to the costume number. then next time you play it when you click green flag it takes the first(or any number) two letters of seed and sets it to the costume number so it saves!


Does it still work they way i want it to work.

Also i have to make a list called seed modifier and a variable called I?
THANKS
when green flag clicked
say [Thanks So Much!] for (2) secs

EDIT:
All i need is just to save the costume number on one cloud variable.

Last edited by JustAContentCreator (Dec. 16, 2021 18:30:50)

JustAContentCreator
Scratcher
33 posts

Set the part of a variable to a certain number

I dont think it works
helloworldbyeworld
Scratcher
1000+ posts

Set the part of a variable to a certain number

JustAContentCreator wrote:

Thanks! can i haven't tested it yet! but im putting it in now.
Can you make it so it sets costume number two the first two letters.
FULL EXPLANATION OF HOW I WANT IT TO WORK
So you can change the sprite, then it always changes the first(or any number) Two letters of seed (the cloud variable)
to the costume number. then next time you play it when you click green flag it takes the first(or any number) two letters of seed and sets it to the costume number so it saves!


Does it still work they way i want it to work.

Also i have to make a list called seed modifier and a variable called I?
THANKS
when green flag clicked
say [Thanks So Much!] for (2) secs

EDIT:
All i need is just to save the costume number on one cloud variable.
Then you could just use this script:

set [☁ your cloud variable v] to (costume #)

Helloworldbyeworld | 1200+ posts
Have a great day
JustAContentCreator
Scratcher
33 posts

Set the part of a variable to a certain number

Hey also is there a way where i can save lists?
helloworldbyeworld
Scratcher
1000+ posts

Set the part of a variable to a certain number

JustAContentCreator wrote:

Hey also is there a way where i can save lists?
If you mean cloud lists, check out this Wiki tutorial for a username cloud list:

https://en.scratch-wiki.info/wiki/Simple_Username_Cloud_List

Just replace the username with what you want to save.

Helloworldbyeworld | 1200+ posts
Have a great day

Powered by DjangoBB