I am using this library in a few of my projects.
Whenever I try to use the verb 'Darkness-level' after loading a save file, it has no effect on the darkness alpha whatsoever. The first time I create the save, everything is fine. Subsequent times? Not a chance.
Sadly the problem persists, even after having attempted to reinitialize the darkness during the loading. Any other ideas?
|
In response to RiceINF
|
|
Allow us to see the relevant code? Specifically saving, loading, the part(s) attempting to reinitialize and/or modify the darkness, and any other related parts.
|
Login
Loading (commented out the reinitialization stuff) Saving I am purely changing the darkness with the Darkness_Level() verb. |
I probably should have ponted this out: you wanna use the <dm></dm> tags to post code.
I think I see one issue: the darkness variable isn't marked tmp. This means it's being written into the player savefile by default when, ideally, you don't want that. This goes for the other lighting objects, too (and object references in general). So:
mob/var/image/darkness/darkness
should be: mob/var/tmp/image/darkness/darkness Let me see if I can find a decent savefile guide so you can learn more about this subject before you get deep into any development -- it can really hurt you later on if you don't. |
Funny enough, I have many years on BYOND, five of which I have programmed. This source, however, was not programmed by me so it is a melange of inconsistencies and bad practices.
I have literally only fiddled with the lighting library - all else is none of my doing. I used screenshots as the Save/Load code is honestly too extensive to post. I agree that it requires /tmp/ - a large oversight on my part. |
Related: Saving the world Part 1: Getting to know savefiles
If nothing else, read the "The Neglected Temporary Variable" section. |
In response to RiceINF
|
|
Ah, understood. Let me know if that turns out to be the problem.
|
I really appreciate your help. It's a pity that it was such a small mistake. I will remember this!
|
In response to RiceINF
|
|
RiceINF wrote:
I really appreciate your help. It's a pity that it was such a small mistake. I will remember this! What was the issue? |
It was the fact that the variable section had to be made into
tmp
Solution: mob |
if(darkness) darkness.alpha = n
...where darkness is an image added to the client list at run-time.
The problem is likely that darkness isn't reinitialized upon loading a character Though, if Login() is setup correctly and similarly to the library, this shouldn't be an issue.