Page 1 of 1

Where can I find information regarding functions

Posted: Sun May 19, 2013 2:05 pm
by shawnblc
Where can I find information regarding functions? I'm looking on how to use them, when to use them, etc for a complete beginner.

Thanks.

Re: Where can I find information regarding functions

Posted: Sun May 19, 2013 2:28 pm
by jmburnod
Hi Shawnbic,

There is some infos into the dictionary with one example

Here is a very simple to get the result of an addition

on mouseUp
put AddTwoValue(1,2)
end mouseUp

function AddTwoValue pVal1,pVal2
return pVal1 + pVal2
end AddTwoValue

Best regards

Re: Where can I find information regarding functions

Posted: Sun May 19, 2013 6:18 pm
by Dixie
Shawn...

Have a read of p.134 of the User Guide... 'Custom Commands & Functions'

Dixie

Re: Where can I find information regarding functions

Posted: Sun May 19, 2013 6:28 pm
by shawnblc
Dixie wrote:Shawn...

Have a read of p.134 of the User Guide... 'Custom Commands & Functions'

Dixie
Excellent. Thank you Dixie.

I knew I saw something on it before, but couldn't remember where I saw it, the user guide is exactly where I saw it. Gonna read it again now. Thanks again.

Re: Where can I find information regarding functions

Posted: Wed May 29, 2013 1:41 am
by SimpleLife
which is the link to the user guide :-(

I'm puzzled.

I have added a function to my CARD script, the card is call "mycard"

The function is called "myfunction"

function myfunction
put "hello world" into field "status"
end myfunction

When I use an image script to call myfunction, all variations complain they can't find it (except dispatch which shows no errors)

//dispatch "myfunction" to card "myCard"
//send "myfunction" to "myCard"
//send to "myfunction" of card "myCard"
//call "myfunction"
call "myfunction" to card "myCard"

As you can see, i am not sure of the correct syntax, but I seem to have tried all of the examples.

This must be so simple I can not see it :-(

Any ideas?

Re: Where can I find information regarding functions

Posted: Wed May 29, 2013 1:50 am
by makeshyft
what are u trying to do?

Re: Where can I find information regarding functions

Posted: Wed May 29, 2013 2:55 am
by SimpleLife
What I said.

I'm just trying to call a function in the card scripts, from a button/image in the main stack.

Re: Where can I find information regarding functions

Posted: Wed May 29, 2013 9:24 am
by jmburnod
Hi SimpleLife,

You open the user guide with the help menu.
A function return a value

Try this:
In the cd or stack script
function myfunction
return "hello world"
end myfunction

In the control script
on mouseup
put myfunction() into fld "status"
end mouseup

Best regards
Jean-Marc

Re: Where can I find information regarding functions

Posted: Wed May 29, 2013 10:57 am
by SimpleLife
HUGE THANKS Jean-Marc :-)


that was the clue I needed!

It was just the missing brackets for the function

call myfunction()

now works - YAY!