Author Topic: Weird syntax error on a line which nothing changed [new issue pls help]  (Read 772 times)

I keep getting a syntax error on line 53 for my latest dev version of Server_TagChanger.

Line 53:
Code: [Select]
    %client.chatMessage("\c0| Clan Tag Changer > \c6Commands: /clanPrefix (player) (new clan tag)");

Syntax error report for line 53:
Code: [Select]
    %client.chatMessage("\c##

I'm seriously confused here. Nothing has changed on this line or section of the code since the last version, and the last version (1.0) gives no syntax errors here.

Here's the full code for those who want to see more: http://pastebin.com/raw.php?i=wLPMDG2F

edit;
Now that I got it working - it's no longer changing %target's clan tags. Everything else works.
« Last Edit: August 11, 2015, 06:21:22 PM by Blake1Studios »

Are you absolutely sure there isn't anything different between that full code and the code you're executing? I can't find a syntax error in it for the life of me.

Are you absolutely sure there isn't anything different between that full code and the code you're executing? I can't find a syntax error in it for the life of me.
No differences.

when you're in-game and make a change to a file, make sure to do setModPaths(getModPaths()); before executing the file. this is most likely the issue here because i can't see any syntax errors either

when you're in-game and make a change to a file, make sure to do setModPaths(getModPaths()); before executing the file. this is most likely the issue here because i can't see any syntax errors either
Oh! This might be the issue. Checking right now.

EDIT: Yep this was the issue. Thanks. Locking.
« Last Edit: August 11, 2015, 05:53:06 PM by Blake1Studios »

when you're in-game and make a change to a file, make sure to do setModPaths(getModPaths()); before executing the file. this is most likely the issue here because i can't see any syntax errors either

Note that you don't need to do this if the add-on is in a folder instead of a .zip file. That is the main reason most modders create add-ons as a folder, and only zip it to share.

Now that I got it working - it's no longer changing %target's clan tags. Everything else works.

You are doing:

Code: [Select]
if(isObject(%target = findClientbyname(%target)))
{
FindClientByName(%target).clanPrefix = trim(%chat SPC %chat2 SPC %chat3 SPC %chat4 SPC %chat5 SPC %chat6);

On the first line, you are assigning %target to the result of findClientByName(%target) , which is the ID of the client.
On the next line, you are searching for a client called [the id of the client] and attempting to set their clan prefix.

Also, you should standardize your capitalization. It technically doesn't matter in TorqueScript, but in most programming languages it does matter. Plus it makes it easier to read when you keep to one standard. The most common (at least in the community) is CamelCase. Capitalize the first letter of each word, but not the very first letter, eg "findClientByName".

You are doing:

Code: [Select]
if(isObject(%target = findClientbyname(%target)))
{
FindClientByName(%target).clanPrefix = trim(%chat SPC %chat2 SPC %chat3 SPC %chat4 SPC %chat5 SPC %chat6);

On the first line, you are assigning %target to the result of findClientByName(%target) , which is the ID of the client.
On the next line, you are searching for a client called [the id of the client] and attempting to set their clan prefix.
Yes I know what I'm doing, I don't know how to fix it.

Just do %target.clanPrefix since it's already a client object.