View unanswered posts | View active topics It is currently Thu Dec 26, 2024 6:14 pm



Reply to topic  [ 3 posts ] 
 My (Quite) Simple Script Won't Work. 
Author Message
User avatar

Joined: Sun Feb 17, 2008 11:21 am
Posts: 54
Reply with quote
Post 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


Thu Aug 13, 2009 3:38 pm
Profile
User avatar

Joined: Mon Jun 30, 2008 9:13 pm
Posts: 499
Location: Finland
Reply with quote
Post Re: My (Quite) Simple Script Won't Work.
In if statements "=" needs to be "=="


Thu Aug 13, 2009 4:15 pm
Profile
User avatar

Joined: Sun Feb 17, 2008 11:21 am
Posts: 54
Reply with quote
Post Re: My (Quite) Simple Script Won't Work.
Holy hell, I can't believe I forgot that. Thanks.


Thu Aug 13, 2009 4:17 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.148s | 13 Queries | GZIP : Off ]