ERROR


cont = GameLogic.getCurrentController()
own = cont.getOwner()
up = cont.getSensor("uproll")
down = cont.getSensor("downroll")

if up.isPositive() and own.gun = "unarmed":
   own.gun = "pistol"

if up.isPositive() and own.gun = "pistol":
   own.gun = "shotgun"

if up.isPositive() and own.gun = "shotgun":
   own.gun = "unarmed"

if down.isPositive() and own.gun = "unarmed":
   own.gun = "shotgun"

if down.isPositive() and own.gun = "shotgun":
   own.gun = "pistol"

if down.isPositive() and own.gun = "pistol":
   own.gun = "unarmed"

it keeps having a error it says

blender has caused an error in PYTHON23.DLL
blender will now close

if you continue to have problems
please restart your computer

the equality operator is ==, not =

also, you have your if statements set up wrong

if up.isPositive() the gun will be changed several times on one frame, ending up in shotgun
to pistol
then to unarmed
then shotgun

same thing is true for your down sensor

[also, importing the GameLogic module doesn’t hurt]


I think the crashing is because of a bug [fixed in cvs iirc] where syntax errors [and some others] in python scripts run in gameblender would crash blender.

iirc the assignment [=] in your if statement would cause that error

ok thank you