Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How do I make a variable increase when one variable is increased to a non-certain amount? (the variable should be able to go to infinity)
- 23arubin
-
Scratcher
16 posts
How do I make a variable increase when one variable is increased to a non-certain amount? (the variable should be able to go to infinity)
Hey, I'm making a program where you eat stuff to get points. I'm going to make it so that you can level up. What i'm trying to do is make it so that every time you get one hundred points, you level up, but I want there to be infinite amount of levels.
I don't want it like this:
Thanks, and please write if you know the answer! I will give you a lot of credit in the project when I share it.
I don't want it like this:
if <(score) = [100 ]> thenEtc.
change [level v] by (1)
end
if <(score) = [200 ]> then
change [level v] by (1)
end
if <(score) = [300 ]> then
change [level v] by (1)
end
Thanks, and please write if you know the answer! I will give you a lot of credit in the project when I share it.
- deck26
-
Scratcher
1000+ posts
How do I make a variable increase when one variable is increased to a non-certain amount? (the variable should be able to go to infinity)
Set a variable to the score to be exceeded to reach the next level. Each time you reach/exceed the value change the level and set the next limit.
Can you get your duplicate topic closed please.
Can you get your duplicate topic closed please.
- jokebookservice1
-
Scratcher
1000+ posts
How do I make a variable increase when one variable is increased to a non-certain amount? (the variable should be able to go to infinity)
forever
if <((score) mod (100)) = [0]> then
change [level v] by (1)
wait until <not <((score) mod (100)) = [0]>> //S that it desn't continue changing the level forever
end
end
- 23arubin
-
Scratcher
16 posts
How do I make a variable increase when one variable is increased to a non-certain amount? (the variable should be able to go to infinity)
Sorry I dont know how to close it. Also I have no idea what you are talking about.
- jokebookservice1
-
Scratcher
1000+ posts
How do I make a variable increase when one variable is increased to a non-certain amount? (the variable should be able to go to infinity)
See my post on your duplicate topic
- 23arubin
-
Scratcher
16 posts
How do I make a variable increase when one variable is increased to a non-certain amount? (the variable should be able to go to infinity)
IM SORRY THE DUPLICATE WAS AN ACCIDENT
Also, I want it to be able to be increased whenever they get 100 points, not get to a certain level and then stop earning them. I will try this, and if it works I will tell you. Thanks.
Also, I want it to be able to be increased whenever they get 100 points, not get to a certain level and then stop earning them. I will try this, and if it works I will tell you. Thanks.

