Blockland Forums > Modification Help
Event: onPlayerFirstSpawn not working
Mordius:
I'm attempting to expose a new event: onPlayerFirstSpawn. Although I'm a professional programmer, I have no prior experience with TorqueScript. To get started I read some tutorials on TorqueScript and looked through pre-existing events to see what I could find. I then copy/pasted some stuff together in the hopes that I could get it to magically work, but I'm not having much luck. Here's what I've got so far:
--- Code: ---registerInputEvent(fxDTSBrick,onPlayerFirstSpawn,"Self fxDTSBrick" TAB "Player Player" TAB "Client GameConnection" TAB "MiniGame Minigame");
package onPlayerFirstSpawn
{
function GameConnection::onClientEnterGame(%client) {
parent::onClientEnterGame(%client);
$InputTarget_["Client"] = %client;
%brick.processInputEvent(onPlayerFirstSpawn,%client);
}
};activatePackage(onPlayerFirstSpawn);
--- End code ---
However, like I said before, this isn't working. What am I doing wrong and how can I fix it?
xXBeibsFan119Xx:
Wow, standards must be pretty low in the industry.
%brick is undefined.
Lugnut:
wouldn't you have to like loop through every brick to get this to work?
you have to tell it which brick to process on
xXBeibsFan119Xx:
--- Quote from: Lugnut1206 on May 05, 2012, 04:58:21 PM ---wouldn't you have to like loop through every brick to get this to work?
--- End quote ---
Nope. Just hook in to the addEvent/removeEvent or whatever methods, check if it's the event, and add the brick to a list, which the method above would loop through.
Mordius:
Hey BeibsFan, thanks for the "compliment". TorqueScript is pretty unfamiliar to me and I've actually never done anything remotely like it, so could you explain a little more? I guess you could call me a "noob".