Events parameters give out additional [']

Third party software discussion goes here.
Tristhan
Posts: 293

Events parameters give out additional [']

Post#1 » Thu Dec 05, 2013 1:33 pm

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)

Noren
Posts: 1053

Re: Events parameters give out additional [']

Post#2 » Thu Dec 05, 2013 2:08 pm

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

Tristhan
Posts: 293

Re: Events parameters give out additional [']

Post#3 » Thu Dec 05, 2013 2:16 pm

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# ?

Noren
Posts: 1053

Re: Events parameters give out additional [']

Post#4 » Fri Dec 06, 2013 1:13 am

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

Tristhan
Posts: 293

Re: Events parameters give out additional [']

Post#5 » Fri Dec 06, 2013 11:02 am

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

Return to “Third party software”

Who is online

Users browsing this forum: No registered users and 1 guest

cron