- deck26
-
Scratcher
1000+ posts
How do I make a variable increase when one variable is increased to a non-certain amount? (the variable should be able to go to infinity)
set [current-limit v] to [99
set [level v] to [1]
forever
wait until <(score) > (current-limit) >
change [level v] by [1]
change [current-limit v] by [100]
end
If you click on Report in one of the posts you could ask for the duplicate topics to be merged into one.
- 23arubin
-
Scratcher
16 posts
How do I make a variable increase when one variable is increased to a non-certain amount? (the variable should be able to go to infinity)
ok
- 23arubin
-
Scratcher
16 posts
How do I make a variable increase when one variable is increased to a non-certain amount? (the variable should be able to go to infinity)
jokebookservice1 I tried that it gave me way more than one level. Maybe you typed it wrong, and maybe I put it in wrong. Thanks for trying
- deck26
-
Scratcher
1000+ posts
How do I make a variable increase when one variable is increased to a non-certain amount? (the variable should be able to go to infinity)
jokebookservice1 I tried that it gave me way more than one level. Maybe you typed it wrong, and maybe I put it in wrong. Thanks for tryingWhat they gave you should have worked. Share the project so we can see what you missed.
- 23arubin
-
Scratcher
16 posts
How do I make a variable increase when one variable is increased to a non-certain amount? (the variable should be able to go to infinity)
Ok. I deleted what you guys told me to put in, and it still didn't work, so I will add it back in and share. I will unshare it once you debug.
if <the program works> then
say [YAAAY! THANKS BRO!]
end
- deck26
-
Scratcher
1000+ posts
How do I make a variable increase when one variable is increased to a non-certain amount? (the variable should be able to go to infinity)
If you share it and tell us which project it is (and preferably which sprite) we can have a look.
- Bluestar601
-
Scratcher
97 posts
How do I make a variable increase when one variable is increased to a non-certain amount? (the variable should be able to go to infinity)
Hey, I'm making a program where you eat stuff to get points. I'm going to make it so that you can level up. What i'm trying to do is make it so that every time you get one hundred points, you level up, but I want there to be infinite amount of levels.um…………i think this might work. i had a similar problem.
I don't want it like this:if <(score) = [100 ]> thenEtc.
change [level v] by (1)
end
if <(score) = [200 ]> then
change [level v] by (1)
end
if <(score) = [300 ]> then
change [level v] by (1)
end
Thanks, and please write if you know the answer! I will give you a lot of credit in the project when I share it.
when green flag clickedhope it helped!
set (max v) to [100]
forever
if (((score)=(max))or((score)>(max))) then
change (max v) by [100]
change (level v) by [1]
end
end
- 23arubin
-
Scratcher
16 posts
How do I make a variable increase when one variable is increased to a non-certain amount? (the variable should be able to go to infinity)
Hey, I'm making a program where you eat stuff to get points. I'm going to make it so that you can level up. What i'm trying to do is make it so that every time you get one hundred points, you level up, but I want there to be infinite amount of levels.um…………i think this might work. i had a similar problem.
I don't want it like this:if <(score) = [100 ]> thenEtc.
change [level v] by (1)
end
if <(score) = [200 ]> then
change [level v] by (1)
end
if <(score) = [300 ]> then
change [level v] by (1)
end
Thanks, and please write if you know the answer! I will give you a lot of credit in the project when I share it.when green flag clickedhope it helped!
set (max v) to [100]
forever
if (((score)=(max))or((score)>(max))) then
change (max v) by [100]
change (level v) by [1]
end
end
Thanks, I will try it this weekend.
- 23arubin
-
Scratcher
16 posts
How do I make a variable increase when one variable is increased to a non-certain amount? (the variable should be able to go to infinity)
Thanks! It worked! I may post more about the other bugs in this program, so please look at those!Hey, I'm making a program where you eat stuff to get points. I'm going to make it so that you can level up. What i'm trying to do is make it so that every time you get one hundred points, you level up, but I want there to be infinite amount of levels.um…………i think this might work. i had a similar problem.
I don't want it like this:if <(score) = [100 ]> thenEtc.
change [level v] by (1)
end
if <(score) = [200 ]> then
change [level v] by (1)
end
if <(score) = [300 ]> then
change [level v] by (1)
end
Thanks, and please write if you know the answer! I will give you a lot of credit in the project when I share it.when green flag clickedhope it helped!
set (max v) to [100]
forever
if (((score)=(max))or((score)>(max))) then
change (max v) by [100]
change (level v) by [1]
end
end
Thanks, I will try it this weekend.
- deck26
-
Scratcher
1000+ posts
How do I make a variable increase when one variable is increased to a non-certain amount? (the variable should be able to go to infinity)
That's the same idea as my first post but mine uses wait until to avoid the forever loop having to constantly evaluate the ‘if’ block which should make it more efficient.Thanks! It worked! I may post more about the other bugs in this program, so please look at those!Hey, I'm making a program where you eat stuff to get points. I'm going to make it so that you can level up. What i'm trying to do is make it so that every time you get one hundred points, you level up, but I want there to be infinite amount of levels.um…………i think this might work. i had a similar problem.
I don't want it like this:if <(score) = [100 ]> thenEtc.
change [level v] by (1)
end
if <(score) = [200 ]> then
change [level v] by (1)
end
if <(score) = [300 ]> then
change [level v] by (1)
end
Thanks, and please write if you know the answer! I will give you a lot of credit in the project when I share it.when green flag clickedhope it helped!
set (max v) to [100]
forever
if (((score)=(max))or((score)>(max))) then
change (max v) by [100]
change (level v) by [1]
end
end
Thanks, I will try it this weekend.
- 23arubin
-
Scratcher
16 posts
How do I make a variable increase when one variable is increased to a non-certain amount? (the variable should be able to go to infinity)
CHEE CHEE MOO MOO!That's the same idea as my first post but mine uses wait until to avoid the forever loop having to constantly evaluate the ‘if’ block which should make it more efficient.Thanks! It worked! I may post more about the other bugs in this program, so please look at those!Hey, I'm making a program where you eat stuff to get points. I'm going to make it so that you can level up. What i'm trying to do is make it so that every time you get one hundred points, you level up, but I want there to be infinite amount of levels.um…………i think this might work. i had a similar problem.
I don't want it like this:if <(score) = [100 ]> thenEtc.
change [level v] by (1)
end
if <(score) = [200 ]> then
change [level v] by (1)
end
if <(score) = [300 ]> then
change [level v] by (1)
end
Thanks, and please write if you know the answer! I will give you a lot of credit in the project when I share it.when green flag clickedhope it helped!
set (max v) to [100]
forever
if (((score)=(max))or((score)>(max))) then
change (max v) by [100]
change (level v) by [1]
end
end
Thanks, I will try it this weekend.
THANKS!
I'LL GIVE YOU SOME CREDIT!
- crazydino911
-
New Scratcher
1 post
How do I make a variable increase when one variable is increased to a non-certain amount? (the variable should be able to go to infinity)
I do have a code that if one variable is to a certain number another variable changes. When one variable exceeds one hundred the other one changes. But only if its already at one hundred and then it adds. but let's say it was at 95, and i earn another 10 point, the other variable doesn't change? Can someone plz help.
- awesome-llama
-
Scratcher
1000+ posts
How do I make a variable increase when one variable is increased to a non-certain amount? (the variable should be able to go to infinity)
I do have a code that if one variable is to a certain number another variable changes. When one variable exceeds one hundred the other one changes. But only if its already at one hundred and then it adds. but let's say it was at 95, and i earn another 10 point, the other variable doesn't change? Can someone plz help.Sounds to me like the number isn't being detected at all. When debugging projects, I like to pull apart scripts and inspect things at certain times. If you think a variable should be changing but isn't, check if that changing block is having an opportunity to run, maybe the conditions for a boolean is never met.
It's best to create your own topic about this instead. Then you can show what you have with more detail and have people able to focus on your question specifically.
- Discussion Forums
- » Help with Scripts
-
» How do I make a variable increase when one variable is increased to a non-certain amount? (the variable should be able to go to infinity)