Author Topic: Package/Parent Syntax Tutorial  (Read 32895 times)

I have a problem:

Parent:##:##onPlayerTouch(%client, %this, %player, %stuff);

I see nothing wrong with this.

I have a problem:

Parent:##:##onPlayerTouch(%client, %this, %player, %stuff);

I see nothing wrong with this.
When you see an error like that, it means the error is above that line

packages aren't used inside code blocks...

basically they're only used for mods or to edit previously existing functions, and they don't necessarily contain methods...

The syntax was right, for the most part:

Code: [Select]
package <Package Name> {
    <Functions (or methods) go here>
};

after you activate a package, any functions you re-wrote inside the package (that already existed) overwrite the previously existing one. You can call the code in the previously existing function (i.e. the function that was created outside the package) by using Parent::

You're obviously confusing yourself with other languages, when you make a function; the bracket goes on a new line under the function, not in front of it. Please check your work and make sure it's not a comparasin to another language, so other people don't start learning another language and wondering why the crap they script doesn't work.

You're obviously confusing yourself with other languages, when you make a function; the bracket goes on a new line under the function, not in front of it. Please check your work and make sure it's not a comparasin to another language, so other people don't start learning another language and wondering why the crap they script doesn't work.
Dude, that quote is about three years old.

You're obviously confusing yourself with other languages, when you make a function; the bracket goes on a new line under the function, not in front of it. Please check your work and make sure it's not a comparasin to another language, so other people don't start learning another language and wondering why the crap they script doesn't work.
First of all,
Dude, that quote is about three years old.

Second of all, you're completely wrong. He did nothing wrong.

You're obviously confusing yourself with other languages, when you make a function; the bracket goes on a new line under the function, not in front of it. Please check your work and make sure it's not a comparasin to another language, so other people don't start learning another language and wondering why the crap they script doesn't work.

TorqueScript is a flexible language in the way that the following is entirely valid code:
Code: [Select]
  function            do_crap  (%hello  ,%there     )
{
crash    ();
          quit();
                                 }

You can write however you want. It's a personal preference.
« Last Edit: May 08, 2012, 03:04:04 AM by Port »

TorqueScript is a flexible language in the way that the following is entirely valid code:
Code: [Select]
   function            do_crap  (%hello  ,%there     )
{
crash    ();
          quit();
                                 }

You can write however you want. It's a personal preference.
THE UGLY




Would I need to package it if I used this?
Code: [Select]
ServerCmdMessageSent(FindClientByName("%1"), ("blah blah blah");

Would I need to package it if I used this?
Code: [Select]
ServerCmdMessage(FindClientByName("%1"), ("blah blah blah");

Packages are only for functions, not function calls. Also, you've got an extra opening parenthesis before the start of the second argument.



Pointless, someone can just read your code, extract said function, and overwrite your function altogether with their new methods.

What about compiling it? Can it be viewed even if its viewed as a cs file? (Ex. compile example.cs so its secure for hackers can't view the file, and coders are required to decompile it.) Will it be just as a pain to view it when its compiled? If we do choose to compile the code, what is the command for it to view it? Would it be the:

Code: [Select]
exec('example.cs');