This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-06-12 23:55:06

urhungry
Scratcher
Registered: 2009-07-03
Posts: 1000+

Help on recalculating a variable

Hello everyone. It's been quite a while since I posted a topic here. Anyway, I am making a Scratch Stock Market simulation that can be found here. All is going well, except I have a variable that displays the total value of all of the stocks that the player owns. It is initially updated when the player first buys a stock, but I need it to also update every time the stock values change. Playing/downloading the project should kind of clear things up for those of you who are not understanding what I am saying. Anyway, any help provided would be much appreciated. Thanks!

Offline

 

#2 2011-06-13 00:26:20

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: Help on recalculating a variable

Why don't you just attach the variable calculations to a "When I Receive" and then send out a broadcast whenever you need it changed?


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#3 2011-06-13 01:41:14

urhungry
Scratcher
Registered: 2009-07-03
Posts: 1000+

Re: Help on recalculating a variable

Oh yes, that could work. I was trying for one sprite one script, but it really doesn't matter.

Offline

 

#4 2011-06-13 17:01:08

Kileymeister
Scratcher
Registered: 2008-04-17
Posts: 1000+

Re: Help on recalculating a variable

You could just have it constantly resetting itself every frame.  That would work, would it not?

May not help the run speed though.

Last edited by Kileymeister (2011-06-13 17:14:51)


I'm back, and showcasing two new* projects!  Click left or right on the image below to see!
http://img109.imageshack.us/img109/7905/part1l.pnghttp://img859.imageshack.us/img859/6417/part2bf.png

Offline

 

Board footer