![]() |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Look at this function:
public void my_alarm_func(int generation) { set_alarm(1.0, 1.0, my_alarm_func(generation + 1)); tell_object(find_player("<your name>"), "Yohooo! " + generation + "\n"); } |
What's happening here? Well, every second an alarm is generated, calling itself in one second. What does this mean? Let's look at the development of alarm calls after the first call:
1 second: Yohoo! 0 (original call) 2 seconds: Yohoo! 1 (repeat of 1 sec 0) Yohoo! 1 (new from 1 sec 0) 3 seconds: Yohoo! 1 (repeat of 1 sec 0) Yohoo! 2 (repeat of 2 sec 1) Yohoo! 2 (repeat of 2 sec 1) Yohoo! 2 (new from 2 sec 1) Yohoo! 2 (new from 2 sec 1) 4 seconds: Yohoo! 1 (repeat of 1 sec 0) Yohoo! 2 (new from 3 sec 1) Yohoo! 2 (repeat of 2 sec 1) Yohoo! 2 (repeat of 2 sec 1) Yohoo! 3 (repeat of 3 sec 2) Yohoo! 3 (repeat of 3 sec 2) Yohoo! 3 (repeat of 3 sec 2) Yohoo! 3 (repeat of 3 sec 2) Yohoo! 3 (new from 3 sec 2) Yohoo! 3 (new from 3 sec 2) Yohoo! 3 (new from 3 sec 2) Yohoo! 3 (new from 3 sec 2) ... etc. |
As you can see we have exponential growth here... VERY funny... the game will grind to a halt practically at once! This, if you didn't know it, is so stupid as to be a demoting offense. Is this easy to do by mistake? Well... I've seen it a few times. Often enough to warrant this warning anyway. Oh, try this on Genesis and you're dead meat! Consider yourself warned!
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |