# Advanced Help fast. Variables with if, else action

**URL:** https://forum.kirupa.com/t/advanced-help-fast-variables-with-if-else-action/3378
**Category:** programming
**Created:** [March 27, 2001, 8:34pm UTC](https://forum.kirupa.com/t/advanced-help-fast-variables-with-if-else-action/3378 "2001-03-27T20:34:50Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 27, 2001, 8:34pm UTC](https://forum.kirupa.com/t/advanced-help-fast-variables-with-if-else-action/3378/1 "2001-03-27T20:34:50Z")

</div>

Hey yall  
I need some help, Here’s my prob.  
I am making a game. Its a shooting game. Here are my materials: score(dynamic Text box)  
ammo(dynamic text box)  
Now when you shoot one of the little creatures, i want to take one off of ammo, ( which will start off at 4) and add one to score, BUT if you don’t have ammo, you can’t add one to the score. Here’s what i tried,on (press) {  
if (ammo!=0) {  
tellTarget ("/") {  
ammo = ammo-1; // subtracting the ammo  
}  
}  
}  
on (press) {  
if (ammo!=0) {  
gotoAndPlay (2); // thats the blow up effect, if hit  
tellTarget ("/") {  
score = score1; // adding the score  
}  
if (ammo=0) {  
gotoAndPlay (1);  
}  
}  
}  
the if (ammo=0) gotoandPlay (1); is that it just keeps going if you dont have ammo.  
now this is what it does. IT takes away one of the ammo, and it adds one to the score, but when the ammo gets to 0 . It wont stop going down, and it wont stop  
adding a score. What did i do wrong? everything worked until i added the ammo. Help me Kirupa, or users!

Krautammi

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 28, 2001, 1:24am UTC](https://forum.kirupa.com/t/advanced-help-fast-variables-with-if-else-action/3378/2 "2001-03-28T01:24:51Z")

</div>

Hello Krautammi,  
I’m sorry, but I don’t know what the problem might be. I’m still trying to learn ActionScript, and I’m not that good with it yet. Try posting at Flashkit’s ActionScript forum. The URL is: [board.flashkit.com/board/…forumid=30](http://board.flashkit.com/board/forumdisplay.php?forumid=30)
