|
Development Forum |
 |
| Why do critters die first? | |
| 
Malkin
     Manager

|
1/19/2013 | |
I've noticed in several critter/bug etc. timer scripts, dying is often the first thing that appears. At first glance, this seems a little confusing. ![[nquestion] [nquestion]](/images/smilies/emot_question.gif)
Could someone please explain to me why this is so?
My TCR Norns |

Amaikokonut
 

|
1/19/2013 | 1 |
In most scripts it doesn't matter what order it's in, because it's all some structure of if-else statements. I guess death was just the first thing that came to mind when writing the code. If it checks and finds that the critter is flagged to die (due to low life force or other reasons), no point in running through the rest of the timer code, no reason to bother with the rest of the script like calculating where to move it to and animating and decreasing it's energy and so on, because hey, it's dead. But if it's not dead, it'll carry on as usual.
C3 critter scripts as a whole are mind-bogglingly confusing in just about every aspect anyway, if it makes you feel any better (sorry, it probably does not, at all). When doing GB conversions I had to spend hours thoroughly annotating critter code before making any edits, just to get an understanding of what was going on. If you need any more help with them feel free to bug me about it.
[Naturing :: Nurturing] |

Malkin
     Manager

|
1/19/2013 | 1 |
Just trying to get myself to 'think like the code, be the code'. I'm sure you know how that goes. ![[nwink] [nwink]](/images/smilies/emot_wink.gif)
My TCR Norns |
 Prodigal Sock
Ghosthande
    

|
1/21/2013 | |
I agree with Amai... I've always done it for those reasons. Heaven forbid a starved-to-death critter takes another two steps and eats something when it's supposed to die already. 
 |

Malkin
     Manager

|
12/3/2013 | |
Just as a thought - it could also be a resource-saving best practice - if the thing should die, then there's no point wasting resources running the rest of the script.
My TCR Norns |

Spykkie
  
|
12/3/2013 | |
It makes sense to me, 'living' things can be very complex to program. The first thing you want to check is to see if they are dead, because it's the only alternative to being alive, and it's the only thing that negates all of the "alive" codes.
dead check:
if dead( do nothing)
else (do all of the living things)
Loop
ah, the most basic artificial life. ;P
Twitt Stuff
Insta Arts |
|