Helper functions and global variables

David McFarlane mcfarla9 at msu.edu
Tue May 25 17:45:31 UTC 2010


David,

Just a couple more hints for writing functions, subs, & EP code in general:

- Unlike a rational language such as C or even JavaScript, E-Basic 
requires parantheses around the argument list in any call to a 
Function, but forbids parentheses around the argument list in any 
call to a Sub.  When writing & using Subs, eventually you will run 
across a runtime error such as,

---------------------------
The following error was found while attempting to compile the E-Basic script:
Encountered: ','
Expecting: <operator>, ')'
---------------------------

This just means that, out of long habit with other languages (and in 
keeping with the syntax in the *definition* of the Sub), you made the 
mistake of using a Sub and enclosing its argument list in 
parantheses, and now you need to remove those parentheses.  Sigh.

- Read through the full code that E-Studio generates from any .es 
file.  With prior experience in VBA you should be able to learn a lot 
just from poring over the generated code.

-- David McFarlane, Professional Faultfinder


At 5/25/2010 08:37 AM Tuesday, you wrote:
>David,
>
>Stock reminder:  1) I do not work for PST.  2) PST's trained staff 
>really does like to take any and all questions at 
>http://support.pstnet.com/e%2Dprime/support/login.asp , and they 
>strive to respond to all requests in 24-48 hours -- this is pretty 
>much their substitute for proper documentation, so make full use of 
>it.  3) If you do get an answer from PST Web Support, please extend 
>the courtesy of posting their reply back here for the sake of others.
>
>That said, here is my take ...
>
>1) Study Chapter 4, "E-Basic", of the User's Guide that came with 
>E-Prime.  (Beyond that, do yourself a favor and work through all of 
>the Getting Started Guide and User's Guide; you may leave the 
>Reference Guide for later.)
>
>2) The online E-Basic Help may not work because Vista removed 
>support for the older (and long deprecated) .hlp format.  To enable 
>the online E-Basic Help, you must either download and install the 
>.hlp reader for Vista from Microsoft, or install a newer version of 
>EP2, which comes with online E-Basic Help in the newer .chm format 
>(which has its own problems).
>
>3) Although the online E-Basic Help is indeed the closest we get to 
>actual technical documentation, it will not answer all your 
>questions as it is incomplete and in several places just plain 
>wrong.  So beware, you still have to user your own wits when 
>figuring out E-Prime.
>
>-- David McFarlane, Professional Faultfinder
>
>
>On Monday 24 May 2010 David Allen wrote:
>>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.



More information about the Eprime mailing list