Problems using Send and Functions with 2 parameters

Dar Scott dsc at swcp.com
Tue Aug 8 18:21:37 EDT 2006


On Aug 8, 2006, at 2:58 PM, Ian McKnight wrote:

> Thanks Dar - I revisited your suggestion for a custom command and made
> the handler work.
>
> A function seemed more appropriate to what I wanted to do as it
> returned a value (thats why I had thought of using the 'get' command
> to get access to the RESULT and it works) but  it's as if the send
> command only accepts one or no paramenters in situations like this.

Yeah, I don't think sending a 'get' is supported.

> send "moveClockHands randomTime(15,2)" to group "analogClock"  
> doesn't work

This should eval randomTime(15,2) before sending.  If it is in your  
message path, you will be OK.

I made something in the path, but I get something wrong, too.

> but send "moveClockHands randomTime(15)" to group "analogClock"    and
> send "moveClockHands randomTime()" to group "analogClock" both work

weird.  Something is amiss.

Though, I would consider the 'get' as outside of what is intended,  
this is a bug.

> My solution was to convert the function randomTime to a custom command
> but retain its RETURN command.
>
> This gives the following 2 stage solution
>
> send "randomTime(15,2)" to group "analogClock"

For a command, remove the parens.  Are you working with an old  
version?  What you have will create a single parameter for the  
randomTime command.

> send "moveClockHands the result" to group "analogClock"

Since things are acting weird, try

send "randomTime 15,2" to group "analogClock"
get the result
send "moveClockHands it" to group "analogClock"

I tend to keep the send parameter to a single command plus a comma  
delimited list of variable parameters, like this:

send "advancePen m,n,x" ...

This looks like a good place for a setProp in the group, if  
'moveClockHands' will set the time rather than advance some amount.

Dar Scott






More information about the use-livecode mailing list