Page 1 of 1

Question about Sub Event with ${Sender}

Posted: Mon May 06, 2013 1:34 pm
by Tristhan
Hiya,

i am using UF.

Sub Event_RaidInvite(Line,Sender)

/if (${Raid.Leader.Name.Equal[${Me.CleanName}]}) {
/delay 5
/tell ${Sender} OK
/say ${Sender} OK
/raidinvite ${Sender}
/delay 5
}

/return

I can trigger my Subevent RaidInvite but the ${Sender} wont get an Tell/Raidinvite.
Tho my Chatwindow says: You invite Sendername to join your raid, but the Sender dont get an Raidinvite. If i perform the command /raidinvite Sendername ingame it works perfect.
Same with Tell: You told ,'is not online at the momemt'.

Anyone have any idea how i can solve that/ what i am doing wrong ?

Re: Question about Sub Event with ${Sender}

Posted: Mon May 06, 2013 6:15 pm
by Noren
echo out ${Param0}, 1, and 2 to show you which parameter holds the sender. Once you have the parameters that you need you can then use it for your raidinvite and tell commands.

Re: Question about Sub Event with ${Sender}

Posted: Fri May 10, 2013 4:12 pm
by Linideen1

Code: Select all

${Sender.Right[-2].Left[-1]}


That will fix ur problem, You have Extra spaces in the name that MQ adds when it Grab it.
That way of Echo'ing that Param Made it a pita to figure that out when I was trying to figure this out cause its hard to see the extra spaces, So do 1${Param1}1 and then u can see them.

Re: Question about Sub Event with ${Sender}

Posted: Fri May 10, 2013 5:26 pm
by Tristhan
Thank you, i will test both advice.

Re: Question about Sub Event with ${Sender}

Posted: Wed Jul 03, 2013 10:08 am
by Tristhan
Thank you Noren and Linideen1, the event is working :D


Another question about events:

----
#Event Test "#*#Test #2# #3#"

Sub Event_Test(Line, Sender, Toon1, Toon2)

/if (${Toon1.Equal[${Me.CleanName}]}) {
/echo OK Toon1
}

/if (${Toon2.Equal[${Me.CleanName}]}) {
/echo OK Toon2
}
----

Toon1 is working, but Toon2 doesnt work.
/echo ${Toon2} and ${Me.CleanName} are equal but still my /if (${Toon2.Equal[${Me.CleanName}]}) dont trigger.

Any idea/help ?
Thank you

Re: Question about Sub Event with ${Sender}

Posted: Wed Jul 03, 2013 4:23 pm
by conradd
Have you tried Linideen1's tip and try :

Code: Select all

/echo |${Toon2}|

to see if there isn't some not visible characters ?

Re: Question about Sub Event with ${Sender}

Posted: Wed Jul 03, 2013 8:26 pm
by Noren
Tristhan wrote:Thank you Noren and Linideen1, the event is working :D


Another question about events:

----
#Event Test "#*#Test #2# #3#"

Sub Event_Test(Line, Sender, Toon1, Toon2)

/if (${Toon1.Equal[${Me.CleanName}]}) {
/echo OK Toon1
}

/if (${Toon2.Equal[${Me.CleanName}]}) {
/echo OK Toon2
}
----

Toon1 is working, but Toon2 doesnt work.
/echo ${Toon2} and ${Me.CleanName} are equal but still my /if (${Toon2.Equal[${Me.CleanName}]}) dont trigger.

Any idea/help ?
Thank you

I think the issue is that you're skipping over #1# and going right to using #2# and #3# for parameters.

When you do that, using an event like:
#Event Test "#*#Test #2# #3#"

you are passing Param0, Param2, and Param3 to your event's Sub Routine, which is expecting 4 parameters.

So, when we get to your event's Sub Routine:
Sub Event_Test(Line, Sender, Toon1, Toon2)

You are passing Param0, Param2, and Param3 in order. Rewritten it would look like this:
Sub Event_Test(Param0, Param2, Param3, Toon2)

Where Toon2 is NULL because there aren't 4 parameters to pass.

My advice: Use #1#. You need only rewrite the event line, not the routine, to something like: #Event Test "#1# #*#Test #2# #3#"

Re: Question about Sub Event with ${Sender}

Posted: Wed Jul 03, 2013 10:15 pm
by Grey
Noren wrote:
Tristhan wrote:Thank you Noren and Linideen1, the event is working :D


Another question about events:

----
#Event Test "#*#Test #2# #3#"

Sub Event_Test(Line, Sender, Toon1, Toon2)

/if (${Toon1.Equal[${Me.CleanName}]}) {
/echo OK Toon1
}

/if (${Toon2.Equal[${Me.CleanName}]}) {
/echo OK Toon2
}
----

Toon1 is working, but Toon2 doesnt work.
/echo ${Toon2} and ${Me.CleanName} are equal but still my /if (${Toon2.Equal[${Me.CleanName}]}) dont trigger.

Any idea/help ?
Thank you

I think the issue is that you're skipping over #1# and going right to using #2# and #3# for parameters.

When you do that, using an event like:
#Event Test "#*#Test #2# #3#"

you are passing Param0, Param2, and Param3 to your event's Sub Routine, which is expecting 4 parameters.

So, when we get to your event's Sub Routine:
Sub Event_Test(Line, Sender, Toon1, Toon2)

You are passing Param0, Param2, and Param3 in order. Rewritten it would look like this:
Sub Event_Test(Param0, Param2, Param3, Toon2)

Where Toon2 is NULL because there aren't 4 parameters to pass.

My advice: Use #1#. You need only rewrite the event line, not the routine, to something like: #Event Test "#1# #*#Test #2# #3#"


#EVENT Test "#*#Test #1# #2#"
Since you don't care whats before test and are looking for up to two param after the word test.
edit: I know the mq2 wiki documentation on param's is pretty weak but its still work reading it a couple times and looking at like modbot or on misc public mq2 forums you can find macros I have authored which have great examples of how to do this.

Re: Question about Sub Event with ${Sender}

Posted: Thu Jul 04, 2013 8:26 am
by Tristhan
Thank you again, i will test it.
Really helpful and I appreciate the fast reply.