Author Topic: Overall Torquescript questions  (Read 1016 times)

Hey all.

I am currently trying/wanting to get the hang of Torquescript itself and i would like to ask some things.
- Is there a good guide about those functions (like for example, OnFunction(whattoputhereD:))
I would like to know how the inputs work for functions, which you have to state and if there are any rules for it.
- Are datablocks something only Blockland haves?
I guess not, but to be sure, I'll ask.
-Why doesn't something like this work with me at all:
Code: [Select]
package FirstPersonPackage
{
function Armor::onAdd(%this,%obj,%a,%b,%c,%d)
{
%this.setdatablock(GuyArmor);
parent::onAdd(%this,%obj,%a,%b,%c,%d);
}
};
activatepackage(FirstPersonPackage);
Yes, this is exactly copied from another thing, but that doesn't explain why it doesn't work.
The console says when i test it, it can't find the function setdatablock.

I looked at the stickies but, either i didn't read them that good or it doesn't contain the information i need, because i still don't know the answers. D:
« Last Edit: January 28, 2010, 05:22:13 AM by lordician »

I'm on my ds so I can't answer all your questions atm, but use %obj instead of %this. %this is the datablock.

Okay, thanks for pointing me on that.

1. Search the internet. Using the link in this topic or the in-game object.dump()/dumpConsoleFunctions()/dumpConsoleClasses() methods gives resources and some documentation for functions.
2. Datablock objects are used in every Torque-based game., however the fxDTSBrick/fxDTSBrickData is unique to Blockland.
3. What Destiny said. Armor:: functions have the first argument as the datablock (this case, PlayerStandardArmor etc.) rather than the object.

1. Search the internet. Using the link in this topic or the in-game object.dump()/dumpConsoleFunctions()/dumpConsoleClasses() methods gives resources and some documentation for functions.
2. Datablock objects are used in every Torque-based game., however the fxDTSBrick/fxDTSBrickData is unique to Blockland.
3. What Destiny said. Armor:: functions have the first argument as the datablock (this case, PlayerStandardArmor etc.) rather than the object.
Thanks again.
I am glad we have such great scripters lurking around. ;D

Whenever you have a function occuring inside a namespace (the namespace is separated from the function by a double colon (::)) the first argument in the function will almost always be the object of the namespace the function is being called on. For example, in Player::SetShapeName, the first argument is the player while the second is the ShapeName to be set.

Whenever you have a function occuring inside a namespace (the namespace is separated from the function by a double colon (::)) the first argument in the function will almost always be the object of the namespace the function is being called on. For example, in Player::SetShapeName, the first argument is the player while the second is the ShapeName to be set.
So, the best way to know what to put there is using dumpConsoleClasses or any of the other like Space Guy said i guess.
But thanks for the explanation.

Another question:
I noticed an animation which is unused (as far as i can see, as the keybind calls an unexisting function) for the standard playertype in TwoGuns (celsalute).
How can i execute this animation (by servercmd)?

I searched through the pdf guide and found this what could be what i am searching.
Code: [Select]
setActionThread( string sequenceName , hold , fps )Is this the right line and what is fps?
(I couldn't find what i have to put @ fps)

Big thanks in advance.
« Last Edit: January 29, 2010, 10:09:42 AM by lordician »

You would probably want to use playThread instead.
The first argument is the slot, which allows you to layer multiple animations.
Code: [Select]
%player.playThread(1, animationName);

You would probably want to use playThread instead.
The first argument is the slot, which allows you to layer multiple animations.
Code: [Select]
%player.playThread(1, animationName);
Okay.
I figured though.