Author Topic: Event Help  (Read 1290 times)

I'm pretty sure I did this somewhat correctly, more than likely not though.

Anyone see any major issues as to why the events don't show up in the event list, because it shows up on the addon list

Code: [Select]
registerOutputEvent(fxDtsBrick, "checkMask", "", 1);
registerInputEvent(fxDtsBrick, "onMaskTrue", "Self fxDtsBrick\tPlayer Player\tClient GameConnection\tMinigame Minigame");
registerInputEvent(fxDtsBrick, "onMaskFalse", "Self fxDtsBrick\tPlayer Player\tClient GameConnection\tMinigame Minigame");


function fxDTSBrick::onMaskTrue(%this, %obj, %client)
{
$inputTarget_self = %this;
$inputTarget_client = %client;
$inputTarget_player = %client.player;
$inputTarget_miniGame = getMiniGameFromObject(%this);
%this.processInputEvent("VariableTrue", %client);
}

function fxDTSBrick::onMaskFalse(%this, %obj, %client)
{
$inputTarget_self = %this;
$inputTarget_client = %client;
$inputTarget_player = %client.player;
$inputTarget_miniGame = getMiniGameFromObject(%this);
%this.processInputEvent("VariableFalse", %client);
}

function fxDTSBrick::checkMask(%this, %obj, %client)
{
if(%obj.client.Gasmask == 0)
{
if(%obj.getType() & $TypeMasks::PlayerObjectType && %obj.getState() !$= "Dead")
{
%db = %obj.getDatablock();

if(!%obj.isPlayer)
{
%this.onMaskFalse(%client);
else
%this.onMaskTrue(%client);
}
}
}
}

That looks pretty dangerous. What if I did like this?

onActivate -> Self -> checkMask
VariableTrue -> Self -> CheckMask


Anyway, something you're doing wrong is that you're registering checkMask as a brick event, not a client event.
Also, why are you registering onMaskTrue and onMaskFalse if you aren't using them?

By the way, it has a syntax error. You're missing the ending bracket for the first clause and the starting bracket for the second clause here:

            if(!%obj.isPlayer)
            {
               %this.onMaskFalse(%client);
            else
               %this.onMaskTrue(%client);
            }
« Last Edit: June 15, 2012, 11:34:20 AM by Port »

Nevermind.

If I'm using the Gasmask's variables, do I need to make it a forced addon?
« Last Edit: June 15, 2012, 11:59:26 AM by ¥ola »

Okay well.

This is starting to piss me off.

The events all show up but don't do anything when you use them.

Code: [Select]
registerOutputEvent(fxDTSBrick, checkMask);
registerInputEvent(fxDTSBrick, "onMaskTrue", "Self fxDtsBrick\tPlayer Player\tClient GameConnection\tMinigame Minigame");
registerInputEvent(fxDTSBrick, "onMaskFalse", "Self fxDtsBrick\tPlayer Player\tClient GameConnection\tMinigame Minigame");

function fxDTSBrick::onMaskTrue(%this, %obj, %client)
{
$InputTarget_["Self"] = %obj;
$InputTarget_["Player"] = %client.player;
$InputTarget_["Client"] = %client;

if($Server::LAN)
   {
      $InputTarget_["MiniGame"] = getMiniGameFromObject(%client);
   }
   else
   {
      if(getMiniGameFromObject(%obj) == getMiniGameFromObject(%client))
         $InputTarget_["MiniGame"] = getMiniGameFromObject(%obj);
      else
         $InputTarget_["MiniGame"] = 0;
   }
%this.processInputEvent("onMaskTrue", %client);
}

function fxDTSBrick::onMaskFalse(%this, %obj, %client)
{
$InputTarget_["Self"] = %obj;
$InputTarget_["Player"] = %client.player;
$InputTarget_["Client"] = %client;

if($Server::LAN)
   {
      $InputTarget_["MiniGame"] = getMiniGameFromObject(%client);
   }
   else
   {
      if(getMiniGameFromObject(%obj) == getMiniGameFromObject(%client))
         $InputTarget_["MiniGame"] = getMiniGameFromObject(%obj);
      else
         $InputTarget_["MiniGame"] = 0;
   }
%this.processInputEvent("onMaskFalse", %client);
}

function fxDTSBrick::checkMask(%obj,%client)
{
if(%obj.client.Gasmask == 0)
{
if(%obj.getType() & $TypeMasks::PlayerObjectType && %obj.getState() !$= "Dead")
{
%db = %obj.getDatablock();

if(!%obj.isPlayer)
{
%this.onMaskFalse(%client);
}

else

{
%this.onMaskTrue(%client);
}
}
}
}

