Helper functions and global variables
Michiel Spape
Michiel.Spape at nottingham.ac.uk
Tue May 25 11:51:56 UTC 2010
Hiya,
Here's one from me:
Function TekenCirkel(xloc, yloc, size as integer, colour as string) as boolean
cnvsnext.FillColor = CColor(colour)
cnvsnext.PenColor = CColor(colour)
cnvsnext.Circle xloc, yloc, size
TekenCirkel = true
end Function
'canvasnext is my buffered canvas, by the way, so at some point you can swap that one for the front one and everything is drawn at once.
...
You get the idea - Function FunctionName (inputvars) as returnvariable-type
Then assign to the functionname.
All of that you can put in the user area (Alt+5), which is also where all your variables declared are global.
I can't generally be bothered to find out how E-Prime does this sort of thing, so it's quite possible this is not the best way at all. Also, for your convenience, Subs (functions without returns, i.e. voids):
Sub ClrScrNext()
cnvsnext.FillColor = CColor(BGColour)
cnvsnext.clear
End Sub
Cheers,
Mich
Michiel Spapé
Research Fellow
Perception & Action group
University of Nottingham
School of Psychology
-----Original Message-----
From: e-prime at googlegroups.com [mailto:e-prime at googlegroups.com] On Behalf Of David Allen
Sent: 25 May 2010 01:30
To: E-Prime
Subject: Helper functions and global variables
Hello,
I'm new to e-prime and the last time I did visual basic was 7 years
ago. I am, however, an experienced programmer. Unfortunately I'm stuck
using e-prime on a vista machine, which breaks the help (where I'm
certain I could find the answers to my questions).
How does one go about defining helper functions (functions in an
inline script that can be referred to anywhere in the project) and
global variables (the same but in variable form)? I found the visual
basic syntax for each and tried to just use it inside an inline script
but the compiler threw errors like "Found: Function Expected:
<statement>" for
function foo as integer
return 1
end function
Any help or pointers to good resources besides the help file will be
much appreciated.
Thanks, David
--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.
This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.
--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.
More information about the Eprime
mailing list