Problems using Send and Functions with 2 parameters

Jim Ault JimAultWins at yahoo.com
Tue Aug 8 22:12:10 EDT 2006


On 8/8/06 1:58 PM, "Ian McKnight" <iangmcknight at googlemail.com> 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.
> 
> send "moveClockHands randomTime(15,2)" to group "analogClock" doesn't work
> 
> but send "moveClockHands randomTime(15)" to group "analogClock"    and
> send "moveClockHands randomTime()" to group "analogClock" both work
> 
> 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"
> send "moveClockHands the result" to group "analogClock"
> 

Why not do the following?

insert the script of group analogClock into back

Now all the scripts are in the message path and you don't need 'send' or use
value, etc.

You could do this on openstack,preopenstack,
showAnalogClock, enableAnalogClock. opencard, etc

if you do...

on returnValuesToCallingHandler pFirstFactor, pSecondFactor
   return ((pFirstFactor*10) + pSecondFactor)
end returnValuesToCallingHandler

on processData
   set the itemdel to tab
   returnValuesToCallingHandler 15, 2
   put the result into ansFromAbove
   -- do more work
end processData 

Further, write your first handler to know what to do...
moveClockHands "random", 15,2

will tell it to call the random function using 15 & 2, then move the hands

Hope this helps.


Jim Ault
Las Vegas







More information about the use-livecode mailing list