Data Realms Fan Forums
http://45.55.195.193/

My (Quite) Simple Script Won't Work.
http://45.55.195.193/viewtopic.php?f=73&t=16202
Page 1 of 1

Author:  xerxys [ Thu Aug 13, 2009 3:38 pm ]
Post subject:  My (Quite) Simple Script Won't Work.

I can't get these two simple scripts to work. The error they give is confusing, it says "then" expected near "=" on line 9/8

The first is attached to an emitter called "Smasher Grenade Shot Active Tracer" It is created first.

Code:
function Create(self)
SmashDist = 60
print("A")

end

function Update(self)
   for particle in MovableMan.Particles do
      if particle.PresetName = ("Smasher Grenade Shot Active") then
         local Twin = particle
      end
      
      if MovableMan:IsParticle("Twin") then
         for actor in MovableMan.Actors do
            if (self.Pos - actor.Pos).Magnitude < SmashDist then
               print("ActorDetected A")
            end
         end
         if (self.Pos - particle.Pos).Magnitude < SmashDist and particle.PresetName ~= "Smasher Grenade Shot Active" and particle.PresetName ~= "Smasher Grenade Shot Active Tracer" then
            print("ParticleDetected A")
         end
      else
         print("NoTwin")
      end
   end
end


The second is created a random amount of time later. It is another AEmitter that is called "Smasher Grenade Shot Active"

Code:
function Create(self)
print("B")

end

function Update(self)
   for particle in MovableMan.Particles do
      if particle.PresetName = ("Smasher Grenade Shot Active Tracer") then
         local Twin = particle
      end
      
      if MovableMan:IsParticle("Twin") then
         for actor in MovableMan.Actors do
            if (self.Pos - actor.Pos).Magnitude < SmashDist then
               print("ActorDetected B")
            end
         end
         if (self.Pos - particle.Pos).Magnitude < SmashDist and particle.PresetName ~= "Smasher Grenade Shot Active" and particle.PresetName ~= "Smasher Grenade Shot Active Tracer" then
            print("ParticleDetected B")
         end
      else
         print("NoTwin")
      end
   end
end


Thanks

Author:  piipu [ Thu Aug 13, 2009 4:15 pm ]
Post subject:  Re: My (Quite) Simple Script Won't Work.

In if statements "=" needs to be "=="

Author:  xerxys [ Thu Aug 13, 2009 4:17 pm ]
Post subject:  Re: My (Quite) Simple Script Won't Work.

Holy hell, I can't believe I forgot that. Thanks.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/