Code: None.
Problem description:
Simply put, I am wondering how I would activate a procedure on the start of the world (for example, auto saves).
Dec 8 2015, 6:11 pm
Best response
|
|
world.New() is called automatically, around when the world starts up.
|
To elaborate, world.New() is called AFTER the map has already initialized, which may not be what you're after, you can however force a proc to run before world initialization by defining a datum as a variable something like
pre_init However order of operations is important with this, it must be placed before any other code is written in your game (As in, literally line 1 of the first .dm included in your file) to avoid running into any strange issues. |
In response to Kaiochao
|
|
Thank you, perfect for what I needed!
|
I have question to auto saves proc...
Better is call it for player when he is loggining mob or call it for world? world/New() Autosave() I think 1st method is faster, but i'm not sure. |
Those two snippets do vastly different things. One of them saves when the player logs in, the other saves when the world starts up.
If you're asking "Should I have a bunch of loops for autosaving on each client, or a single loop which calls something on each client?" the answer is ALWAYS the latter. It's basically a rudementary update loop, and it'll always run significantly faster than having a bunch of loops flooding your threads. |