# Varible problem when adding

**URL:** <https://forum.kirupa.com/t/varible-problem-when-adding/200603>\
**Category:** Uncategorized\
**Created:** [September 13, 2006, 4:27pm UTC](https://forum.kirupa.com/t/varible-problem-when-adding/200603 "2006-09-13T16:27:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Drexegar](https://avatars.discourse-cdn.com/v4/letter/d/5daacb/32.png) [@Drexegar](https://forum.kirupa.com/u/Drexegar)\
**Post date:** [September 13, 2006, 4:27pm UTC](https://forum.kirupa.com/t/varible-problem-when-adding/200603/1 "2006-09-13T16:27:00Z")

</div>

Hey guys whats up this is a problem that would help a lot of people since it happens frequently

When I making a tetris game and everything done excpect I have a problem adding vaules to the score when I use this code…

The name of the varible is score  
[COLOR=Red]  
\_parent.scores = \_parent.scores - 500

[COLOR=Black][COLOR=Blue]I get “-500”, then “-1000”, then “-1500”[/COLOR]

sound correct right?

but when I use this code:  
[/COLOR]  
[/COLOR][COLOR=Red]\_parent.scores = \_parent.scores + 500  
[COLOR=Blue]  
I get “500”, “500500”, “500500500”[/COLOR]

[COLOR=Black]This code is in a onclip handler so when something collides it triggers this code to run, on a button it will work fine and add. \>\_\<  
So does anybody know if there is a way to fix this problem or force flash to reconize Im adding numbers?

For now Im using the work around solution, I put the score on -1000000 hide the “-1” give the illusion your actually getting points but I want to add high scores to my server so I must find a way out of this glitch. Here’s how the code looks like too if your wondering.

if(\_parent.b001.box and  
\_parent.b002.box and  
\_parent.b003.box and  
\_parent.b004.box and  
\_parent.b005.box and  
\_parent.b006.box and  
\_parent.b007.box and  
\_parent.b008.box and  
\_parent.b009.box and \_parent.b010.box.hitTest(this.lcq)){this.play();\_parent.lineu++;\_parent.lines++;  
if(\_parent.lineu==1){\_parent.scores=\_parent.scores-100;\_root.gotoAndPlay(8)};  
if(\_parent.lineu==2){\_parent.scores=\_parent.scores-300;\_root.gotoAndPlay(6)};  
if(\_parent.lineu==3){\_parent.scores=\_parent.scores-500;\_root.gotoAndPlay(4)};  
if(\_parent.lineu==4){\_parent.scores=\_parent.scores-1600;\_root.gotoAndPlay(2)};}

Dont worry about missing spaces I formated the code so it readable here so I’m 100% sure I have all spaces in the code. What happens here "Icq is a box that reads when 10 blocks touch each other (which is when you make a line in tetris) and from at the end starts adding the points. I showing the code because maybe since this is on a onclip event and not an on press event (which the adding did work on a button) maybe that has to do with the glitch.

I apoligize in the future if this has been solved already in another post I couldnt find it anywhere.

Thank you for your time.

Oh yeah and if your thinking about it, no, this game is not ripped from a tutorial I start it from scratch running on nothing but movieclips and varibles and hittest.[/COLOR][/COLOR]
