Author Topic: Output Event Argument help  (Read 962 times)

Code: [Select]
registerOutputEvent("fxDTSBrick", "exampleFunction", "string 40 32" , "string 40 32", 0);

function fxDTSBrick::exampleFunction(%argument1, %argument2, ...)

Alright, I'm trying to get two different strings in the output event, and I want these strings to be stored in the variables %argument1, and 2 respectively. This is just an example code. Not exactly what I'm writing, but it should be the same in this situation.

The problem I'm getting is the second argument isn't the second string. It's undefined and causes some odd glitches.

If anyone could inform me on how to resolve this or post some sample code, that would be nice :)

Code: [Select]
registerOutputEvent("fxDTSBrick", "exampleFunction", "string 40 32" , "string 40 32", 0);

function fxDTSBrick::exampleFunction(%argument1, %argument2, ...)
Firstly - The output event arguments you want are all stored in one argument, not 2. So it'd be this instead:
registerOutputEvent("fxDTSBrick", "exampleFunction", "string 40 32 string 40 32", 0);
Secondly the first argument in your function should be the target object the event is working with; in this case a brick. So the arguments in your function should be %brick,%arg1,%arg2.

Firstly - The output event arguments you want are all stored in one argument, not 2. So it'd be this instead:
registerOutputEvent("fxDTSBrick", "exampleFunction", "string 40 32 string 40 32", 0);
Secondly the first argument in your function should be the target object the event is working with; in this case a brick. So the arguments in your function should be %brick,%arg1,%arg2.

Event arguments are tab delimited so it should be:
Code: [Select]
registerOutputEvent("classname", "method", "string X X" TAB "int X X" TAB "list A 1 B 2", 0);
You can do "blah" TAB "blah" or "blah\tblah", either works.


« Last Edit: April 03, 2009, 05:52:11 AM by Destiny/Zack0Wack0 »

I've got my code organized like that now. I did have %brick as my first argument but I was separating the output event arguments incorrectly. I fixed that, but I'm still getting errors. Is there an easy way for me to check what these variables are ending up as? I tried echo(). This just made my event disappear.


Well, I'm trying to make a sort of dice letter event for print bricks for boggle or scrabble type games. When I lay a print brick it has what appears to be a screen capture of my desktop. Then I try inputting two letters for it to randomly choose between. It then switches between the first letter and the desktop-like image.

Well, I'm trying to make a sort of dice letter event for print bricks for boggle or scrabble type games. When I lay a print brick it has what appears to be a screen capture of my desktop. Then I try inputting two letters for it to randomly choose between. It then switches between the first letter and the desktop-like image.
That alone would be a cool feature even if it is a glitch.

Nevermind with the help. I've got my script working. It wasn't the problem I thought it was. I just wasn't using the variable correctly once I obtained it.

Thanks for the help though. :)

Edit: actually, if you read this, is the max number of arguments in the output event 4? It gives me an error if I try more than that.
« Last Edit: April 03, 2009, 11:00:19 PM by Orgodemirk »

You should make the output event like this:

registerOutputEvent("fxDTSBrick", "exampleFunction", "string 40 32\tstring 40 32", 0);

instead of

registerOutputEvent("fxDTSBrick", "exampleFunction", "string 40 32" , "string 40 32", 0);

Then for the function:

function fxDTSBrick::exampleFunction(%this,%arg1,%arg2)

Note that %this is the brick.

Already solved it, but thanks for your concern. Locking...