|
Page 1 of 1
|
[ 12 posts ] |
|
Stupid Timer and Something else
Author |
Message |
Mind
Joined: Thu Mar 06, 2008 10:54 pm Posts: 1360 Location: USA
|
Stupid Timer and Something else
Yeah.... i know this is kinda pointless, but i can never get a timer to work, and this doesnt work either: (the hitsmos and getshitbymos works though) Code: function Create(self) self.Timer = Timer(); self.SomeTime = 3000; end
function Update(self) for actor in MovableMan.Actors do if actor.Team == self.Team and actor.GetsHitByMOs == true then actor.GetsHitByMOs = false if actor.Team == self.Team and actor.HitsMOs == true then actor.HitsMOs = false if self.Timer:IsPastSimMS(self.SomeTime) then actor:GibThis() if self.Timer:IsPastSimMS(self.SomeTime) then actor:GibThis() end end end end end end Help? Edit: Also, i can't figure out where to put the coordinates in "attachemitter" like this: Code: function Update(self) for actor in MovableMan.Actors do if self.SomeTime == 3000 then actor:AttachEmitter("Shell Smoking"(0,0)) end end end As in what symbols to put around the ordered pair. Thanks again! P.S.( i have self.SomeTime = 3000 at beginning of code in create)
|
Thu May 28, 2009 6:56 pm |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: Stupid Timer and Something else
1. Holy ♥♥♥♥ bro did you like MISS A ♥♥♥♥ LESSON on syntax?
Jesus CHRIST.
You cannot do IF IF IF IF END END END END unless you are actually nesting all of those statements. As you're obviously not, what the ♥♥♥♥ are you doing bro?
IF THEN BLOCK END IF THEN BLOCK END IF THEN BLOCK END
2. Use IsPastRealMS(3000). I can guarantee it to work just fine and sometimes using variables as function arguments is wonky.
3. I don't think AttachEmitter works; seeing as it's getting into attachable code that we can't use. Set the position of the emitter relative to the actor on creation and then update it manually per frame.
|
Fri May 29, 2009 4:02 am |
|
|
Lord Tim
Joined: Fri Apr 27, 2007 4:55 pm Posts: 1178 Location: America!
|
Re: Stupid Timer and Something else
Grif wrote: 2. Use IsPastRealMS(3000). I can guarantee it to work just fine and sometimes using variables as function arguments is wonky. Except that it is better to use a variable, since it works just as well, and better if he were to change the value. Then it wouldn't have to be changed in multiple places.
|
Fri May 29, 2009 5:14 am |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: Stupid Timer and Something else
Except that referring to variables in function arguments can be wonky; see: what I said.
It's better to do it, overall, but it's hardly necessary.
|
Fri May 29, 2009 6:09 am |
|
|
Mind
Joined: Thu Mar 06, 2008 10:54 pm Posts: 1360 Location: USA
|
Re: Stupid Timer and Something else
K, thanks grif. So i only need one "end" under all the "ifs" ? Let me get this straight: you only have one end for each nested statement
|
Fri May 29, 2009 6:10 pm |
|
|
Ultric
Joined: Thu Jul 10, 2008 6:23 pm Posts: 301 Location: Lurking somewhere around here...
|
Re: Stupid Timer and Something else
The Mind wrote: K, thanks grif. So i only need one "end" under all the "ifs" ? Let me get this straight: you only have one end for each nested statement What he means is, you have the equivalent of: Code: function Create(self) self.Timer = Timer(); self.SomeTime = 3000; end
function Update(self) for actor in MovableMan.Actors do if actor.Team == self.Team and actor.GetsHitByMOs == true then actor.GetsHitByMOs = false if actor.Team == self.Team and actor.HitsMOs == true then actor.HitsMOs = false if self.Timer:IsPastSimMS(self.SomeTime) then actor:GibThis() if self.Timer:IsPastSimMS(self.SomeTime) then actor:GibThis() end end end end end end That would be senseless, as you have to meet one condition to even test the rest, and by then, the object is dead. What you want is: Code: function Create(self) self.Timer = Timer(); self.SomeTime = 3000; end
function Update(self) for actor in MovableMan.Actors do if actor.Team == self.Team and actor.GetsHitByMOs == true then actor.GetsHitByMOs = false else if actor.Team == self.Team and actor.HitsMOs == true then actor.HitsMOs = false else if self.Timer:IsPastSimMS(self.SomeTime) then actor:GibThis() else if self.Timer:IsPastSimMS(self.SomeTime) then actor:GibThis() end end
|
Fri May 29, 2009 6:55 pm |
|
|
Mind
Joined: Thu Mar 06, 2008 10:54 pm Posts: 1360 Location: USA
|
Re: Stupid Timer and Something else
Ultric wrote: The Mind wrote: K, thanks grif. So i only need one "end" under all the "ifs" ? Let me get this straight: you only have one end for each nested statement What he means is, you have the equivalent of: Code: function Create(self) self.Timer = Timer(); self.SomeTime = 3000; end
function Update(self) for actor in MovableMan.Actors do if actor.Team == self.Team and actor.GetsHitByMOs == true then actor.GetsHitByMOs = false if actor.Team == self.Team and actor.HitsMOs == true then actor.HitsMOs = false if self.Timer:IsPastSimMS(self.SomeTime) then actor:GibThis() if self.Timer:IsPastSimMS(self.SomeTime) then actor:GibThis() end end end end end end That would be senseless, as you have to meet one condition to even test the rest, and by then, the object is dead. What you want is: Code: function Create(self) self.Timer = Timer(); self.SomeTime = 3000; end
function Update(self) for actor in MovableMan.Actors do if actor.Team == self.Team and actor.GetsHitByMOs == true then actor.GetsHitByMOs = false else if actor.Team == self.Team and actor.HitsMOs == true then actor.HitsMOs = false else if self.Timer:IsPastSimMS(self.SomeTime) then actor:GibThis() else if self.Timer:IsPastSimMS(self.SomeTime) then actor:GibThis() end end I thought "else" would mean otherwise, but it means also? Edit:This doesnt work still. Any ideas? Code: function Create(self) self.Timer = Timer(); self.SomeTime = 3000; end
function Update(self) for actor in MovableMan.Actors do if actor.Team == self.Team and actor.GetsHitByMOs == true then actor.GetsHitByMOs = false elseif actor.Team == self.Team and actor.HitsMOs == true then actor.HitsMOs = false elseif self.Timer:IsPastSimMS(self.SomeTime) then actor:GibThis() elseif self.Timer:IsPastSimMS(self.SomeTime) then actor:GibThis() end end end
|
Fri May 29, 2009 8:14 pm |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: Stupid Timer and Something else
RAAKJSDFLKAJDSF;LAKDJF
OKAY SO LOGIC 102 (SINCE YOU ALREADY GOT 101 BUT JUST SLEPT THROUGH THE CLASS)
IF THEN ELSE END
IF <CHECK> THEN <DO SOMETHING> ELSE <DO SOMETHING ELSE> END If something is true, for example, then set something else to true. ELSE, aka WHEN SOMETHING IS NOT TRUE, set something else, to, say, false.
IF THEN ELSEIF ELSE END
IF <CHECK> THEN <DO SOMETHING> ELSEIF <CHECK> THEN <DO SOMETHING ELSE> ELSE <DO SOMETHING ELSE ENTIRELY> END If check 1 is true then do something. If check 1 is false, then check if something else is true, and then do something. If neither are true, then do something else entirely.
Also, it's elseif.
|
Sat May 30, 2009 1:13 am |
|
|
Mind
Joined: Thu Mar 06, 2008 10:54 pm Posts: 1360 Location: USA
|
Re: Stupid Timer and Something else
Grif wrote: RAAKJSDFLKAJDSF;LAKDJF
OKAY SO LOGIC 102 (SINCE YOU ALREADY GOT 101 BUT JUST SLEPT THROUGH THE CLASS)
IF THEN ELSE END
IF <CHECK> THEN <DO SOMETHING> ELSE <DO SOMETHING ELSE> END If something is true, for example, then set something else to true. ELSE, aka WHEN SOMETHING IS NOT TRUE, set something else, to, say, false.
IF THEN ELSEIF ELSE END
IF <CHECK> THEN <DO SOMETHING> ELSEIF <CHECK> THEN <DO SOMETHING ELSE> ELSE <DO SOMETHING ELSE ENTIRELY> END If check 1 is true then do something. If check 1 is false, then check if something else is true, and then do something. If neither are true, then do something else entirely.
Also, it's elseif. I get that. Im saying 'is it possible to have 4 completely different "if" statements in one box taht are not related to each other?'
|
Sat May 30, 2009 4:45 am |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: Stupid Timer and Something else
...
♥♥♥♥ christ
if they are not related to each other you do not want them together
if actor.Team == self.Team and actor.GetsHitByMOs == true then actor.GetsHitByMOs = false end if actor.Team == self.Team and actor.HitsMOs == true then actor.HitsMOs = false end if self.Timer:IsPastSimMS(self.SomeTime) then actor:GibThis() end if self.Timer:IsPastSimMS(self.SomeTime) then actor:GibThis() end
|
Sat May 30, 2009 5:06 am |
|
|
Mind
Joined: Thu Mar 06, 2008 10:54 pm Posts: 1360 Location: USA
|
Re: Stupid Timer and Something else
Grif wrote: ...
fudge christ
if they are not related to each other you do not want them together
if actor.Team == self.Team and actor.GetsHitByMOs == true then actor.GetsHitByMOs = false end if actor.Team == self.Team and actor.HitsMOs == true then actor.HitsMOs = false end if self.Timer:IsPastSimMS(self.SomeTime) then actor:GibThis() end if self.Timer:IsPastSimMS(self.SomeTime) then actor:GibThis() end Yeah............just kinda saw that in numgun's ionizer, and was about to do that. Woops. Well thanks for the lessons Edit: still doesnt work Code: function Create(self) self.Timer = Timer(); self.SomeTime = 3000; end
function Update(self) for actor in MovableMan.Actors do if actor.Team == self.Team and actor.GetsHitByMOs == true then actor.GetsHitByMOs = false end if actor.Team == self.Team and actor.HitsMOs == true then actor.HitsMOs = false end if self.Timer:IsPastRealMS(self.SomeTime) then actor:GibThis() end end end as in the actor wont gib after 3 seconds, even if it is on your team.
|
Sat May 30, 2009 5:08 am |
|
|
Mind
Joined: Thu Mar 06, 2008 10:54 pm Posts: 1360 Location: USA
|
Re: Stupid Timer and Something else
Anyone able to help on this?
|
Sat May 30, 2009 7:56 pm |
|
|
|
|
Page 1 of 1
|
[ 12 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
|
|