Author Topic: Check when ServerLoadSaveFile_Start is Done AND Loading Events?  (Read 1683 times)

Here's my code:
Code: [Select]
new SimGroup(BrickGroup_Test : BrickGroup_888888)
{
bl_id = "0";
isPublicDomain = "0";
};
mainBrickGroup.add(BrickGroup_Test);
$LoadingBricks_BrickGroup = BrickGroup_Test;
$LoadingBricks_Client = -1;
$LoadingBricks_ColorMethod = 3;
$LoadingBricks_DirName = "";
$LoadingBricks_DoOwnership = true;
$LoadingBricks_FileName = %file;
$LoadingBricks_PositionOffset = "0 0 0";
$LoadingBricks_Silent = true;
$LoadingBricks_StartTime = getSimTime();
ServerLoadSaveFile_Start(%file);

How do I check when ServerLoadSaveFile_Start() is finished loading bricks? None of the $LoadingBricks_ variables seem to flag this, and I'm not sure where else to look.

Events don't seem to load properly, either. (There was this thread on the same topic. But thread was locked after the solution was found, with no follow-up.)

That's odd. Direct load Laius load events for me. Also I think the return statement is called after the loading finishes, or it probably calls an end fumction

Why are you creating your own brick group, why can't you use the public one? You could try just using serverDirectSaveFileLoad() to load bricks instead.

I also think that brick groups need to be named the BL_ID they're attached to for some reason so like for yours it would have to be BrickGroup_0 (I could be wrong on that one but I remember something like that)



As for detecting when bricks/events are done loading, assuming you get the loading done correctly just package ServerLoadSaveFile_End().

Yeah, there's a lot of problems with oddly named brick groups.
At some point, I was writing a pretty big mod which would replace the save/load system as well as add more stuff to building, but I lost interest in that.

Why are you creating your own brick group, why can't you use the public one? You could try just using serverDirectSaveFileLoad() to load bricks instead.
The plan is two have two seperate brickgroups. One will house a spawn room, which will always be present. The other will be for maps, which will be deleted and loaded independent of the spawn room.

serverDirectSaveFileLoad() works fine. I haven't tried specifying the brickgroup yet, though. Got too tired.

I also think that brick groups need to be named the BL_ID they're attached to for some reason so like for yours it would have to be BrickGroup_0 (I could be wrong on that one but I remember something like that)
I'll try that when I get home.

As for detecting when bricks/events are done loading, assuming you get the loading done correctly just package ServerLoadSaveFile_End().
I feel dumb for not seeing this in the trace, lol. This is why I shouldn't post help threads at 2 AM. Anyway, thanks!
« Last Edit: December 01, 2017, 07:05:52 PM by Platypi »

serverDirectSaveFileLoad() works fine. I haven't tried specifying the brickgroup yet, though. Got too tired.
I tried specifying $LoadingBricks_BrickGroup = BrickGroup_Test before running serverDirectSaveFileLoad(%file). While the loaded bricks had events (as expected), the function assigned its own value to $LoadingBricks_BrickGroup. So it looks like I need to call ServerLoadSaveFile_Start() directly to use my own brickgroups.

Honestly, I'm considering just creating my own script for loading BLS files. I already have the code for a BLS loader that allows for the rotation of builds. I just need to implement event loading. I'd prefer to use the base functions if I can get away with it, though.

Honestly, I'm considering just creating my own script for loading BLS files. I already have the code for a BLS loader that allows for the rotation of builds. I just need to implement event loading. I'd prefer to use the base functions if I can get away with it, though.

This should help with whatever you're doing.
[BL SOURCE CODE/REFERENCE] ServerLoadSaveFile_Start/Tick/End/Color Data

From the code I posted, it looks like you can package serverLoadSaveFile_Tick and check for if events are being processed through there. Since the last brick is saved to $LastLoadedBrick, you can simply do $specialBrickGroup.add($lastLoadedBrick); to move it to that group if a certain event is processed.

Be very careful about NTNames and spawn point bricks though. Since these usually come before events, you'll have to unregister them on the $LastLoadedBrick's original brickgroup and re-register them on the $specialBrickGroup.

This should help with whatever you're doing.
[BL SOURCE CODE/REFERENCE] ServerLoadSaveFile_Start/Tick/End/Color Data
Oh, nice. This should help me solve my problem. I'll try to post something here if I get it working to my liking.