Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Small Variable Problem
- Unoriginql
- Scratcher
5 posts
Small Variable Problem
Whenever I use my variables, something weird happens…
I'm doing a shop thing, quick project for fun, and I can't use a certain variable for a total.
When I go into my project, I look for mistakes, but it doesn't seem like there are any.
What it looks like:
and
If you don't know what I mean, here's a quick preview of my script!:
https://scratch.mit.edu/projects/128088323/#editor
I'm doing a shop thing, quick project for fun, and I can't use a certain variable for a total.
When I go into my project, I look for mistakes, but it doesn't seem like there are any.
What it looks like:
when this sprite clicked
change [Total v] by (6)
broadcast [Expensive Apple v]
and
when this sprite clicked
change [Total v] by (1)
broadcast [Cheap Banana v]
If you don't know what I mean, here's a quick preview of my script!:
https://scratch.mit.edu/projects/128088323/#editor
Last edited by Unoriginql (Oct. 28, 2016 22:30:05)
- deck26
- Scratcher
1000+ posts
Small Variable Problem
Project isn't shared. I'm off to bed (11.30 here) but you might get more help if you make sure it's shared.
- ValientLegacy
- Scratcher
100+ posts
Small Variable Problem
If you share the project I could help.
when green flag clicked
forever
say [Never give up]
say [Stay focused]
say [Stay positive]
say [Stay strong]
end
- Cuffrox
- Scratcher
44 posts
Small Variable Problem
I think I know what you mean.
Instead of having
Put,
Instead of having
change [Total] by ()
Put,
set [Total] to ((Total) + (6))
- gtoal
- Scratcher
1000+ posts
Small Variable Problem
Why would that help? I think I know what you mean.
Instead of havingchange [Total] by ()
Put,set [Total] to ((Total) + (6))
More likely there are two variables called Total, at least one of them having been declared locally to one of the sprites.
- Unoriginql
- Scratcher
5 posts
Small Variable Problem
I think I know what you mean.
Instead of havingchange [Total] by ()
Put,set [Total] to ((Total) + (6))
Wow, thank you so much, Cuffrox!
That really helped.
- deck26
- Scratcher
1000+ posts
Small Variable Problem
As @gtoal said though, there's no reason why that would help so there's something else going on.I think I know what you mean.
Instead of havingchange [Total] by ()
Put,set [Total] to ((Total) + (6))
Wow, thank you so much, Cuffrox!
That really helped.
- Unoriginql
- Scratcher
5 posts
Small Variable Problem
As @gtoal said though, there's no reason why that would help so there's something else going on.I think I know what you mean.
Instead of havingchange [Total] by ()
Put,set [Total] to ((Total) + (6))
Wow, thank you so much, Cuffrox!
That really helped.
True, true, but- One thing… Let's stop quoting over and over again.
- Discussion Forums
- » Help with Scripts
- » Small Variable Problem