Author Topic: Iban Explains it All  (Read 24377 times)




Iban, I have to say I enjoyed your documents. They weren't dull, they had that "entertaining factor" to them. =)

Do you think you could write some up some stuff to explain vectors? Like getEyeVector(); and how to tell in what direction the player is from a certain brick's location? Raycasting would also be great too. Like the stuff from the Trench digging mod.
« Last Edit: March 31, 2011, 07:10:31 AM by Reinforcements »

You could make Minecraft mods?
I said beginner. The most advanced thing I've done so far with help from a more advanced classmate is a basic Battleships game. I guess my problem with Torque Script is that I don't understand the syntax. Sure I can read some parts of the script and understand it, but the whole thing. Not a clue.

I said beginner. The most advanced thing I've done so far with help from a more advanced classmate is a basic Battleships game. I guess my problem with Torque Script is that I don't understand the syntax. Sure I can read some parts of the script and understand it, but the whole thing. Not a clue.
How? The syntaxes are very similar.

How? The syntaxes are very similar.
Yes I have noticed some similarities but I find it hard to understand the script as a whole. For example this:

function serverCmdSetChatColor(%client,%colorName,%colorChat)

I understand that the first one defines it as a function that you can call later, but what is the next (serverCmdSetChatColor) part? What other things can you put there? The stuff in brackets are parameters, but I still don't understand how that stuff works.

SetChatColor is the name of the function for calling it later, the serverCmd prefix just means its a server side command (see: Iban's server/client tutorial), which basically means you can type /setchatcolor into the chat.

The variables in the brackets are place holders, which are filled when the function is called. For example: calling "function bobby(%arg1,%arg2,%arg3)" later with the line "bobby("this is an arg",500,$pi);" will recall the function that has been defined. It will set %arg1 to "this is an arg", %arg2 to 500, %arg3 to the value of the global variable $pi. It will then execute every line of code between the two curly braces ({}) and you can then use the place holders/arguements that now hold data. Now you just execute code that you want to do with the %arguements. (note that you don't have to have arguements in a function, that bit can be blank and you just call it later like "bobby();") You can do anything in functions except create new functions and packages (see: Iban's packages tutorial).



And because I got no response...

Iban, I have to say I enjoyed your documents. They weren't dull, they had that "entertaining factor" to them. =)

Do you think you could write some up some stuff to explain vectors? Like getEyeVector(); and how to tell in what direction the player is from a certain brick's location? Raycasting would also be great too. Like the stuff from the Trench digging mod.

Vectors and the like are in the realm of trigonometry which is more Space Guy's thing. I cannot do complex math.

Vectors and the like are in the realm of trigonometry which is more Space Guy's thing. I cannot do complex math.
Oh, ok.

It says so if you look at the ZAPT code.  :cookieMonster:

Code: [Select]
function Player::zombieAimVec(%obj)
{
// Space Guy's code (iban no good at math)
%fvec = %obj.getForwardVector();
%fX = getWord(%fvec, 0);
%fY = getWord(%fvec, 1);

%evec = %obj.getEyeVector();
%eX = getWord(%evec, 0);
%eY = getWord(%evec, 1);
%eZ = getWord(%evec, 2);

%eXY = mSqrt((%eX * %eX) + (%eY * %eY));
%aimVec = (%fX * %eXY) SPC (%fY * %eXY) SPC %eZ;

return %aimvec;
}


Vectors and the like are in the realm of trigonometry which is more Space Guy's thing. I cannot do complex math.
Not really. I can try writing a tutorial if you'd like.

Not really. I can try writing a tutorial if you'd like.
:D

please do!