ID:149407
 
How do you make a timer that counts off 20 minutes and then reboots the world?
proc/Stuff()
spawn while(1)
sleep(12000)
world.Reboot()
world/New()
..()
Stuff()
In response to Super16
Even simpler:

world/New()
..()
spawn(12000)
Reboot()
In response to Skysaw
Even simpler!

world/New()
..()
spawn(12000) Reboot()

-LoW
In response to Lord of Water
Lord of Water wrote:
Even simpler!

world/New()
..()
spawn(12000) Reboot()

-LoW

Removing a return does not make the code simpler, it just makes it one character shorter. You basically just reposted my code.
In response to Skysaw
Skysaw wrote:
Removing a return does not make the code simpler, it just makes it one character shorter. You basically just reposted my code.

Then I must make it truly simpler:
world/New()
spawn(12000) Reboot()

I don't want to be a wiseguy here, it's just that I've seen many code snippets calling the parent to world/New(). First, the default action for world.New() is nothing, and secondly: What is the parent?


/Andreas
In response to Gazoot
When the parent isn't called it can lead to black screens and procs not being called.

world/New()
procone()
proctwo()


In some cases proctwo() won't be called.
In response to Gazoot
Gazoot wrote:
I don't want to be a wiseguy here, it's just that I've seen many code snippets calling the parent to world/New(). First, the default action for world.New() is nothing, and secondly: What is the parent?

Several of my libraries, and probably the libraries of others, do things in world/New(). Without the ..() those libraries would not function correctly.
In response to Shadowdarke
Shadowdarke wrote:
Several of my libraries, and probably the libraries of others, do things in world/New(). Without the ..() those libraries would not function correctly.

So if you call ..() from the superparent, it will call itself? Interesting, and very useful! No more spawn() in my world/New!


/Andreas
In response to Nadrew
Nadrew wrote:
When the parent isn't called it can lead to black screens and procs not being called.

> world/New()
> procone()
> proctwo()
>

In some cases proctwo() won't be called.

That is a strange behaviour. Any explanations for it?


/Andreas
In response to Gazoot
Gazoot wrote:
Shadowdarke wrote:
Several of my libraries, and probably the libraries of others, do things in world/New(). Without the ..() those libraries would not function correctly.

So if you call ..() from the superparent, it will call itself? Interesting, and very useful! No more spawn() in my world/New!

Not exactly.

Say, for example, Spuzzum does this in s_admin 3:

world/New()
..()
var/s_admin/object = new()
object.DoThis()


Next, say that Leftley does this in LeftleysReallyCoolButNonExistentChutzpahLib:

world/New()
..()
world.name = world.name + " [Powered by LeftleysReallyCoolButNonExistentChutzpahLib]"


The world/New() essentially evaluates to this:

world/New()
var/s_admin/object = new()
object.DoThis()
world.name = world.name + " [Powered by LeftleysReallyCoolButNonExistentChutzpahLib]"


Anything you add to world/New() should be added with ..() so as to retain the former data that other people have added to their libraries and world/New() overrides.