Getting confused with args

Discussion in 'Modifications' started by Stubbsy, Jun 6, 2015.

  1. Stubbsy

    Stubbsy Contributor

    I've decided to give scripting a go. But, I'm not understanding how arguments work. I do know about arguments and all that jazz in different languages, but I'm not too sure how it works for TorqueScript.

    There is arguments like:

    I'm guessing you can name an argument anything you want, but they have to be in order? If that's the case, then how do I get things like the player username?

    I'm doing client side modding for the time being, then move my way onto server side modding.

    I'm using the call back function:

    addMessageCallback("MsgRespawned", myFunction);
    function myFunction() {
        echo("You have respawned!");
  2. Poponfu

    Poponfu Lead Developer

    You are right about it being just the order.

    The way I learned was always just following from where something started to find out how it works in the existing code. Searching the garagegames forums via google is a must as well as having their torquescript docs open. After a while you will do that enough and then start to be able to make your own things that integrate. The arrangement of how the different parts click together becomes more clear in your head as you ask yourself how is that done so I can do this and explore that way for a while, its all one big chain that gets kicked off from main.cs.

    Just an example of what you asked above, if you mean just your own local name. You would ask yourself if this already happens somewhere or something like it.. it needs my name to join a game! Go search and find where you join a server stumbing upon function Client::joinServer in the client scripts. Finding $Pref: Player::Name is passed there as one of the arguments when you first try to join. If you are talking about other players.. without modifying server that gets past something you should be just starting out with.
  3. Xzanth

    Xzanth Legions Developer

    Stubbsy and k e v i n like this.
  4. Stubbsy

    Stubbsy Contributor

    Makes sense. Thanks for that!