ID:179928
 
ok, i'm using the day and night cycle thing (very useful) and that works fine... i edited a bit of course. But in the daycycle proc i'm trying to add my proc to be run. like this

proc
daycycle()
usr(src)(client)(mob)(and with nothing!).Age()
lit = 1 - lit // toggle lit between 1 and 0
BLAH BLAH BLAH

but that doesn't work. it give me a runtime error saying something about not being able to modify null.age! (stupid thing!) here's my proc code for life:

proc
Age()
src.age += 1
if(src.age == 20)
src.icon_state = "1-4"
if(src.age == 40)
src.icon_state = "5-6"
else
return 0

i don't see a problem there. Of cousre i'm a newbie with three years of exp... oh, that sad. anyone have some ideas? Neba season is open! insult my intelligence if you wish, but i'm stupmed.


I assume the indentation is messed up by the forum, since the error you're getting isn't related to indentation.

Is the Age() proc global? (not defined under a mob or other atom/datum) If so, then there is no src. What are you trying to age with this proc?
In response to Shadowdarke
i'm trying to age mobs... so what you're saying is that i should put the proc just out there instead of under mob? or i should just modify how i call it?
In response to Nebathemonk
No, if you are aging mobs, you should leave it under mob.

If you want to age mobs every daycycle, you will have to loop through each mob and run it's Age() proc.

for(var/mob/M in world)
M.Age()

This will slow the game if you have a lot of mobs. It may be more efficient to spawn changes in age state every so often instead counting days. If a mob goes 20 days before aging to icon_state 2 and a day is 300 ticks long, just add a spawn(6000) Age() at the end of mob.New() and at the end of Age() and change the icon_state each time Age() is called.
proc
daycycle()
lit = 1 - lit // toggle lit between 1 and 0

Whoa, that's a nifty way of toggling.

Here's another neat way of toggling.

lit = !lit

In response to Spuzzum
lit = !lit

Thats the way I use. It has the added benefit allowing lit to be null instead of 0 to start with.

-AbyssDragon
usr(src)(client)(mob)(and with nothing!).Age()

Am I the only one who scratched his head when he saw this? What in the world are you trying to accomplish here?
In response to Skysaw
Skysaw wrote:
usr(src)(client)(mob)(and with nothing!).Age()

Am I the only one who scratched his head when he saw this? What in the world are you trying to accomplish here?

Well, I was hoping that was a list of all the terms that were tried, and not all being tried at once. But now that you mention it...
In response to Flick
Confused me too, but I assumed the same thing Flick did.