Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I update a score mathematically? HELP!!!!

Status
Not open for further replies.

m1keyby

Technical User
May 11, 2001
1
US
I'm making a presentation where I click on a button and on each click it adds a value of 1 to a score.
ex: press button, 1 gets added to a score box...press button again and 1 more gets added to read 2 etc.
Then I need to do the same thing but subtract 1.
Any suggestions?
 
You can use a global variable to store the current score and update it (and your score box)
to do this,add this event your your AddButton script

on mouseUp
global gScore
gScore=gScore+1
member("yourScoreBoxName").text = string(gScore)
end

but remember to give gScore an initial value.

If you don't need to keep track of the score, you can simply use:

on mouseUp
member("yourScoreBoxName").text=string(integer(member("yourScoreBoxName").text)+1)
end
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top