Page 1 of 1

Custom Functions not working for me? What am I doing?

Posted: Sun Sep 11, 2016 12:27 pm
by Mattjwlittler
Hi, I'm having issues getting custom functions to work.

I'm on LC 7.1 on Mac

I've tried applying the example functions provided in the LC documentation (below) but when I click "Apply" I get an error near "function". Don't understand... and my app is going to be crazy without callable functions...
Tx in advance for your help.
Matt

function Summy
put 1 + 1 into tSummy
return tSummy
end Summy

or

function myFunction
return "test"
end myFunction

or

function boomboom
answer "Boom"
end boomboom

Re: Custom Functions not working for me? What am I doing?

Posted: Sun Sep 11, 2016 1:43 pm
by jmburnod
Hi Matt
Welcome to this forum
Amazing !
I tested your three functions without error (Mac, LC 7.06,7.1, indy).
Best regards
Jean-Marc

Re: Custom Functions not working for me? What am I doing?

Posted: Sun Sep 11, 2016 1:50 pm
by Mattjwlittler
Thanks Jean-Marc. I'll do some more testing with a new stack / different version of LC.

Re: Custom Functions not working for me? What am I doing?

Posted: Sun Sep 11, 2016 1:55 pm
by Mattjwlittler
There's a lesson. Always try what you're doing with a clean slate if it doesn't work the way you think. I was trying to declare it inside the on OpenCard... :oops:

Re: Custom Functions not working for me? What am I doing?

Posted: Sun Sep 11, 2016 2:30 pm
by jmburnod
I was trying to declare it inside the on OpenCard... :oops:
Congratulation. You now can do

Code: Select all

on opencard
  get summy() 
  answer it
end opencard

Re: Custom Functions not working for me? What am I doing?

Posted: Fri Sep 16, 2016 11:20 am
by Mattjwlittler
Exactly. Calling inside events is what I want - obviously declaring there doesn't help anyone...