Author Topic: It's schedules..  (Read 738 times)

Code: (Torque) [Select]
function serverCmdleavetrain(%client)
{
    %client.canLeaveTrain = true;
    schedule(5000, 0, "%client.canLeaveTrain = false;");
}

Seams that it keeps staying true...
I don't know why, it's probably a stupid mistake.

Yes 5000 for 5 seconds

I've never seen anyone use an expression in a schedule. Can you only use functions?

I've never seen anyone use an expression in a schedule. Can you only use functions?
Code from old TDM mod
Code: (Torque) [Select]
schedule(%bricknum * 310,0,eval," $TeamDM::Uploading = 0;  messageall(\'\',\"\c5Upload complete.\");echo(\"--Brick Load Finished\");");

schedule(%bricknum * 310,0,eval," $TeamDM::Uploading = 0;  messageall(\'\',\"\c5Upload complete.\");echo(\"--Brick Load Finished\");");

Yeah, I already noticed that, but I type this into console:

eval("findclientbybl_id(zzzz).canLeaveTrain = false;");

That works.

This doesn't
Code: (Torque) [Select]
function serverCmdleavetrain(%client)
{
    %client.canLeaveTrain = true;
    schedule(5000, 0, eval, "%client.canLeaveTrain = false;");
}

Temporary solution:
Code: (Torque) [Select]
function serverCmdleavetrain(%client)
{
    %client.canLeaveTrain = true;
    schedule(5000, 0, evalLeaveTrain, %client);
}

function evalLeaveTrain(%client)
{
    %client.canLeaveTrain = false;
}

That works just fine, don't know why the other one didn't.

schedule(5000,0,eval,%client SPC ".canleavetrain = false;"); Might've worked but I'm not sure.

schedule(5000,0,eval,%client @ ".canleavetrain = false;");

I think. SPC will leave a gap between the client ID and the code which may cause errors.

What spaceguy said. I mess that up a lot.

schedule(5000,0,eval,%client @ ".canleavetrain = false;");

I think. SPC will leave a gap between the client ID and the code which may cause errors.

I had a issue when your trying to loop on a person,i got it now,here is what you should try,it should work.untested

function leavetrain(%a)
{
findClientByName(%a).canleavetrain = true;
schedule(5000,0,"leavetrain",%a);
}

Then after you do that do

leavetrain("name");

Thats all.

I had a issue when your trying to loop on a person,i got it now,here is what you should try,it should work.untested

function leavetrain(%a)
{
findClientByName(%a).canleavetrain = true;
schedule(5000,0,"leavetrain",%a);
}

Then after you do that do

leavetrain("name");

Thats all.
%a already returns a GameConnection(first parameter in serverCmd's)

You're finding the GC of a GC


It's working, forgot to lock. No, your code was OK, just weird.