Page 1 of 1

Events parameters give out additional [']

Posted: Thu Dec 05, 2013 1:33 pm
by Tristhan
Hiya,

i am getting some strange results from a parameter within event.
Whenever my Test Event triggers the string "myName" returns [Toonname']
How can i avoid the ['] ? Any idea ?

Thank you in advance.

1.

#Event Test "#*#Test #1# #2#"

/gu Test TargetToonName MyToonName

Sub Event_Test(string Line, string targetName, string myName,)

/echo ${myName} -> result [Toonname']
/if (${myName.Equal[${Me.CleanName}']}) -> returns TRUE


2. Does it make any different if i write
#Event Test "#*#Test #1# #2#" or
#Event Test "#*#Test #1# #2# (without " at the end)

Re: Events parameters give out additional [']

Posted: Thu Dec 05, 2013 2:08 pm
by Noren
#Event Test "#*#Test #1# #2#'"

Re: Events parameters give out additional [']

Posted: Thu Dec 05, 2013 2:16 pm
by Tristhan
Noren wrote:#Event Test "#*#Test #1# #2#'"


Thank you, that makes sense :mrgreen:
So i need to add ['] at the end of the eventline when the last parameter is a placeholder like #2# ?

Re: Events parameters give out additional [']

Posted: Fri Dec 06, 2013 1:13 am
by Noren
Tristhan wrote:
Noren wrote:#Event Test "#*#Test #1# #2#'"


Thank you, that makes sense :mrgreen:
So i need to add ['] at the end of the eventline when the last parameter is a placeholder like #2# ?


Exactly. Your event line is telling MQ2 that you want everything following the space after #1# to be stored into #2#. By adding the ['] you're telling it to store everything following the space after #1# until it hits an ['] character.

Here's the catch! It could prematurely cut off what you wanted stored in #2# if you do it the way I suggested. Here's an example (and it seems like you understand it pretty well, so this explanation is more for other readers new to MQ2 events):

#Event Test "#*#Test #1# #2#'"
Chrom says, 'Vaion enjoys long walks on Test beautiful Miami Beach'
...becomes...
Chrom says, 'Vaion enjoys long walks on Test ${Param1} ${Param2}'
#*# = Vaion enjoys long walks on
#1# becomes ${Param1} = beautiful
#2# becomes ${Param2} = Miami Beach

Chrom says, 'Vaion enjoys long walks on Test beautiful Miami's beach'
...becomes...
Chrom says, 'Vaion enjoys long walks on Test ${Param1} ${Param2}s beach'
#*# = Vaion enjoys long walks on
#1# becomes ${Param1} = beautiful
#2# becomes ${Param2} = Miami

Re: Events parameters give out additional [']

Posted: Fri Dec 06, 2013 11:02 am
by Tristhan
Noren wrote:Exactly. Your event line is telling MQ2 that you want everything following the space after #1# to be stored into #2#. By adding the ['] you're telling it to store everything following the space after #1# until it hits an ['] character.

Here's the catch! It could prematurely cut off what you wanted stored in #2# if you do it the way I suggested. Here's an example (and it seems like you understand it pretty well, so this explanation is more for other readers new to MQ2 events):

#Event Test "#*#Test #1# #2#'"
Chrom says, 'Vaion enjoys long walks on Test beautiful Miami Beach'
...becomes...
Chrom says, 'Vaion enjoys long walks on Test ${Param1} ${Param2}'
#*# = Vaion enjoys long walks on
#1# becomes ${Param1} = beautiful
#2# becomes ${Param2} = Miami Beach

Chrom says, 'Vaion enjoys long walks on Test beautiful Miami's beach'
...becomes...
Chrom says, 'Vaion enjoys long walks on Test ${Param1} ${Param2}s beach'
#*# = Vaion enjoys long walks on
#1# becomes ${Param1} = beautiful
#2# becomes ${Param2} = Miami


Thank you for the fast help and the nice explanation :D