Author Topic: OH MY GOSH IM LEARNING TO CODE  (Read 4830 times)

what language do you need to know to script weapons?
C++ I believe.

if(code.syntaxError = 1) {
echo("You have been Electrkfied!");
}

Hehe. My fix. :P


To code anything for blockland, you need to know torquescript. its really easy.

C++ I believe.
hoora-

To code anything for blockland, you need to know torquescript. its really easy.
...forget.

To code anything for blockland, you need to know torquescript. its really easy.

I've always wanted to get into scripting. I'll look into this instead.

EDIT: I'm guessing this is what you are talking about?
« Last Edit: September 08, 2012, 12:30:51 AM by Joffrey »

there's a lot of people who do weapons

they aren't scripters/coders

there's a lot of people who make playertypes

they aren't scripters/coders

there's a lot of people who make vehicles, maps, etc

they all use .cs files, but they are not scripters/coders.

there are less of us than you might think

I always fear my models are ugly as stuff, and they'll look dumb, so i strive to improve my modeling skillz so i can move to scripting...

But i need a new mouse

Good now code a sandbox ;]
Why don't you go code your own sandbox and buzz off, setro?

if(code.syntaxError = 1) {
system.print("You failed!")
};
I'm going to cut you if you ever try to make programming jokes like this again.
C++ I believe.
Wrong.


cmdtoserver.killall(9001);
I'm going to cut you if you ever try to make programming jokes like this again.



C++ I believe.
Wrong.

The language is TorqueScript, which is similar to C# but is its own language.



The language is TorqueScript, which is similar to C# but is its own language.
TorqueScript is correct and you really can only compare it to C-like languages because of how awkwardly stuffty it is sometimes.

So, you're trying to set the velocity of an object. You'd think a function like that would take something like three ints, three floats, or a vector3 of some sort.

Wrong! It takes a string!

Code: [Select]
findclientbyname(Kaphonaits).player.addVelocity("0 0 200");

TorqueScript is correct and you really can only compare it to C-like languages because of how awkwardly stuffty it is sometimes.

So, you're trying to set the velocity of an object. You'd think a function like that would take something like three ints, three floats, or a vector3 of some sort.

Wrong! It takes a string!

Code: [Select]
findclientbyname(Kaphonaits).player.addVelocity("0 0 200");
Thinking about traditional types in Torquescript is bad

Even an integer is a string
If you don't use anything that isn't alphanumeric you don't need to use quotes but it's still a string
So thinking of static types in Torquescript means you're thinking of it wrong

What you should be doing is thinking about string formats
.+ - String
\d+ - Integer (but also a string)
\d+\.\d+ - Float (but also a string)
\d+ \d+ - Vector2 (but also a string)
\d+ \d+ \d+ - Vector3 (but also a string)

If you try to call a method on a string it tries to resolve the string to an object - if it's entirely numeric, it tries as an object ID, then it tries as an object name.

In addition, trivia:
false and true, if unquoted, are 0 and 1, not "false" and "true". "true" as an explicit string is false.
A string like "24 slaves in the field" if used as a number will be 24, not 0, as anything before the first non-numeric character of the string is treated as a number (it doesn't validate the whole string to see if it actually is a number - really this means you can match a Torquescript integer as \d+.*)
« Last Edit: September 08, 2012, 04:46:29 AM by M »

-awesomesnip-
Yes but there are reasons that the traditional types exist.

So you don't need things like useless duplicates of operators.

Code: [Select]
if(%blah $= %blergh) {
        //...
}
Code: [Select]
if(%blah == %blergh) {
        //...
}

Why, why, why are my parents forcing me to learn Python?

I want to learn TorqueScript, dammit!