Page 1 of 1

functions

Posted: Wed Dec 22, 2010 8:08 pm
by ianmitroff
i can't seem to get a simple function to work

if enter a simple function within a button and then call it, i get an error saying that it can't be found

there is no error when i compile the script within the button, so what gives? where do you place a function that you've created and want to call?

Re: functions

Posted: Wed Dec 22, 2010 8:58 pm
by jmburnod
Hi ianmitroff,

And welcome on this forum
Can you post your function. It is to easy for help you

Best regards

Jean-Marc

Re: functions

Posted: Wed Dec 22, 2010 9:37 pm
by mwieder
My guess without seeing your code is that you're calling it with the syntax of a command instead of a function

Code: Select all

on mycommand
  put "hello, world"
end mycommand

function myfunction
  return 3
end myfunction

mycommand -- execute the command "mycommand"
put myfunction() -- return the result of the function "myfunction"
myfunction -- wrong calling syntax

Re: functions

Posted: Tue Jan 04, 2011 10:07 pm
by jsburnett
I would put the function in the card script if only used on that card, otherwise the stack script if other cards call this function.
Hope this helps.