Author Topic: Blockland is saying a file doesn't, and does exist?  (Read 2050 times)

So upon my server reset function in the Mining mod I'm working on
Code: [Select]
function getDirts()
{

        %filename = $Mining::Root @ "dirts.txt";

        if(!isFile(%filename))
        {

                echo("You're missing the dirts database! (dirts.txt)");
                return;

        }
When it gets to this command, it thinks the file isn't there.
However when starting the server for the first time, and when doing the function manually, it says the file is there.

Code: [Select]
function resetServer()
{

        noticeMessage("Deleting" SPC getBrickCount() SPC "bricks from the host's brickgroup...");
        $Mining::Host.brickgroup.delete();
        noticeMessage("Done, resetting global variables...");
        deleteVariables("$Mining::*");
        noticeMessage("Done, running miningInit();");
        miningInit();
        noticeMessage("Server reset.");

}
is the reset function

and
Code: [Select]
function miningInit()
{

        if($Mining::HasStarted)
        {

                noticeMessage("Gamemode already initiated.");
                return;

        }
        else
        {

                $Mining::HasStarted = 1;

        }

        $Mining::Host = new ScriptObject()
        {

                isAdmin = 1;
                brickgroup = 0;
                bl_id = getNumKeyID();

        };

        %brickgroup = new SimGroup("BrickGroup_" @ getNumKeyID())
        {
                client = 0;
                bl_id = getNumKeyID();
                name = "The Host";
        };

        $Mining::Host.brickgroup = %brickgroup;

        mainBrickGroup.add($Mining::Host.brickgroup);

        noticeMessage("Starting init commands...");

        getOres();
        getDirts();
        newSpawn();
        miningGUI();
        checkBrickCount();

}
is the miningInit command.

Am I doing something wrong or is this a bug with Blockland?

Where is $Mining:: root defined, and how is it defined?

Try calling setModPaths(getModPaths()); before "searching" for the file.

Is $Mining::Root defined, and if so, does it have a / at the end?

Is $Mining::Root defined, and if so, does it have a / at the end?
What I was about to say

Where is $Mining:: root defined, and how is it defined?
Is $Mining::Root defined, and if so, does it have a / at the end?
What I was about to say
First line of server.cs
Code: [Select]
$Mining::Root = "Add-Ons/GameMode_EndlessMining/";
Try calling setModPaths(getModPaths()); before "searching" for the file.
i'll try that


I figured out what's going on, never mind.

When I the reset function is used, $Mining::Root falls under the deleteVariables("$Mining::*"); command, so it's deleting that variable and causing it not to work.