Data Realms Fan Forums http://45.55.195.193/ |
|
Stupid Timer and Something else http://45.55.195.193/viewtopic.php?f=73&t=15030 |
Page 1 of 1 |
Author: | Mind [ Thu May 28, 2009 6:56 pm ] |
Post subject: | 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) |
Author: | Grif [ Fri May 29, 2009 4:02 am ] |
Post subject: | 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. |
Author: | Lord Tim [ Fri May 29, 2009 5:14 am ] |
Post subject: | 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. |
Author: | Grif [ Fri May 29, 2009 6:09 am ] |
Post subject: | 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. |
Author: | Mind [ Fri May 29, 2009 6:10 pm ] |
Post subject: | 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 |
Author: | Ultric [ Fri May 29, 2009 6:55 pm ] |
Post subject: | 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 |
Author: | Mind [ Fri May 29, 2009 8:14 pm ] |
Post subject: | 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 |
Author: | Grif [ Sat May 30, 2009 1:13 am ] |
Post subject: | 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. |
Author: | Mind [ Sat May 30, 2009 4:45 am ] |
Post subject: | 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?' |
Author: | Grif [ Sat May 30, 2009 5:06 am ] |
Post subject: | 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 |
Author: | Mind [ Sat May 30, 2009 5:08 am ] |
Post subject: | 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. |
Author: | Mind [ Sat May 30, 2009 7:56 pm ] |
Post subject: | Re: Stupid Timer and Something else |
Anyone able to help on this? |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |