Page 1 of 1

Can't pass a parameter to an handler [Solved]

Posted: Wed May 14, 2014 2:19 pm
by atout66
Hi to all,

I want to send a parameter via a <send> command, but I don't find the right syntax... Here is my code:

Code: Select all

send updateHistorique leMot to laCard 
<laCard> is the long ID of the card and the parameter is <leMot > for the handler <updateHistorique> in card <laCard>

I also tried : send updateHistorique,leMot to laCard but it doen't work either...

Any idea what's wrong ?
Thanks in advance, Jean-Paul.

Re: Can't pass a parameter to an handler

Posted: Wed May 14, 2014 2:21 pm
by Mark
Hi Jean-Paul,

There are 2 ways to do this:

Code: Select all

    put "mot" into leMot
    send "updateHistorique leMot" to laCard 
or

Code: Select all

    put "mot" into leMot
    send "updateHistorique" && quote & leMot & quote to laCard 
Usually the first method works fine but in rare cases you need the second method.

Kind regards,

Mark

Re: Can't pass a parameter to an handler

Posted: Wed May 14, 2014 4:40 pm
by FourthWorld
The send command is ideal for timers, using "send <msg> in <time>". For sending a message without delay you'll find better performance and greater convenience using the dispatch command instead, e.g.:

Code: Select all

dispatch "someMessage" to tSomeObj with tSomeArg

Re: Can't pass a parameter to an handler

Posted: Wed May 14, 2014 5:05 pm
by Mark
Hi,

Note that dispatch needs checking the result, while send will cause an execution error of the engine couldn't handle the message. In most cases, I prefer the send command.

Mark

Re: Can't pass a parameter to an handler

Posted: Wed May 14, 2014 5:09 pm
by atout66
Thanks for your help Mark and Richard.

I better understand now... :wink:

Kind regards, Jean-Paul.