Help Correct my Python Script!

Hey, I’v been working on an FPS Blender Game and I’v spent hours and hours on it… but I’m stuck. I had to learn some Python(which was easy seeing as how I already knew Java) to make some scripts for my game that would control IPO’s and just actions overall. So, for my gun, it can recoil(IPO), reload(IPO), slide(For the gun I made, there’s a pump on the top of it that slides back when LMB is clicked), waste(shoots out an empty bullet catridge), and of course empty(it activates another Edit Object like the waste, but instead it’s a plain with an Alpha Image that plainly says “WARNING: EMPTY”, I want it to show empty when all ammo and clips are diminished) isFiring(is a boolean property) Ammo(is an int Property set to 15), and Clips(is also an int Property set to 5). The problem is, I don’t know enough Python to fix this code to work as I want it too. Please help, it would be much appreciated.
[COLOR=#333333][COLOR=#2E8B57]cont = GameLogic.getCurrentController()
#define sensors
firing = cont.getSensor(“fire”).isPositive()
reloaded = cont.getSensor(“reload”).isPositive()
no_firing = cont.getSensor(“nofire”).isPositive()
#define actuator
fire = cont.getActuator(“isWasting”, “Explode”, “Recoil”, “Slide”)
reload = cont.getActuator(“Reload”)
empty = cont.getActuator(“Empty”)
isFiring = #set isFiring to fire?
Ammo = getattr(cont.getOwner(), “Ammo”)
Clips = getattr(cont.getOwner(), “Clips”)
#define events…
if firing:
if Ammo < 1:
#activate empty?
if Ammo > 1:
isFiring = True
if reload:
if Clips > 0:
setattr(cont.getOwner(), “Clips”, Clips - 1)
setattr(cont.getOwner(), “Ammo”, 15)
GameLogic.addActiveActuator(#what do I put here?)

#isWasting is empty bullet cartridge that pops out when fired.
#Explode is the blast at the front of the gun
#This script is to make it where the gun stops doing all these
#actions when Ammo and Clips are at 0. But I don’t know how to
#make it work![/COLOR][/COLOR]

well DUHH, u need to define “cont” and u need to import the gamelogic

im assuming u want cont to be the controller so enter this above everything else

import GameLogic
cont = GameLogic.getCurrentController()

and if that doesnt work then check the terminal wen u run the game and check for the errors :slight_smile: