Author Topic: I broke dig mod!?  (Read 1477 times)

The game crashes when done loading objects with this script enabled. Does anyone know why it won't work?
« Last Edit: October 23, 2009, 05:24:26 PM by Deriboy »

Code: [Select]
function servercmdsell(%client)
{
    %client.money = %money + %dirt + %silver * 2 + %gold * 3 + %Einst * 4 + %Emerald * 5 + %Uranium * 6

    messageclient(##%##client,  ' ', "<color:FF00FF>You have $"@ %money @");

}

function servercmdmoney(%client)

{

    messageclient(%client,  ' ', "<color:FF00FF>You have $"@ %money @");

}
Well, I don't think this is what's causing syntax, but your trying to add and display undefined variables. You're adding %money and the other stuff, but those don't even exist. Change it all to %client.digVarHere. Replacing "digVarHere" with the variables that the dig mod uses.

You're missing a semicolon in the sell command. Also it calls 7 undefined variables and the script barely resembles selling something.

And also aren't you needing to minus the varibles or else they can keep on selling it.


Code: [Select]
function servercmdsell(%client)
{
    %client.money= %money + %dirt + %silver * 2 + %gold * 3 + %Einst * 4 + %Emerald * 5 + %Uranium * 6;
    messageclient(%client,  ' ', "<color:FF00FF>You have $"@ %money @".");
}

function servercmdmoney(%client)
{
    messageclient(%client,  ' ', "<color:FF00FF>You have $"@ %money @".");
}

Try that, also, why not use the variables that already count your minerals for you?

Code: [Select]
function servercmdsell(%client)
{
    %client.money= %money + %dirt + %silver * 2 + %gold * 3 + %Einst * 4 + %Emerald * 5 + %Uranium * 6;
    messageclient(%client,  ' ', "<color:FF00FF>You have $"@ %money @".");
}

function servercmdmoney(%client)
{
    messageclient(%client,  ' ', "<color:FF00FF>You have $"@ %money @".");
}

Try that, also, why not use the variables that already count your minerals for you?
It will still call undefined variables and not do anything at all except set the client's money to 0 then tell them just that.

Yeah. I had a huge brain fart. I will fix and update with any new problems (its bound to happen) when I have a chance.

Also, how do you define variables? Thats where you define it as an integer or other things right?

Also, how do you define variables? Thats where you define it as an integer or other things right?

Like most programming languages (except Visual Basic for instance), variables do not need to be declared. What you need to watch out for though is how you compare variables.

%money = %client.money;
%dirt = %dirtcount;
%silver = %silvercount;
%gold = %goldcount;
%Einst =%einstCount;
%emerald = %Emeraldcount; //I hope you added this.
%uranium = %uraniumcount; //I hope you added this.



Now then, if you need anymore help I will go to the length of doing the whole code for you.


Come on guys, I am only trying to learn. I have some non blockland programming help, and he said that I might need to define the variables. So I wanted to try. But nevermind.



It seems like everyone's forgetting %client.