Author Topic: Debugging error much?  (Read 1371 times)

So I loaded a script on:
Code: [Select]
function ServerCmdBLID(%target)
{
NewChatHUD_AddLine("\c2"%target"BL_ID is: \c6"%target.bl_id"");
}

but for some reason it gave me this error? There's an error with the debugger:


And when I agree to let go of each letter, it just moves on to the next one!

Help Plz?

@ is the string connector in torque. Insert it between strings (the thingies with quotes around them) and other strings or variables.


function ServerCmdBLID(%target)
{
NewChatHUD_AddLine("\c2" @ %target @ "BL_ID is: \c6" @ %target.bl_id @ "");
}

Aside from that, you need to use %target.getPlayerName() or %target.name not %target. You also need to add %target = findClientByName(%target); at the top of the function.

Is this supposed to be client sided or server sided?

Code: [Select]
function serverCmdBLID(%client, %target)
{
     messageClient(%client, '', "\c2" @ %target.name @ " BL_ID is: \c6" @ %target.bl_id);
}

When using a server command, the first argument is the person who used it. The rest are whatever you want them to be.

When transitioning between different string variables, or just strings, you must put a @.

NewChatHUD_addLine only works on client, serverCmd only works on the server.

When using a server command, the first argument is the person who used it. The rest are whatever you want them to be.

When transitioning between different string variables, or just strings, you must put a @.

NewChatHUD_addLine only works on client, serverCmd only works on the server.
How did I even loving not notice that? I honestly feel handicapped right now.
« Last Edit: February 11, 2012, 02:26:27 PM by Slicksilver »

NewChatHUD_addLine only works on client, serverCmd only works on the server.
Basically whenever anyone uses this command, it'll message the host.

Basically whenever anyone uses this command, it'll message the host.
Or if its being used on a dedicated server, it'l cause a crash. RULES FTW

Anyway, use messageClient, here is how it's used:
messageClient(%Client, '', %Message);

@ is the string connector in torque. Insert it between strings (the thingies with quotes around them) and other strings or variables.


function ServerCmdBLID(%target)
{
NewChatHUD_AddLine("\c2" @ %target @ "BL_ID is: \c6" @ %target.bl_id @ "");
}

Aside from that, you need to use %target.getPlayerName() or %target.name not %target. You also need to add %target = findClientByName(%target); at the top of the function.
The @ and the "" are not required at the end.

The @ and the "" are not required at the end.
I only added @, their code had the "" at the end.

Or if its being used on a dedicated server, it'l cause a crash.
No, creating GUIs causes crashes.

Trying to call functions on non-existant objects doesn't.