If they don't have a gasmask:
    If the brick is a player and the brick is not dead:
        If the brick is not a player:
            Run "onMaskFalse"
        Otherwise:
            Run "onMaskTrue"

What the hell are you doing?

Code: [Select]
function fxDTSBrick::checkMask(%obj,%client)
{
if(%obj.client.Gasmask == 0) //not 100% perfect, but suitable
{
//if(%obj.getType() & $TypeMasks::PlayerObjectType && %obj.getState() !$= "Dead")//unnecessary
//{ //unnecessary
//%db = %obj.getDatablock(); //unnecessary

//if(!%obj.isPlayer) //wtf is this stuff
//{
%this.onMaskFalse(%client);
}

else

{
%this.onMaskTrue(%client);
//} //depreciated
//} //depreciated
}
}

fixed version

Code: [Select]
function fxDTSBrick::checkMask(%obj,%client)
{
if(%obj.client.Gasmask == 0) //not 100% perfect, but suitable
{
%this.onMaskFalse(%client);
}
else
{
%this.onMaskTrue(%client);
}
}

If they don't have a gasmask:
    If the brick is a player and the brick is not dead:
        If the brick is not a player:
            Run "onMaskFalse"
        Otherwise:
            Run "onMaskTrue"

What the hell are you doing?

I knew %obj was wrong.

I took that almost exactly out of the ChemGrenade script.  
How the hell doesn't it work?

I knew %obj was wrong.

I took that almost exactly out of the ChemGrenade script. 
How the hell doesn't it work?

read my post and use common sense to find out why it doesn't work

I knew %obj was wrong.

I took that almost exactly out of the ChemGrenade script. 
How the hell doesn't it work?
I knew it.
I loving kneeeeewww ittttt

I was hoping something else, because you said "you shouldn't rip code" in your topic, but forget.

I knew it.
I loving kneeeeewww ittttt

I was hoping something else, because you said "you shouldn't rip code" in your topic, but forget.
Yeah.
And know I have learned my lesson.

forget.


click that
Well stuff.  It still doesn't work.

Code: [Select]
registerOutputEvent(fxDTSBrick, checkMask);
registerInputEvent(fxDTSBrick, "onMaskTrue", "Self fxDtsBrick\tPlayer Player\tClient GameConnection\tMinigame Minigame");
registerInputEvent(fxDTSBrick, "onMaskFalse", "Self fxDtsBrick\tPlayer Player\tClient GameConnection\tMinigame Minigame");

function fxDTSBrick::onMaskTrue(%this, %obj, %client)
{
$InputTarget_["Self"] = %obj;
$InputTarget_["Player"] = %client.player;
$InputTarget_["Client"] = %client;

if($Server::LAN)
   {
      $InputTarget_["MiniGame"] = getMiniGameFromObject(%client);
   }
   else
   {
      if(getMiniGameFromObject(%obj) == getMiniGameFromObject(%client))
         $InputTarget_["MiniGame"] = getMiniGameFromObject(%obj);
      else
         $InputTarget_["MiniGame"] = 0;
   }
%this.processInputEvent("onMaskTrue", %client);
}

function fxDTSBrick::onMaskFalse(%this, %obj, %client)
{
$InputTarget_["Self"] = %obj;
$InputTarget_["Player"] = %client.player;
$InputTarget_["Client"] = %client;

if($Server::LAN)
   {
      $InputTarget_["MiniGame"] = getMiniGameFromObject(%client);
   }
   else
   {
      if(getMiniGameFromObject(%obj) == getMiniGameFromObject(%client))
         $InputTarget_["MiniGame"] = getMiniGameFromObject(%obj);
      else
         $InputTarget_["MiniGame"] = 0;
   }
%this.processInputEvent("onMaskFalse", %client);
}

function fxDTSBrick::checkMask(%obj,%client)
{
if(%obj.client.Gasmask == 0)
{
%this.onMaskFalse(%client);
}
else
{
%this.onMaskTrue(%client);
}
}

Use %client.Gasmask, not %obj.client.Gasmask. %obj is the brick.

registerOutputEvent(fxDTSBrick, checkMask);

becomes

registerOutputEvent(fxDTSBrick, "checkMask", "", 1);

Use %client.Gasmask, not %obj.client.Gasmask. %obj is the brick.
not as clean, but his way works.
edit: sorta, ok no, it doesn't

registerOutputEvent(fxDTSBrick, checkMask);

becomes

registerOutputEvent(fxDTSBrick, "checkMask", "", 1);
not as clean, but his way works.
edit: sorta, ok no, it doesn't

Well.
I still haven't got it to work.